Files
Electro-Magic-Tools/src/main/java/emt/proxy/CommonProxy.java
T

77 lines
2.7 KiB
Java
Raw Normal View History

2016-03-16 17:49:28 +03:00
package emt.proxy;
2014-03-29 12:13:50 +01:00
import cpw.mods.fml.common.network.IGuiHandler;
2016-03-16 17:49:28 +03:00
import emt.client.gui.GuiEtherealMacerator;
2018-02-21 14:12:11 +01:00
import emt.client.gui.GuiGenerator;
2016-03-16 17:49:28 +03:00
import emt.client.gui.GuiIndustrialWandRecharger;
2018-03-02 17:33:19 +01:00
import emt.client.gui.GuiSolar;
2018-02-21 14:12:11 +01:00
import emt.client.gui.container.ConainerGenerator;
2016-03-16 17:49:28 +03:00
import emt.client.gui.container.ContainerEtheralMacerator;
import emt.client.gui.container.ContainerIndustrialWandRecharge;
2018-03-02 17:33:19 +01:00
import emt.client.gui.container.ContainerSolars;
2016-03-16 17:49:28 +03:00
import emt.tile.TileEntityEtherealMacerator;
import emt.tile.TileEntityIndustrialWandRecharge;
2018-02-21 14:12:11 +01:00
import emt.tile.generator.TileEntityBaseGenerator;
2018-03-02 17:33:19 +01:00
import emt.tile.solar.TileEntitySolarBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
2014-03-29 12:13:50 +01:00
2014-04-17 22:27:40 +02:00
public class CommonProxy implements IGuiHandler {
2014-03-29 12:13:50 +01:00
2015-12-06 19:47:41 +03:00
public void load() {
registerRenders();
}
public void registerRenders() {
/* Empty in base proxy */
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
2016-04-05 13:41:09 +03:00
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new ContainerIndustrialWandRecharge(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new ContainerEtheralMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
2018-02-21 14:12:11 +01:00
else if (entity != null && entity instanceof TileEntityBaseGenerator) {
return new ConainerGenerator(player.inventory, (TileEntityBaseGenerator) entity);
}
2018-03-02 17:33:19 +01:00
else if (entity != null && entity instanceof TileEntitySolarBase) {
return new ContainerSolars(player.inventory, (TileEntitySolarBase) entity);
}
2016-04-05 13:41:09 +03:00
default:
return null;
2015-12-06 19:47:41 +03:00
}
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
2016-04-05 13:41:09 +03:00
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new GuiIndustrialWandRecharger(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new GuiEtherealMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
2018-02-21 14:12:11 +01:00
else if (entity != null && entity instanceof TileEntityBaseGenerator) {
return new GuiGenerator(player.inventory, (TileEntityBaseGenerator) entity);
}
2018-03-02 17:33:19 +01:00
else if (entity != null && entity instanceof TileEntitySolarBase) {
return new GuiSolar(player.inventory, (TileEntitySolarBase) entity);
}
2016-04-05 13:41:09 +03:00
default:
return null;
2015-12-06 19:47:41 +03:00
}
}
2014-03-29 12:13:50 +01:00
}