public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { playerIn.displayGUIChest((TileEntityBrewingStand)tileentity); playerIn.triggerAchievement(StatList.field_181729_M); } return true; } }
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { playerIn.displayGUIChest((TileEntityBrewingStand)tileentity); playerIn.addStat(StatList.BREWINGSTAND_INTERACTION); } return true; } }
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { playerIn.displayGUIChest((TileEntityBrewingStand)tileentity); playerIn.addStat(StatList.BREWINGSTAND_INTERACTION); } return true; } }
/** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isClient) { return true; } else { TileEntityBrewingStand var10 = (TileEntityBrewingStand)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (var10 != null) { p_149727_5_.func_146098_a(var10); } return true; } }
public ContainerBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand) { this.tileBrewingStand = par2TileEntityBrewingStand; this.addSlotToContainer(new ContainerBrewingStand.Potion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 0, 56, 46)); this.addSlotToContainer(new ContainerBrewingStand.Potion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 1, 79, 53)); this.addSlotToContainer(new ContainerBrewingStand.Potion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 2, 102, 46)); this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(par2TileEntityBrewingStand, 3, 79, 17)); int var3; for (var3 = 0; var3 < 3; ++var3) { for (int var4 = 0; var4 < 9; ++var4) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); } } for (var3 = 0; var3 < 9; ++var3) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); } }
public void func_146098_a(TileEntityBrewingStand p_146098_1_) { // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, p_146098_1_)); if (container == null) { p_146098_1_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients return; } // CraftBukkit end this.getNextWindowId(); this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 5, p_146098_1_.getInventoryName(), p_146098_1_.getSizeInventory(), p_146098_1_.hasCustomInventoryName())); this.openContainer = container; // CraftBukkit - Use container we passed to event this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); }
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (tileentitybrewingstand != null) { p_149727_5_.func_146098_a(tileentitybrewingstand); } return true; } }
public ContainerBrewingStand(InventoryPlayer p_i1805_1_, TileEntityBrewingStand p_i1805_2_) { this.player = p_i1805_1_; // CraftBukkit this.tileBrewingStand = p_i1805_2_; this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 0, 56, 46)); this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 1, 79, 53)); this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 2, 102, 46)); this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(p_i1805_2_, 3, 79, 17)); int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(p_i1805_1_, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(p_i1805_1_, i, 8 + i * 18, 142)); } }
public ContainerBrewingStand(InventoryPlayer p_i1805_1_, TileEntityBrewingStand p_i1805_2_) { this.tileBrewingStand = p_i1805_2_; this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 0, 56, 46)); this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 1, 79, 53)); this.addSlotToContainer(new ContainerBrewingStand.Potion(p_i1805_1_.player, p_i1805_2_, 2, 102, 46)); this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(p_i1805_2_, 3, 79, 17)); int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(p_i1805_1_, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(p_i1805_1_, i, 8 + i * 18, 142)); } }
public ContainerBrewingStand(InventoryPlayer p_i1805_1_, TileEntityBrewingStand p_i1805_2_) { this.field_75188_e = p_i1805_2_; this.func_75146_a(new SlotBrewingStandPotion(p_i1805_1_.field_70458_d, p_i1805_2_, 0, 56, 46)); this.func_75146_a(new SlotBrewingStandPotion(p_i1805_1_.field_70458_d, p_i1805_2_, 1, 79, 53)); this.func_75146_a(new SlotBrewingStandPotion(p_i1805_1_.field_70458_d, p_i1805_2_, 2, 102, 46)); this.field_75186_f = this.func_75146_a(new SlotBrewingStandIngredient(this, p_i1805_2_, 3, 79, 17)); int var3; for(var3 = 0; var3 < 3; ++var3) { for(int var4 = 0; var4 < 9; ++var4) { this.func_75146_a(new Slot(p_i1805_1_, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); } } for(var3 = 0; var3 < 9; ++var3) { this.func_75146_a(new Slot(p_i1805_1_, var3, 8 + var3 * 18, 142)); } }
/** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand)par1World.getBlockTileEntity(par2, par3, par4); if (tileentitybrewingstand != null) { par5EntityPlayer.displayGUIBrewingStand(tileentitybrewingstand); } return true; } }
public ContainerBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand) { this.tileBrewingStand = par2TileEntityBrewingStand; this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 0, 56, 46)); this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 1, 79, 53)); this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 2, 102, 46)); this.theSlot = this.addSlotToContainer(new SlotBrewingStandIngredient(this, par2TileEntityBrewingStand, 3, 79, 17)); int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } }
/** * Significantly (twice as much per 3 brewing stands) increase the growth rate when there brewing stands that are currently brewing around the plant. */ @Override protected float getGrowthRate(World world, int x, int y, int z){ int brewingBrewingStands = 0; for(int i = x - SQUARE_RADIUS; i <= x + SQUARE_RADIUS; i++) { for(int j = y - MAX_HEIGHT_DIFF; j <= y + MAX_HEIGHT_DIFF; j++) { for(int k = z - SQUARE_RADIUS; k <= z + SQUARE_RADIUS; k++) { if(world.getBlock(i, j, k) == Blocks.brewing_stand && world.getTileEntity(i, j, k) instanceof TileEntityBrewingStand) { TileEntityBrewingStand brewingStand = (TileEntityBrewingStand)world.getTileEntity(i, j, k); if(brewingStand.getBrewTime() > 0) brewingBrewingStands++; } } } } return super.getGrowthRate(world, x, y, z) * (1 + brewingBrewingStands * 0.333F); }
/** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { ((TileEntityBrewingStand)tileentity).setName(stack.getDisplayName()); } } }
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand)tileentity); } super.breakBlock(worldIn, pos, state); }
@Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) return true; else { TileEntityBrewingStand tile = (TileEntityBrewingStand) world.getTileEntity(x, y, z); if (tile != null) player.openGui(EtFuturum.instance, GUIsID.BREWING_STAND, world, x, y, z); return true; } }
@Override public boolean canAdvance(World world, BlockPos pos, IBlockState state) { Iterable<BlockPos> poslist = BlockPos.getAllInBox(pos.add(-range, -2, -range), pos.add(range, 2, range)); Iterator iter = poslist.iterator(); while (iter.hasNext()) { BlockPos posit = (BlockPos)iter.next(); TileEntity tile = world.getTileEntity(posit); if (tile != null && tile instanceof TileEntityBrewingStand) { return ((TileEntityBrewingStand)tile).getField(0) > 0; } } return false; }
/** * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated */ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand)tileentity); } super.breakBlock(worldIn, pos, state); }
public void func_146098_a(TileEntityBrewingStand p_146098_1_) { this.getNextWindowId(); this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 5, p_146098_1_.getInventoryName(), p_146098_1_.getSizeInventory(), p_146098_1_.isInventoryNameLocalized())); this.openContainer = new ContainerBrewingStand(this.inventory, p_146098_1_); this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); }
/** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { if (p_149689_6_.hasDisplayName()) { ((TileEntityBrewingStand)p_149689_1_.getTileEntity(p_149689_2_, p_149689_3_, p_149689_4_)).func_145937_a(p_149689_6_.getDisplayName()); } }
@Override protected ChunkCoordinates getTargetCoordinates(World world, int x, int y, int z, ItemStack stack) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityBrewingStand || tile instanceof TileEntityFurnace) { stack.setItemDamage(1); return new ChunkCoordinates(x, y, z); }else if(tile instanceof IInventory){ if(((IInventory) tile).getSizeInventory() > 0) { stack.setItemDamage(0); return new ChunkCoordinates(x, y, z); } } return null; }