Advertisement
Guest User

Example GuiHandler

a guest
Jul 1st, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. package iitest.gui;
  2.  
  3. import iitest.capability.ITest;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.world.World;
  6. import net.minecraftforge.fml.common.network.IGuiHandler;
  7.  
  8. import javax.annotation.Nullable;
  9.  
  10. public class TestHandler implements IGuiHandler {
  11.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  12.         // I am aware this code makes a few potentially incorrect assumptions.
  13.         return new TestContainer(player.getHeldItemMainhand().getCapability(ITest.instance, null), player);
  14.     }
  15.  
  16.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  17.         return new TestGui(player.getHeldItemMainhand().getCapability(ITest.instance, null), player);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement