protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { EnumFacing var3 = BlockDispenser.getFacing(source.getBlockMetadata()); IPosition var4 = BlockDispenser.getDispensePosition(source); ItemStack var5 = stack.splitStack(1); doDispense(source.getWorld(), var5, 6, var3, var4); return stack; }
/** Dispense the specified stack, play the dispense sound and spawn particles. */ public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); World world = par1IBlockSource.getWorld(); double d0 = par1IBlockSource.getX() + (double) ((float) enumfacing.getFrontOffsetX() * 1.125F); double d1 = par1IBlockSource.getY() + (double) ((float) enumfacing.getFrontOffsetY() * 1.125F); double d2 = par1IBlockSource.getZ() + (double) ((float) enumfacing.getFrontOffsetZ() * 1.125F); int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); Material material = world.getBlockMaterial(i, j, k); double d3; if (Material.water.equals(material)) { d3 = 1.0D; } else { if (!Material.air.equals(material) || !Material.water.equals(world.getBlockMaterial(i, j - 1, k))) { return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack); } d3 = 0.0D; } EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); world.spawnEntityInWorld(entityboat); par2ItemStack.splitStack(1); return par2ItemStack; }
public ItemStack dispenseStack(IBlockSource BlockSource, ItemStack stack) { EnumFacing enumfacing = BlockDispenser.getFacing(BlockSource.getBlockMetadata()); double d0 = BlockSource.getX() + (double) enumfacing.getFrontOffsetX(); double d1 = BlockSource.getY() + (double) enumfacing.getFrontOffsetY(); double d2 = BlockSource.getZ() + (double) enumfacing.getFrontOffsetZ(); Entity entity = ItemGaiaSpawnEgg.spawnCreature(BlockSource.getWorld(), stack.getItemDamage(), d0, d1, d2); if (entity instanceof EntityLivingBase && stack.hasDisplayName()) { ((EntityLiving) entity).setCustomNameTag(stack.getDisplayName()); } stack.splitStack(1); return stack; }
/** Dispense the specified stack, play the dispense sound and spawn particles. */ protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); World world = par1IBlockSource.getWorld(); int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); EntityTNTPrimed entitytntprimed = new EntityTNTPrimed( world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), (EntityLivingBase) null); world.spawnEntityInWorld(entitytntprimed); --par2ItemStack.stackSize; return par2ItemStack; }
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); int i = blockpos.getX(); int j = blockpos.getY(); int k = blockpos.getZ(); AxisAlignedBB axisalignedbb = new AxisAlignedBB( (double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); List<EntityLivingBase> list = source .getWorld() .<EntityLivingBase>getEntitiesWithinAABB( EntityLivingBase.class, axisalignedbb, Predicates.<EntityLivingBase>and( EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack))); if (list.size() > 0) { EntityLivingBase entitylivingbase = (EntityLivingBase) list.get(0); int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; int i1 = EntityLiving.getArmorPosition(stack); ItemStack itemstack = stack.copy(); itemstack.stackSize = 1; entitylivingbase.setCurrentItemOrArmor(i1 - l, itemstack); if (entitylivingbase instanceof EntityLiving) { ((EntityLiving) entitylivingbase).setEquipmentDropChance(i1, 2.0F); } --stack.stackSize; return stack; } else { return super.dispenseStack(source, stack); } }
public final ItemStack dispense(IBlockSource source, ItemStack stack) { ItemStack var3 = this.dispenseStack(source, stack); this.playDispenseSound(source); this.spawnDispenseParticles(source, BlockDispenser.getFacing(source.getBlockMetadata())); return var3; }