Java 类net.minecraft.block.BlockDispenser 实例源码

项目:Backmemed    文件:StructureComponent.java   
protected boolean createDispenser(World p_189419_1_, StructureBoundingBox p_189419_2_, Random p_189419_3_, int p_189419_4_, int p_189419_5_, int p_189419_6_, EnumFacing p_189419_7_, ResourceLocation p_189419_8_)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(p_189419_4_, p_189419_6_), this.getYWithOffset(p_189419_5_), this.getZWithOffset(p_189419_4_, p_189419_6_));

    if (p_189419_2_.isVecInside(blockpos) && p_189419_1_.getBlockState(blockpos).getBlock() != Blocks.DISPENSER)
    {
        this.setBlockState(p_189419_1_, Blocks.DISPENSER.getDefaultState().withProperty(BlockDispenser.FACING, p_189419_7_), p_189419_4_, p_189419_5_, p_189419_6_, p_189419_2_);
        TileEntity tileentity = p_189419_1_.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            ((TileEntityDispenser)tileentity).setLootTable(p_189419_8_, p_189419_3_.nextLong());
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Backmemed    文件:ItemArmor.java   
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase> and (EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return ItemStack.field_190927_a;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.splitStack(1);
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        return stack;
    }
}
项目:CustomWorldGen    文件:DispenseFluidContainer.java   
/**
 * Picks up fluid in front of a Dispenser and fills a container with it.
 */
private ItemStack fillContainer(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    EnumFacing dispenserFacing = source.getBlockState().getValue(BlockDispenser.FACING);
    BlockPos blockpos = source.getBlockPos().offset(dispenserFacing);

    ItemStack result = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
    if (result == null)
    {
        return super.dispenseStack(source, stack);
    }

    if (--stack.stackSize == 0)
    {
        stack.deserializeNBT(result.serializeNBT());
    }
    else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(result) < 0)
    {
        this.dispenseBehavior.dispense(source, result);
    }

    return stack;
}
项目:CustomWorldGen    文件:StructureComponent.java   
protected boolean createDispenser(World p_189419_1_, StructureBoundingBox p_189419_2_, Random p_189419_3_, int p_189419_4_, int p_189419_5_, int p_189419_6_, EnumFacing p_189419_7_, ResourceLocation p_189419_8_)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(p_189419_4_, p_189419_6_), this.getYWithOffset(p_189419_5_), this.getZWithOffset(p_189419_4_, p_189419_6_));

    if (p_189419_2_.isVecInside(blockpos) && p_189419_1_.getBlockState(blockpos).getBlock() != Blocks.DISPENSER)
    {
        this.setBlockState(p_189419_1_, Blocks.DISPENSER.getDefaultState().withProperty(BlockDispenser.FACING, p_189419_7_), p_189419_4_, p_189419_5_, p_189419_6_, p_189419_2_);
        TileEntity tileentity = p_189419_1_.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            ((TileEntityDispenser)tileentity).setLootTable(p_189419_8_, p_189419_3_.nextLong());
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:CustomWorldGen    文件:ItemArmor.java   
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase>and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.copy();
        itemstack.stackSize = 1;
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        --stack.stackSize;
        return stack;
    }
}
项目:Signals    文件:Signals.java   
@EventHandler
public void PreInit(FMLPreInitializationEvent event){
    event.getModMetadata().version = Versions.fullVersionString();

    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    proxy.preInit();
    ModBlocks.init();
    ModItems.init();
    CapabilityMinecartDestination.register();
    CapabilityDestinationProvider.register();
    MinecraftForge.EVENT_BUS.register(proxy);
    MinecraftForge.EVENT_BUS.register(new com.minemaarten.signals.event.EventHandler());
    MinecraftForge.EVENT_BUS.register(new RailReplacerEventHandler());
    BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.TICKET, new BehaviorDispenseTicket());
    asmData = event.getAsmData();
}
项目:MoarCarts    文件:CartDispenserBehavior.java   
public ItemStack dispenseStack(IBlockSource dispenser, ItemStack cartItemStack)
{
    EntityMinecartBase entityMinecartBase;
    World world = dispenser.getWorld();
    boolean cartSpawned = false;
    if(ItemStackUtils.isItemInstanceOf(cartItemStack, ItemMinecartBase.class))
    {
        ItemMinecartBase itemMinecartBase = (ItemMinecartBase)cartItemStack.getItem();
        entityMinecartBase = itemMinecartBase.getEntityFromItem(world, cartItemStack);

        if(entityMinecartBase != null)
        {
            EnumFacing enumfacing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
            BlockPos blockpos = dispenser.getBlockPos().offset(enumfacing);
            cartSpawned = itemMinecartBase.placeCart(cartItemStack, world, blockpos, entityMinecartBase);
        }
    }

    if(!cartSpawned)
    {
        cartItemStack = super.dispenseStack(dispenser, cartItemStack);
    }

    return cartItemStack;
}
项目:Rediscovered-Mod-1.8    文件:ItemLC.java   
public ItemLC(ItemArmor.ArmorMaterial material, int renderIndex, int armorType)
{
    super(material, renderIndex, armorType);
    this.material = material;
    this.armorType = armorType;
    if(this.armorType == 0)
        name = "LeatherChainHelmet";
    else if(this.armorType == 1)
        name = "LeatherChainChest";
    else if(this.armorType == 2)
        name = "LeatherChainLegs";
    else if(this.armorType == 3)
        name = "LeatherChainBoots";
    else
        name = "LeatherChainHelmet";
    GameRegistry.registerItem(this, name);
    setUnlocalizedName(mod_Rediscovered.modid + "_" + name);

    this.renderIndex = renderIndex;
    this.damageReduceAmount = material.getDamageReductionAmount(armorType);
    this.setMaxDamage(material.getDurability(armorType));
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabCombat);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
项目:Rediscovered-Mod-1.8.8    文件:ItemLC.java   
public ItemLC(ItemArmor.ArmorMaterial material, int renderIndex, int armorType)
{
    super(material, renderIndex, armorType);
    this.material = material;
    this.armorType = armorType;
    if(this.armorType == 0)
        name = "LeatherChainHelmet";
    else if(this.armorType == 1)
        name = "LeatherChainChest";
    else if(this.armorType == 2)
        name = "LeatherChainLegs";
    else if(this.armorType == 3)
        name = "LeatherChainBoots";
    else
        name = "LeatherChainHelmet";
    GameRegistry.registerItem(this, name);
    setUnlocalizedName(mod_Rediscovered.modid + "_" + name);

    this.renderIndex = renderIndex;
    this.damageReduceAmount = material.getDamageReductionAmount(armorType);
    this.setMaxDamage(material.getDurability(armorType));
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabCombat);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
项目:AdvancedPotions    文件:BehaviorAdvancedProjectileDispense.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    ItemStack stack = par2ItemStack.splitStack(1);
    if (matchesItem(par2ItemStack)) {
        // dispense item as projectile because the item matches
        IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
        iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        world.spawnEntityInWorld((Entity) iprojectile);
    } else {
        // dispense item as item because it doesn't match
        BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
    }
    return par2ItemStack;
}
项目:MineFantasy    文件:DispenseBombMF.java   
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing var5 = BlockDispenser.getFacing(source.getBlockMetadata());

      IProjectile var6 = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(var6 != null)
      {
        var6.setThrowableHeading((double)var5.getFrontOffsetX(), 0.10000000149011612D*y, (double)var5.getFrontOffsetY(), this.func_82500_b(), this.func_82498_a());
        var3.spawnEntityInWorld((Entity)var6);
        stack.splitStack(1);
      }
      return stack;
  }
项目:MineFantasy    文件:DispenseArrowMF.java   
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());

      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
        iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        var3.spawnEntityInWorld((Entity)iprojectile);
        stack.splitStack(1);
      }
      return stack;
  }
项目:MineFantasy    文件:DispenseBoltMF.java   
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());

      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
        iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        var3.spawnEntityInWorld((Entity)iprojectile);
        stack.splitStack(1);
      }
      return stack;
  }
项目:Magicians-Artifice    文件:MAEntityRegistry.java   
public static void init() {
    EntityRegistry.registerModEntity(EntityMagician.class, "entityMagician", mageID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntitySoulFragment.class, "entitySoul", soulID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntityBossOverworld.class, "bossOverworld", overworldBossID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntityBossNether.class, "bossNether", netherBossID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntityBossEnder.class, "bossEnder", enderBossID, MagiciansArtifice.instance, 80, 3, true);
       //EntityRegistry.registerModEntity(EntityPetPheonix.class, "petPheonix", pheonixID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntityPetAppling.class, "petAppling", applingID, MagiciansArtifice.instance, 80, 3, true);
       EntityRegistry.registerModEntity(EntityPetDragon.class, "petDragon", dragonID, MagiciansArtifice.instance, 80, 3, true);
       //EntityRegistry.registerModEntity(EntityPetRat.class, "petRat", ratID, MagiciansArtifice.instance, 80, 3, true);

       BlockDispenser.dispenseBehaviorRegistry.putObject(ItemRegistry.horcrux, new DispenserSoulBehavior());

    registerEntityEgg(EntityMagician.class, 0x000349, 0xFFE343);
       registerEntityEgg(EntityBossOverworld.class, 0xBBF2FF, 0xFFFFFF);
       registerEntityEgg(EntityBossNether.class, 0xDA0000, 0x3B0000);
       registerEntityEgg(EntityBossEnder.class, 0x3C0059, 0x2B0C36);
       registerEntityEgg(EntityPetAppling.class, 0xDE0101, 0xFFC8C8);
       registerEntityEgg(EntityPetDragon.class, 0xDE0101, 0xFFC8C8);
    registerVillagers();
}
项目:Magicians-Artifice    文件:DispenserSoulBehavior.java   
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();

    if (par2ItemStack.hasTagCompound() && par2ItemStack.stackTagCompound.hasKey("ownerName")) {
        EntitySoulFragment soul = new EntitySoulFragment(world);
        soul.setPlayerName(par2ItemStack.stackTagCompound.getString("ownerName"));
        soul.setLocationAndAngles(i,j,k,0,0);
        world.spawnEntityInWorld(soul);
        System.err.println(soul);
        System.err.println(soul.playerName);
    }

    return par2ItemStack;
}
项目:PeripheralsPlusPlus    文件:ItemNanoSwarm.java   
public ItemStack dispenseStack(IBlockSource blockSource, ItemStack stack) {
    if (NBTHelper.hasTag(stack, "identifier")) {
        World world = blockSource.getWorld();
        IPosition iposition = BlockDispenser.func_149939_a(blockSource);
        EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());
        EntityNanoBotSwarm iprojectile = new EntityNanoBotSwarm(world, iposition.getX(), iposition.getY(), iposition.getZ());
        iprojectile.antennaIdentifier = UUID.fromString(NBTHelper.getString(stack, "identifier"));
        if (NBTHelper.hasTag(stack, "label"))
            iprojectile.label = NBTHelper.getString(stack, "label");
        iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY()+0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        world.spawnEntityInWorld(iprojectile);
        stack.splitStack(1);
    } else {
        return super.dispenseStack(blockSource, stack);
    }
    return stack;
}
项目:ExpandedRailsMod    文件:ItemArmor.java   
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.func_189992_e().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase>and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.copy();
        itemstack.stackSize = 1;
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        --stack.stackSize;
        return stack;
    }
}
项目:ZeldaSwordSkills    文件:ZSSItems.java   
private static void registerItems() {
    try {
        for (Field f: ZSSItems.class.getFields()) {
            if (Item.class.isAssignableFrom(f.getType())) {
                Item item = (Item) f.get(null);
                if (item != null) {
                    ZSSItems.registerItemComparatorMapping(item);
                    String name = item.getUnlocalizedName();
                    GameRegistry.registerItem(item, name.substring(name.lastIndexOf(".") + 1));
                    if (item instanceof ICustomDispenserBehavior) {
                        BlockDispenser.dispenseBehaviorRegistry.putObject(item, ((ICustomDispenserBehavior) item).getNewDispenserBehavior());
                    }
                }
            }
        }
    } catch(Exception e) {
        ZSSMain.logger.warn("Caught exception while registering items: " + e.toString());
        e.printStackTrace();
    }
}
项目:RuneCraftery    文件:BehaviorDispenseArmor.java   
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   int var4 = p_82487_1_.func_82623_d() + var3.func_82601_c();
   int var5 = p_82487_1_.func_82622_e() + var3.func_96559_d();
   int var6 = p_82487_1_.func_82621_f() + var3.func_82599_e();
   AxisAlignedBB var7 = AxisAlignedBB.func_72332_a().func_72299_a((double)var4, (double)var5, (double)var6, (double)(var4 + 1), (double)(var5 + 1), (double)(var6 + 1));
   List var8 = p_82487_1_.func_82618_k().func_82733_a(EntityLivingBase.class, var7, new EntitySelectorArmoredMob(p_82487_2_));
   if(var8.size() > 0) {
      EntityLivingBase var9 = (EntityLivingBase)var8.get(0);
      int var10 = var9 instanceof EntityPlayer?1:0;
      int var11 = EntityLiving.func_82159_b(p_82487_2_);
      ItemStack var12 = p_82487_2_.func_77946_l();
      var12.field_77994_a = 1;
      var9.func_70062_b(var11 - var10, var12);
      if(var9 instanceof EntityLiving) {
         ((EntityLiving)var9).func_96120_a(var11, 2.0F);
      }

      --p_82487_2_.field_77994_a;
      return p_82487_2_;
   } else {
      return super.func_82487_b(p_82487_1_, p_82487_2_);
   }
}
项目:RuneCraftery    文件:DispenserBehaviors.java   
public static void func_96467_a() {
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77704_l, new DispenserBehaviorArrow());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77764_aP, new DispenserBehaviorEgg());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77768_aD, new DispenserBehaviorSnowball());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77809_bD, new DispenserBehaviorExperience());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77726_bs, new DispenserBehaviorPotion());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77815_bC, new DispenserBehaviorMobEgg());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_92104_bU, new DispenserBehaviorFireworks());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77811_bE, new DispenserBehaviorFireball());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77769_aE, new DispenserBehaviorBoat());
   DispenserBehaviorFilledBucket var0 = new DispenserBehaviorFilledBucket();
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77775_ay, var0);
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77786_ax, var0);
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77788_aw, new DispenserBehaviorEmptyBucket());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77709_i, new DispenserBehaviorFire());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77756_aW, new DispenserBehaviorDye());
   BlockDispenser.field_82527_a.func_82595_a(Item.field_77698_e[Block.field_72091_am.field_71990_ca], new DispenserBehaviorTNT());
}
项目:RuneCraftery    文件:DispenserBehaviorDye.java   
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   if(p_82487_2_.func_77960_j() == 15) {
      EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
      World var4 = p_82487_1_.func_82618_k();
      int var5 = p_82487_1_.func_82623_d() + var3.func_82601_c();
      int var6 = p_82487_1_.func_82622_e() + var3.func_96559_d();
      int var7 = p_82487_1_.func_82621_f() + var3.func_82599_e();
      if(ItemDye.func_96604_a(p_82487_2_, var4, var5, var6, var7)) {
         if(!var4.field_72995_K) {
            var4.func_72926_e(2005, var5, var6, var7, 0);
         }
      } else {
         this.field_96461_b = false;
      }

      return p_82487_2_;
   } else {
      return super.func_82487_b(p_82487_1_, p_82487_2_);
   }
}
项目:RuneCraftery    文件:DispenserBehaviorBoat.java   
public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   World var4 = p_82487_1_.func_82618_k();
   double var5 = p_82487_1_.func_82615_a() + (double)((float)var3.func_82601_c() * 1.125F);
   double var7 = p_82487_1_.func_82617_b() + (double)((float)var3.func_96559_d() * 1.125F);
   double var9 = p_82487_1_.func_82616_c() + (double)((float)var3.func_82599_e() * 1.125F);
   int var11 = p_82487_1_.func_82623_d() + var3.func_82601_c();
   int var12 = p_82487_1_.func_82622_e() + var3.func_96559_d();
   int var13 = p_82487_1_.func_82621_f() + var3.func_82599_e();
   Material var14 = var4.func_72803_f(var11, var12, var13);
   double var15;
   if(Material.field_76244_g.equals(var14)) {
      var15 = 1.0D;
   } else {
      if(!Material.field_76249_a.equals(var14) || !Material.field_76244_g.equals(var4.func_72803_f(var11, var12 - 1, var13))) {
         return this.field_96464_b.func_82482_a(p_82487_1_, p_82487_2_);
      }

      var15 = 0.0D;
   }

   EntityBoat var17 = new EntityBoat(var4, var5, var7 + var15, var9);
   var4.func_72838_d(var17);
   p_82487_2_.func_77979_a(1);
   return p_82487_2_;
}
项目:RuneCraftery    文件:DispenserBehaviorFire.java   
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   World var4 = p_82487_1_.func_82618_k();
   int var5 = p_82487_1_.func_82623_d() + var3.func_82601_c();
   int var6 = p_82487_1_.func_82622_e() + var3.func_96559_d();
   int var7 = p_82487_1_.func_82621_f() + var3.func_82599_e();
   if(var4.func_72799_c(var5, var6, var7)) {
      var4.func_94575_c(var5, var6, var7, Block.field_72067_ar.field_71990_ca);
      if(p_82487_2_.func_96631_a(1, var4.field_73012_v)) {
         p_82487_2_.field_77994_a = 0;
      }
   } else if(var4.func_72798_a(var5, var6, var7) == Block.field_72091_am.field_71990_ca) {
      Block.field_72091_am.func_71898_d(var4, var5, var6, var7, 1);
      var4.func_94571_i(var5, var6, var7);
   } else {
      this.field_96466_b = false;
   }

   return p_82487_2_;
}
项目:RuneCraftery    文件:DispenserBehaviors.java   
public static void registerDispenserBehaviours()
{
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.arrow, new DispenserBehaviorArrow());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.egg, new DispenserBehaviorEgg());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.snowball, new DispenserBehaviorSnowball());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.expBottle, new DispenserBehaviorExperience());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.potion, new DispenserBehaviorPotion());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.monsterPlacer, new DispenserBehaviorMobEgg());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.firework, new DispenserBehaviorFireworks());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.fireballCharge, new DispenserBehaviorFireball());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.boat, new DispenserBehaviorBoat());
    DispenserBehaviorFilledBucket dispenserbehaviorfilledbucket = new DispenserBehaviorFilledBucket();
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketLava, dispenserbehaviorfilledbucket);
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketWater, dispenserbehaviorfilledbucket);
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketEmpty, new DispenserBehaviorEmptyBucket());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.flintAndSteel, new DispenserBehaviorFire());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.dyePowder, new DispenserBehaviorDye());
    BlockDispenser.dispenseBehaviorRegistry.putObject(Item.itemsList[Block.tnt.blockID], new DispenserBehaviorTNT());
}
项目:RuneCraftery    文件:DispenserBehaviorFireball.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    IPosition iposition = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
    double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
    World world = par1IBlockSource.getWorld();
    Random random = world.rand;
    double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
    double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
    double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
    world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
项目:RuneCraftery    文件:DispenserBehaviorMobEgg.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
    double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
    double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
    Entity entity = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), d0, d1, d2);

    if (entity instanceof EntityLivingBase && par2ItemStack.hasDisplayName())
    {
        ((EntityLiving)entity).setCustomNameTag(par2ItemStack.getDisplayName());
    }

    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
项目:RuneCraftery    文件:DispenserBehaviorFilledBucket.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    ItemBucket itembucket = (ItemBucket)par2ItemStack.getItem();
    int i = par1IBlockSource.getXInt();
    int j = par1IBlockSource.getYInt();
    int k = par1IBlockSource.getZInt();
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());

    if (itembucket.tryPlaceContainedLiquid(par1IBlockSource.getWorld(), i + enumfacing.getFrontOffsetX(), j + enumfacing.getFrontOffsetY(), k + enumfacing.getFrontOffsetZ()))
    {
        par2ItemStack.itemID = Item.bucketEmpty.itemID;
        par2ItemStack.stackSize = 1;
        return par2ItemStack;
    }
    else
    {
        return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack);
    }
}
项目:Bewitchment    文件:ItemSpellPage.java   
public ItemSpellPage(String id) {
    super(id);
    this.setMaxStackSize(1);
    this.setHasSubtypes(true);

    BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, new IBehaviorDispenseItem() {

        @Override
        public ItemStack dispense(IBlockSource source, ItemStack stack) {
            Spell s = ItemSpellPage.getSpellFromItemStack(stack);
            if (s != null) {
                EnumFacing enumfacing = source.getBlockState().getValue(BlockDispenser.FACING);
                Vec3d lookVect = new Vec3d(enumfacing.getDirectionVec());
                if (s.canBeUsed(source.getWorld(), source.getBlockPos().offset(enumfacing), null)) {
                    if (s.getType() == EnumSpellType.INSTANT)
                        s.performEffect(new RayTraceResult(Type.MISS, lookVect, EnumFacing.UP, source.getBlockPos()), null, source.getWorld());
                    else {
                        EntitySpellCarrier car = new EntitySpellCarrier(source.getWorld(), source.getBlockPos().getX() + 1.5 * lookVect.x + 0.5, source.getBlockPos().getY() + 0.5d + lookVect.y, source.getBlockPos().getZ() + 1.5 * lookVect.z + 0.5);
                        car.setSpell(s);
                        car.setCaster(null);
                        car.shoot(car, 0, enumfacing.getHorizontalAngle(), 0, 1f, 0);
                        source.getWorld().spawnEntity(car);
                    }
                    return ItemStack.EMPTY;
                }
            }
            return stack;
        }
    });

}
项目:DecompiledMinecraft    文件:ItemArmor.java   
public ItemArmor(ItemArmor.ArmorMaterial material, int renderIndex, int armorType)
{
    this.material = material;
    this.armorType = armorType;
    this.renderIndex = renderIndex;
    this.damageReduceAmount = material.getDamageReductionAmount(armorType);
    this.setMaxDamage(material.getDurability(armorType));
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabCombat);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
项目:DecompiledMinecraft    文件:ItemMinecart.java   
public ItemMinecart(EntityMinecart.EnumMinecartType type)
{
    this.maxStackSize = 1;
    this.minecartType = type;
    this.setCreativeTab(CreativeTabs.tabTransport);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior);
}
项目:DecompiledMinecraft    文件:BehaviorProjectileDispense.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
项目:DecompiledMinecraft    文件:BehaviorDefaultDispenseItem.java   
/**
 * Dispenses the specified ItemStack from a dispenser.
 */
