Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2016 10:22
Show Gist options
  • Save anonymous/84ec07e27abbc9a45da9 to your computer and use it in GitHub Desktop.
Save anonymous/84ec07e27abbc9a45da9 to your computer and use it in GitHub Desktop.
Handler
package com.ae.GUI;
import com.ae.TileEntities.ChargerTE;
import com.ae.TileEntities.BaseClasses.EnergyChargerTE;
import com.ae.main.AdvancedElectronics;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
TileEntity te = world.getTileEntity(pos);
if(ID == AdvancedElectronics.ChargerGUIID){
return new ContainerCharger(player.inventory, (ChargerTE)te);
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
TileEntity te = world.getTileEntity(pos);
if(ID == AdvancedElectronics.ChargerGUIID){
return new GuiCharger(player.inventory, (ChargerTE)te);
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment