private void handle(OpenBagMessage message, MessageContext ctx) { // This code is run on the server side. So you can do server-side calculations here EntityPlayerMP player = ctx.getServerHandler().playerEntity; if (BagFinder.getBag(player) == null) return; BagTypes type = ((Bag) BagFinder.getBag(player).getItem()).getType(); if (type == BagTypes.TIER1) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK, player.world, 0, 0, 0); if (type == BagTypes.TIER2) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_T2, player.world, 0, 0, 0); if (type == BagTypes.TIER3) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_T3, player.world, 0, 0, 0); if (type == BagTypes.VOID) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_VOID, player.world, 0, 0, 0); if(type == BagTypes.ENDER) { InventoryEnderChest inventoryEnderChest = player.getInventoryEnderChest(); player.displayGUIChest(inventoryEnderChest); } }
public boolean func_71903_a(World p_71903_1_, int p_71903_2_, int p_71903_3_, int p_71903_4_, EntityPlayer p_71903_5_, int p_71903_6_, float p_71903_7_, float p_71903_8_, float p_71903_9_) { InventoryEnderChest var10 = p_71903_5_.func_71005_bN(); TileEntityEnderChest var11 = (TileEntityEnderChest)p_71903_1_.func_72796_p(p_71903_2_, p_71903_3_, p_71903_4_); if(var10 != null && var11 != null) { if(p_71903_1_.func_72809_s(p_71903_2_, p_71903_3_ + 1, p_71903_4_)) { return true; } else if(p_71903_1_.field_72995_K) { return true; } else { var10.func_70485_a(var11); p_71903_5_.func_71007_a(var10); return true; } } else { return true; } }
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { InventoryEnderChest inventoryenderchest = playerIn.getInventoryEnderChest(); TileEntity tileentity = worldIn.getTileEntity(pos); if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) { if (worldIn.getBlockState(pos.up()).getBlock().isNormalCube()) { return true; } else if (worldIn.isRemote) { return true; } else { inventoryenderchest.setChestTileEntity((TileEntityEnderChest)tileentity); playerIn.displayGUIChest(inventoryenderchest); playerIn.triggerAchievement(StatList.field_181738_V); return true; } } else { return true; } }
@Override public InventoryEnderChest getInventoryEnderChest() { if (m_realPlayer == null) { return super.getInventoryEnderChest(); } else { syncToRealPlayer(); return syncPublicFieldsFromRealAndReturn(m_realPlayer.getInventoryEnderChest()); } }
@Override public InventoryEnderChest getInventoryEnderChest() { if (m_realPlayer == null) { return super.getInventoryEnderChest(); } else { return m_realPlayer.getInventoryEnderChest(); } }
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) { InventoryEnderChest inventoryenderchest = playerIn.getInventoryEnderChest(); TileEntity tileentity = worldIn.getTileEntity(pos); if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) { if (worldIn.getBlockState(pos.up()).isNormalCube()) { return true; } else if (worldIn.isRemote) { return true; } else { inventoryenderchest.setChestTileEntity((TileEntityEnderChest)tileentity); playerIn.displayGUIChest(inventoryenderchest); playerIn.addStat(StatList.ENDERCHEST_OPENED); return true; } } else { 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) { InventoryEnderChest inventoryenderchest = playerIn.getInventoryEnderChest(); TileEntity tileentity = worldIn.getTileEntity(pos); if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) { if (worldIn.getBlockState(pos.up()).isNormalCube()) { return true; } else if (worldIn.isRemote) { return true; } else { inventoryenderchest.setChestTileEntity((TileEntityEnderChest)tileentity); playerIn.displayGUIChest(inventoryenderchest); playerIn.addStat(StatList.ENDERCHEST_OPENED); return true; } } else { return true; } }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, player, hand))) return true; InventoryEnderChest chest = player.getInventoryEnderChest(); if(!getEntityWorld().isRemote && chest !=null){ player.displayGUIChest(chest); return true; } return true; }
@Override public void getEnderchest() { InventoryEnderChest mEnderchest = mc.getIntegratedServer().worldServerForDimension(mc.thePlayer.dimension).getPlayerEntityByName(mc.thePlayer.getCommandSenderEntity().getName()).getInventoryEnderChest(); ItemStack item; for (int i=0; i<mEnderchest.getSizeInventory(); i++) { item = mEnderchest.getStackInSlot(i); if (item != null) { mManager.sendEnderchestItem(item.getDisplayName(), item.stackSize); } } }
@Override public boolean interactFirst(EntityPlayer player) { InventoryEnderChest inventoryenderchest = player.getInventoryEnderChest(); if (!this.worldObj.isRemote && !player.isSneaking()) { player.displayGUIChest(inventoryenderchest); } 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_) { InventoryEnderChest var10 = p_149727_5_.getInventoryEnderChest(); TileEntityEnderChest var11 = (TileEntityEnderChest)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (var10 != null && var11 != null) { if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_ + 1, p_149727_4_).isNormalCube()) { return true; } else if (p_149727_1_.isClient) { return true; } else { var10.func_146031_a(var11); p_149727_5_.displayGUIChest(var10); return true; } } else { return true; } }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack itemStack = player.getHeldItem(EnumHand.MAIN_HAND); if (player.isSneaking()) { changeMode(itemStack, world, player, hand); return new ActionResult(EnumActionResult.SUCCESS, itemStack); } if (!world.isRemote) { if (!ItemHelper.hasOwnerUUID(itemStack)) { ItemHelper.setOwner(itemStack, player); } NBTHelper.setUUID(itemStack); NBTHelper.setBoolean(itemStack, Names.NBT.BAG_OPEN, true); if (type == BagTypes.TIER1) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK, world, 0, 0, 0); if (type == BagTypes.TIER2) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_T2, world, 0, 0, 0); if (type == BagTypes.TIER3) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_T3, world, 0, 0, 0); if (type == BagTypes.VOID) player.openGui(Bagginses.instance, GuiInfo.GUI_BACKPACK_VOID, world, 0, 0, 0); if(type == BagTypes.ENDER) { InventoryEnderChest inventoryEnderChest = player.getInventoryEnderChest(); player.displayGUIChest(inventoryEnderChest); } } return new ActionResult(EnumActionResult.SUCCESS, itemStack); }
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_) { InventoryEnderChest inventoryenderchest = p_149727_5_.getInventoryEnderChest(); TileEntityEnderChest tileentityenderchest = (TileEntityEnderChest)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (inventoryenderchest != null && tileentityenderchest != null) { if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_ + 1, p_149727_4_).isNormalCube()) { return true; } else if (p_149727_1_.isRemote) { return true; } else { inventoryenderchest.func_146031_a(tileentityenderchest); p_149727_5_.displayGUIChest(inventoryenderchest); return true; } } else { return true; } }
/** * 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) { InventoryEnderChest inventoryenderchest = par5EntityPlayer.getInventoryEnderChest(); TileEntityEnderChest tileentityenderchest = (TileEntityEnderChest)par1World.getBlockTileEntity(par2, par3, par4); if (inventoryenderchest != null && tileentityenderchest != null) { if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) { return true; } else if (par1World.isRemote) { return true; } else { inventoryenderchest.setAssociatedChest(tileentityenderchest); par5EntityPlayer.displayGUIChest(inventoryenderchest); return true; } } else { return true; } }
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) { InventoryEnderChest inventoryenderchest = entityPlayer .getInventoryEnderChest(); if (!world.isRemote) { entityPlayer.displayGUIChest(inventoryenderchest); world.playSoundAtEntity(entityPlayer, "random.chestopen", 0.5F, 0.85F); } return itemStack; }
/** * Returns the InventoryEnderChest of this player. */ public InventoryEnderChest getInventoryEnderChest() { return this.theInventoryEnderChest; }
public InventoryEnderChest getInventoryEnderChest() { return this.theInventoryEnderChest; }
@Override public InventoryEnderChest getInventoryEnderChest() { // not relevant return super.getInventoryEnderChest(); }
@Override public InventoryEnderChest getInventoryEnderChest() { return this.getEntityPlayer().getInventoryEnderChest(); }
public InventoryEnderChest getEnderChest() { return this.theInventoryEnderChest; }
public InventoryEnderChest func_71005_bN() { return this.field_71078_a; }