public final ItemStack dispense(IBlockSource source, ItemStack stack)
{
    ItemStack itemstack = this.dispenseStack(source, stack);
    this.playDispenseSound(source);
    this.spawnDispenseParticles(source, BlockDispenser.getFacing(source.getBlockMetadata()));
    return itemstack;
}
项目:DecompiledMinecraft    文件:BehaviorDefaultDispenseItem.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack = stack.splitStack(1);
    doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
    return stack;
}
项目:DecompiledMinecraft    文件:ItemArmor.java   
public ItemArmor(ItemArmor.ArmorMaterial material, int renderIndex, int armorType)
{
    this.material = material;
    this.armorType = armorType;
    this.renderIndex = renderIndex;
    this.damageReduceAmount = material.getDamageReductionAmount(armorType);
    this.setMaxDamage(material.getDurability(armorType));
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabCombat);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
项目:DecompiledMinecraft    文件:ItemMinecart.java   
public ItemMinecart(EntityMinecart.EnumMinecartType type)
{
    this.maxStackSize = 1;
    this.minecartType = type;
    this.setCreativeTab(CreativeTabs.tabTransport);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior);
}
项目:DecompiledMinecraft    文件:BehaviorProjectileDispense.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
项目:DecompiledMinecraft    文件:BehaviorDefaultDispenseItem.java   
/**
 * Dispenses the specified ItemStack from a dispenser.
 */
public final ItemStack dispense(IBlockSource source, ItemStack stack)
{
    ItemStack itemstack = this.dispenseStack(source, stack);
    this.playDispenseSound(source);
    this.spawnDispenseParticles(source, BlockDispenser.getFacing(source.getBlockMetadata()));
    return itemstack;
}
项目:DecompiledMinecraft    文件:BehaviorDefaultDispenseItem.java   
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack = stack.splitStack(1);
    doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition);
    return stack;
}
项目:BaseClient    文件:ItemArmor.java   
public ItemArmor(ItemArmor.ArmorMaterial material, int renderIndex, int armorType)
{
    this.material = material;
    this.armorType = armorType;
    this.renderIndex = renderIndex;
    this.damageReduceAmount = material.getDamageReductionAmount(armorType);
    this.setMaxDamage(material.getDurability(armorType));
    this.maxStackSize = 1;
    this.setCreativeTab(CreativeTabs.tabCombat);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
项目:BaseClient    文件:ItemMinecart.java   
public ItemMinecart(EntityMinecart.EnumMinecartType type)
{
    this.maxStackSize = 1;
    this.minecartType = type;
    this.setCreativeTab(CreativeTabs.tabTransport);
    BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior);
}