Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Sebenf0rce

Members
  • Posts

    2
  • Joined

  • Last visited

Sebenf0rce's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I tried with EnumActionResult.Success but the result is the same. Because i tried to open gui of the tileEntity that i clicked. In this case is a chest.
  2. Hi, I have a problem when i want to open my gui when i right click with my item. I want to open a gui would show the item in a chest without inventory and without possibility to take items. I have my item class with onItemUse method : @Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote) { TileEntity tile = world.getTileEntity(pos); System.out.println(tile); //renvoie toujours null if (tile == null) { return EnumActionResult.PASS; } if(tile instanceof TileEntityChest) { System.out.println("on lance le gui"); player.openGui(Main.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); return EnumActionResult.FAIL; } } return EnumActionResult.PASS; } I have my guiHandler class : public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case 0: System.out.println(" création container chest explorer"); return new ContainerChestExplorer(world.getTileEntity(new BlockPos(x, y, z))); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch (ID) { case 0: System.out.println(" création gui chest explorer"); return new GuiChestExplorer(world.getTileEntity(new BlockPos(x, y, z))); } return null; } } And the class of the gui : public class GuiChestExplorer extends GuiContainer { TileEntity tile; ResourceLocation bg = new ResourceLocation("sebenforcemod:textures/gui/chestexplorer.png"); public GuiChestExplorer(TileEntity te) { super(new ContainerChestExplorer(te)); System.out.println("constructeur gui"); this.xSize = 256; this.ySize = 177; } protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { this.mc.renderEngine.bindTexture(this.bg); System.out.println("draw gui"); drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; drawTexturedModalRect(x, y, 0, 0, 256, 256); } } But my gui isn't display. The normal gui of chest is opened.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.