SMP support: v2.1
This commit is contained in:
parent
c975ff3ab1
commit
44387c0324
|
@ -13,7 +13,7 @@
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<property name="modname" value="mod_ironchests" />
|
<property name="modname" value="mod_ironchests" />
|
||||||
<property name="version" value="2.0.1" />
|
<property name="version" value="2.1" />
|
||||||
<property name="mcp.home" location="/home/cpw/minecraft1dev/forge1.31" />
|
<property name="mcp.home" location="/home/cpw/minecraft1dev/forge1.31" />
|
||||||
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
||||||
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package cpw.mods.ironchest.client;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.src.BaseModMp;
|
||||||
|
import net.minecraft.src.ChestItemRenderHelper;
|
||||||
|
import net.minecraft.src.EntityItem;
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
import net.minecraft.src.GuiScreen;
|
||||||
|
import net.minecraft.src.ModLoader;
|
||||||
|
import net.minecraft.src.ModLoaderMp;
|
||||||
|
import net.minecraft.src.NBTTagCompound;
|
||||||
|
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||||
|
import cpw.mods.ironchest.IProxy;
|
||||||
|
import cpw.mods.ironchest.IronChestType;
|
||||||
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
|
public class ClientProxy extends BaseModMp implements IProxy {
|
||||||
|
@Override
|
||||||
|
public void registerRenderInformation() {
|
||||||
|
ChestItemRenderHelper.instance=new IronChestRenderHelper();
|
||||||
|
MinecraftForgeClient.preloadTexture("cpw/mods/ironchest/sprites/block_textures.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerTileEntities() {
|
||||||
|
for (IronChestType typ : IronChestType.values()) {
|
||||||
|
ModLoader.RegisterTileEntity(typ.clazz, typ.name(), new TileEntityIronChestRenderer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerTranslations() {
|
||||||
|
for (IronChestType typ : IronChestType.values()) {
|
||||||
|
ModLoader.AddLocalization(typ.name() + ".name", typ.friendlyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showGUI(TileEntityIronChest te, EntityPlayer player) {
|
||||||
|
GUIChest.GUI.showGUI(te, player);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getMinecraftDir() {
|
||||||
|
return Minecraft.getMinecraftDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyExtraDataToDrops(EntityItem entityitem, NBTTagCompound data) {
|
||||||
|
entityitem.item.setTagCompound(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerGUI(int guiId) {
|
||||||
|
ModLoaderMp.RegisterGUI(this, guiId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
// Do nothing, we never get loaded like that
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load() {
|
||||||
|
// Do Nothing, we never get loaded like that
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuiScreen HandleGUI(int i) {
|
||||||
|
for (IronChestType type: IronChestType.values()) {
|
||||||
|
if (type.guiId==i) {
|
||||||
|
return GUIChest.GUI.buildGUI(type,ModLoader.getMinecraftInstance().thePlayer.inventory,IronChestType.makeEntity(type.ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,16 +36,23 @@ public class GUIChest extends GuiContainer {
|
||||||
return new ContainerIronChestBase(player,chest, mainType, xSize, ySize);
|
return new ContainerIronChestBase(player,chest, mainType, xSize, ySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showGUI(TileEntityIronChest te, EntityPlayer player) {
|
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory) {
|
||||||
for (GUI gui : values()) {
|
for (GUI gui : values()) {
|
||||||
if (te.getType()==gui.mainType) {
|
if (chestInventory.getType()==gui.mainType) {
|
||||||
ModLoader.OpenGUI(player, new GUIChest(gui,player.inventory,te));
|
return new GUIChest(gui,playerInventory,chestInventory);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static void showGUI(TileEntityIronChest te, EntityPlayer player) {
|
||||||
|
GUIChest gui=buildGUI(te.getType(),player.inventory,te);
|
||||||
|
if (gui!=null) {
|
||||||
|
ModLoader.OpenGUI(player, gui);
|
||||||
|
} else {
|
||||||
player.displayGUIChest(te);
|
player.displayGUIChest(te);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getRowLength() {
|
public int getRowLength() {
|
||||||
return type.mainType.getRowLength();
|
return type.mainType.getRowLength();
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||||
if (itemstack.hasTagCompound())
|
if (itemstack.hasTagCompound())
|
||||||
{
|
{
|
||||||
entityitem.item.setTagCompound((NBTTagCompound)itemstack.getTagCompound().cloneTag());
|
mod_IronChest.proxy.applyExtraDataToDrops(entityitem, (NBTTagCompound)itemstack.getTagCompound().cloneTag());
|
||||||
}
|
}
|
||||||
world.spawnEntityInWorld(entityitem);
|
world.spawnEntityInWorld(entityitem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.src.EntityItem;
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
import net.minecraft.src.NBTTagCompound;
|
||||||
|
|
||||||
|
public interface IProxy {
|
||||||
|
|
||||||
|
public abstract void registerRenderInformation();
|
||||||
|
|
||||||
|
public abstract void registerTileEntities();
|
||||||
|
|
||||||
|
public abstract void registerTranslations();
|
||||||
|
|
||||||
|
public abstract void showGUI(TileEntityIronChest te, EntityPlayer player);
|
||||||
|
|
||||||
|
public abstract File getMinecraftDir();
|
||||||
|
|
||||||
|
public abstract void applyExtraDataToDrops(EntityItem item, NBTTagCompound data);
|
||||||
|
|
||||||
|
public abstract void registerGUI(int guiId);
|
||||||
|
|
||||||
|
}
|
|
@ -4,27 +4,26 @@ import net.minecraft.src.Block;
|
||||||
import net.minecraft.src.Item;
|
import net.minecraft.src.Item;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.mod_IronChest;
|
||||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
|
||||||
import net.minecraft.src.forge.Configuration;
|
import net.minecraft.src.forge.Configuration;
|
||||||
|
|
||||||
public enum IronChestType {
|
public enum IronChestType {
|
||||||
IRON(54, 9, true, "Iron Chest", null, "ironchest.png", 0, Item.ingotIron, TileEntityIronChest.class, "mmmmPmmmm","mGmG3GmGm"),
|
IRON(54, 9, true, "Iron Chest", "guiIronChest", "ironchest.png", 0, Item.ingotIron, TileEntityIronChest.class, "mmmmPmmmm","mGmG3GmGm"),
|
||||||
GOLD(81, 9, true, "Gold Chest", "guiGoldChest", "goldchest.png", 1, Item.ingotGold, TileEntityGoldChest.class, "mmmmPmmmm","mGmG4GmGm"),
|
GOLD(81, 9, true, "Gold Chest", "guiGoldChest", "goldchest.png", 1, Item.ingotGold, TileEntityGoldChest.class, "mmmmPmmmm","mGmG4GmGm"),
|
||||||
DIAMOND(108, 12, true, "Diamond Chest", "guiDiamondChest", "diamondchest.png", 2, Item.diamond, TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
DIAMOND(108, 12, true, "Diamond Chest", "guiDiamondChest", "diamondchest.png", 2, Item.diamond, TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
||||||
COPPER(45, 9, false, "Copper Chest", "guiCopperChest", "copperchest.png", 3, null, TileEntityCopperChest.class, "mmmmCmmmm"),
|
COPPER(45, 9, false, "Copper Chest", "guiCopperChest", "copperchest.png", 3, null, TileEntityCopperChest.class, "mmmmCmmmm"),
|
||||||
SILVER(72, 9, false, "Silver Chest", "guiSilverChest", "silverchest.png", 4, null, TileEntitySilverChest.class, "mmmm0mmmm", "mmmm3mmmm");
|
SILVER(72, 9, false, "Silver Chest", "guiSilverChest", "silverchest.png", 4, null, TileEntitySilverChest.class, "mmmm0mmmm", "mmmm3mmmm");
|
||||||
int size;
|
int size;
|
||||||
private int rowLength;
|
private int rowLength;
|
||||||
String friendlyName;
|
public String friendlyName;
|
||||||
private boolean tieredChest;
|
private boolean tieredChest;
|
||||||
private String modelTexture;
|
private String modelTexture;
|
||||||
private String guiName;
|
private String guiName;
|
||||||
private int textureRow;
|
private int textureRow;
|
||||||
private Class<? extends TileEntityIronChest> clazz;
|
public Class<? extends TileEntityIronChest> clazz;
|
||||||
private Item mat;
|
private Item mat;
|
||||||
private String[] recipes;
|
private String[] recipes;
|
||||||
private int guiId;
|
public int guiId;
|
||||||
|
|
||||||
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String guiName, String modelTexture, int textureRow, Item mat,
|
IronChestType(int size, int rowLength, boolean tieredChest, String friendlyName, String guiName, String modelTexture, int textureRow, Item mat,
|
||||||
Class<? extends TileEntityIronChest> clazz, String... recipes) {
|
Class<? extends TileEntityIronChest> clazz, String... recipes) {
|
||||||
|
@ -48,7 +47,7 @@ public enum IronChestType {
|
||||||
return textureRow;
|
return textureRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileEntity makeEntity(int metadata) {
|
public static TileEntityIronChest makeEntity(int metadata) {
|
||||||
// Compatibility
|
// Compatibility
|
||||||
int chesttype = metadata;
|
int chesttype = metadata;
|
||||||
try {
|
try {
|
||||||
|
@ -64,28 +63,7 @@ public enum IronChestType {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerTileEntities(Class<? extends TileEntitySpecialRenderer> renderer) {
|
|
||||||
for (IronChestType typ : values()) {
|
|
||||||
try {
|
|
||||||
if (renderer != null) {
|
|
||||||
ModLoader.RegisterTileEntity(typ.clazz, typ.name(), renderer.newInstance());
|
|
||||||
} else {
|
|
||||||
ModLoader.RegisterTileEntity(typ.clazz, typ.name());
|
|
||||||
}
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
// unpossible
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
// unpossible
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerTranslations() {
|
public static void registerTranslations() {
|
||||||
for (IronChestType typ : values()) {
|
|
||||||
ModLoader.AddLocalization(typ.name() + ".name", typ.friendlyName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateTieredRecipies(BlockIronChest blockResult) {
|
public static void generateTieredRecipies(BlockIronChest blockResult) {
|
||||||
|
@ -120,6 +98,7 @@ public enum IronChestType {
|
||||||
for (IronChestType typ : values()) {
|
for (IronChestType typ : values()) {
|
||||||
if (typ.guiName != null) {
|
if (typ.guiName != null) {
|
||||||
typ.guiId = Integer.parseInt(cfg.getOrCreateIntProperty(typ.guiName, Configuration.GENERAL_PROPERTY, defGUI++).value);
|
typ.guiId = Integer.parseInt(cfg.getOrCreateIntProperty(typ.guiName, Configuration.GENERAL_PROPERTY, defGUI++).value);
|
||||||
|
mod_IronChest.proxy.registerGUI(typ.guiId);
|
||||||
} else {
|
} else {
|
||||||
typ.guiId = -1;
|
typ.guiId = -1;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +110,6 @@ public enum IronChestType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRowLength() {
|
public int getRowLength() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return rowLength;
|
return rowLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import net.minecraft.src.ModLoader;
|
||||||
|
|
||||||
|
public enum ServerClientProxy {
|
||||||
|
CLIENT("cpw.mods.ironchest.client.ClientProxy"),
|
||||||
|
SERVER("cpw.mods.ironchest.server.ServerProxy");
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
private ServerClientProxy(String proxyClassName) {
|
||||||
|
className=proxyClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IProxy buildProxy() {
|
||||||
|
try {
|
||||||
|
return (IProxy) Class.forName(className).newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
ModLoader.getLogger().severe("A fatal error has occured initializing IronChests");
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static IProxy getProxy() {
|
||||||
|
try {
|
||||||
|
ModLoader.class.getMethod("getMinecraftInstance");
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// UNPOSSIBLE
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
return SERVER.buildProxy();
|
||||||
|
}
|
||||||
|
return CLIENT.buildProxy();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -126,6 +126,9 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||||
|
if (worldObj==null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) {
|
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +140,7 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
// Resynchronize clients with the server state
|
// Resynchronize clients with the server state
|
||||||
if ((++ticksSinceSync % 20) * 4 == 0) {
|
if ((++ticksSinceSync % 20) * 4 == 0) {
|
||||||
worldObj.playNoteAt(xCoord, yCoord, zCoord, 1, numUsingPlayers);
|
worldObj.playNoteAt(xCoord, yCoord, zCoord, 3, ( ( numUsingPlayers<<3 ) & 0xF8 ) | (facing & 0x7));
|
||||||
}
|
}
|
||||||
prevLidAngle = lidAngle;
|
prevLidAngle = lidAngle;
|
||||||
float f = 0.1F;
|
float f = 0.1F;
|
||||||
|
@ -176,26 +179,28 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
numUsingPlayers = j;
|
numUsingPlayers = j;
|
||||||
} else if (i == 2) {
|
} else if (i == 2) {
|
||||||
facing = (byte)j;
|
facing = (byte)j;
|
||||||
|
} else if (i == 3) {
|
||||||
|
facing = (byte)(j & 0x7);
|
||||||
|
numUsingPlayers = (j & 0xF8 )>> 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openChest() {
|
public void openChest() {
|
||||||
|
if (worldObj==null) return;
|
||||||
numUsingPlayers++;
|
numUsingPlayers++;
|
||||||
worldObj.playNoteAt(xCoord, yCoord, zCoord, 1, numUsingPlayers);
|
worldObj.playNoteAt(xCoord, yCoord, zCoord, 1, numUsingPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeChest() {
|
public void closeChest() {
|
||||||
|
if (worldObj==null) return;
|
||||||
numUsingPlayers--;
|
numUsingPlayers--;
|
||||||
worldObj.playNoteAt(xCoord, yCoord, zCoord, 1, numUsingPlayers);
|
worldObj.playNoteAt(xCoord, yCoord, zCoord, 1, numUsingPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFacing(byte chestFacing) {
|
public void setFacing(byte chestFacing) {
|
||||||
this.facing=chestFacing;
|
this.facing=chestFacing;
|
||||||
if (worldObj!=null) {
|
|
||||||
worldObj.playNoteAt(xCoord, yCoord, zCoord, 2, facing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,32 +2,31 @@ package net.minecraft.src;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import cpw.mods.ironchest.BlockIronChest;
|
|
||||||
import cpw.mods.ironchest.IronChestType;
|
|
||||||
import cpw.mods.ironchest.ItemIronChest;
|
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
|
||||||
import cpw.mods.ironchest.client.GUIChest;
|
|
||||||
import cpw.mods.ironchest.client.IronChestRenderHelper;
|
|
||||||
import cpw.mods.ironchest.client.TileEntityIronChestRenderer;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.src.forge.Configuration;
|
import net.minecraft.src.forge.Configuration;
|
||||||
import net.minecraft.src.forge.IOreHandler;
|
import net.minecraft.src.forge.IOreHandler;
|
||||||
import net.minecraft.src.forge.MinecraftForge;
|
import net.minecraft.src.forge.MinecraftForge;
|
||||||
import net.minecraft.src.forge.MinecraftForgeClient;
|
import cpw.mods.ironchest.BlockIronChest;
|
||||||
|
import cpw.mods.ironchest.IProxy;
|
||||||
|
import cpw.mods.ironchest.IronChestType;
|
||||||
|
import cpw.mods.ironchest.ItemIronChest;
|
||||||
|
import cpw.mods.ironchest.ServerClientProxy;
|
||||||
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
public class mod_IronChest extends BaseModMp {
|
public class mod_IronChest extends BaseModMp {
|
||||||
|
|
||||||
public static BlockIronChest ironChestBlock;
|
public static BlockIronChest ironChestBlock;
|
||||||
public static boolean compatibilityMode;
|
public static IProxy proxy;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return "2.0.1";
|
return "2.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
File cfgFile = new File(Minecraft.getMinecraftDir(), "config/IronChest.cfg");
|
MinecraftForge.versionDetect("IronChest", 1, 3, 0);
|
||||||
|
proxy = ServerClientProxy.getProxy();
|
||||||
|
File cfgFile = new File(proxy.getMinecraftDir(), "config/IronChest.cfg");
|
||||||
Configuration cfg = new Configuration(cfgFile);
|
Configuration cfg = new Configuration(cfgFile);
|
||||||
try {
|
try {
|
||||||
cfg.load();
|
cfg.load();
|
||||||
|
@ -56,16 +55,15 @@ public class mod_IronChest extends BaseModMp {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ModLoader.RegisterBlock(ironChestBlock, ItemIronChest.class);
|
ModLoader.RegisterBlock(ironChestBlock, ItemIronChest.class);
|
||||||
IronChestType.registerTranslations();
|
proxy.registerTranslations();
|
||||||
IronChestType.registerTileEntities(TileEntityIronChestRenderer.class);
|
proxy.registerTileEntities();
|
||||||
IronChestType.generateTieredRecipies(ironChestBlock);
|
IronChestType.generateTieredRecipies(ironChestBlock);
|
||||||
|
|
||||||
ChestItemRenderHelper.instance=new IronChestRenderHelper();
|
proxy.registerRenderInformation();
|
||||||
MinecraftForgeClient.preloadTexture("cpw/mods/ironchest/sprites/block_textures.png");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void openGUI(EntityPlayer player, TileEntityIronChest te) {
|
public static void openGUI(EntityPlayer player, TileEntityIronChest te) {
|
||||||
GUIChest.GUI.showGUI(te, player);
|
proxy.showGUI(te,player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package cpw.mods.ironchest.server;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.src.EntityItem;
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
import net.minecraft.src.ModLoader;
|
||||||
|
import net.minecraft.src.NBTTagCompound;
|
||||||
|
import net.minecraft.src.mod_IronChest;
|
||||||
|
import cpw.mods.ironchest.ContainerIronChestBase;
|
||||||
|
import cpw.mods.ironchest.IProxy;
|
||||||
|
import cpw.mods.ironchest.IronChestType;
|
||||||
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
|
public class ServerProxy implements IProxy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRenderInformation() {
|
||||||
|
// NOOP on server
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerTileEntities() {
|
||||||
|
for (IronChestType typ : IronChestType.values()) {
|
||||||
|
ModLoader.RegisterTileEntity(typ.clazz, typ.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerTranslations() {
|
||||||
|
// NOOP on server
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showGUI(TileEntityIronChest te, EntityPlayer player) {
|
||||||
|
ModLoader.OpenGUI(player, te.getType().guiId, te, new ContainerIronChestBase(player.inventory,te, te.getType(), 1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getMinecraftDir() {
|
||||||
|
return new File(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyExtraDataToDrops(EntityItem entityitem, NBTTagCompound data) {
|
||||||
|
entityitem.item.setNBTData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerGUI(int guiId) {
|
||||||
|
// NOOP on server
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue