Update to 1.2.4, no modloadermp anymore
This commit is contained in:
parent
785aef9551
commit
e4d36feb31
|
@ -2,8 +2,7 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="client"/>
|
<classpathentry kind="src" path="client"/>
|
||||||
<classpathentry kind="src" path="common"/>
|
<classpathentry kind="src" path="common"/>
|
||||||
<classpathentry kind="src" path="server"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/forge-client"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/forge-client"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -7,14 +7,20 @@
|
||||||
|
|
||||||
cpw
|
cpw
|
||||||
====================================================================== -->
|
====================================================================== -->
|
||||||
<project name="mod_IronChests" default="build">
|
<project name="mod_IronChests" default="buildandclean">
|
||||||
<description>
|
<description>
|
||||||
Iron Chests
|
Iron Chests
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<property name="modname" value="mod_ironchests" />
|
<property name="modname" value="mod_ironchests" />
|
||||||
<property name="version" value="3.1" />
|
<property name="version.file" value="cpw/mods/ironchest/Version.java"/>
|
||||||
<property name="mcp.home" location="/home/cpw/projects/mcworkspace/forge59" />
|
<property name="version.major" value="3"/>
|
||||||
|
<property name="version.minor" value="2"/>
|
||||||
|
<property name="version.rev" value="0"/>
|
||||||
|
<property name="version.build" value="0"/>
|
||||||
|
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
||||||
|
<property name="mcdev.home" location="/home/cpw/projects/mcworkspace"/>
|
||||||
|
<property name="mcp.home" location="${mcdev.home}/forge67" />
|
||||||
<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" />
|
||||||
<property name="server.mcp.obfoutput" location="${mcp.obfoutput}/minecraft_server" />
|
<property name="server.mcp.obfoutput" location="${mcp.obfoutput}/minecraft_server" />
|
||||||
|
@ -74,7 +80,8 @@
|
||||||
<target name="extract-built-jar">
|
<target name="extract-built-jar">
|
||||||
<side prop="output" src="mcp.obfoutput" side="${side}"/>
|
<side prop="output" src="mcp.obfoutput" side="${side}"/>
|
||||||
<property name="jarname" value="${modname}-${side}-${version}" />
|
<property name="jarname" value="${modname}-${side}-${version}" />
|
||||||
<jar destfile="${basedir}/${jarname}.zip" >
|
<mkdir dir="${basedir}/target"/>
|
||||||
|
<jar destfile="${basedir}/target/${jarname}.zip" >
|
||||||
<fileset dir="${output}" includes="**/*.class" />
|
<fileset dir="${output}" includes="**/*.class" />
|
||||||
<fileset dir="${resource.dir}" erroronmissingdir="false">
|
<fileset dir="${resource.dir}" erroronmissingdir="false">
|
||||||
<selector if="is.client">
|
<selector if="is.client">
|
||||||
|
@ -82,11 +89,13 @@
|
||||||
</selector>
|
</selector>
|
||||||
</fileset>
|
</fileset>
|
||||||
</jar>
|
</jar>
|
||||||
<jar destfile="${basedir}/${jarname}.zip" update="true">
|
|
||||||
</jar>
|
|
||||||
</target>
|
</target>
|
||||||
<target name="build" depends="merge-client,merge-server,build-client,build-server" />
|
<target name="build" depends="merge-client,merge-server,build-client,build-server" />
|
||||||
|
|
||||||
|
<target name="buildandclean" depends="build">
|
||||||
|
<antcall target="clean"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
<!-- antcall target to merge source to a side -->
|
<!-- antcall target to merge source to a side -->
|
||||||
<target name="clean-source">
|
<target name="clean-source">
|
||||||
<side prop="delete-targ" src="mcp.srcdir" side="${side}"/>
|
<side prop="delete-targ" src="mcp.srcdir" side="${side}"/>
|
||||||
|
@ -108,6 +117,14 @@
|
||||||
<copy todir="${merge-to}" overwrite="true" verbose="true">
|
<copy todir="${merge-to}" overwrite="true" verbose="true">
|
||||||
<fileset dir="${side-from}" includes="**/*.java" />
|
<fileset dir="${side-from}" includes="**/*.java" />
|
||||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
||||||
|
<filterchain>
|
||||||
|
<replacetokens>
|
||||||
|
<token key="MAJOR" value="${version.major}" />
|
||||||
|
<token key="MINOR" value="${version.minor}" />
|
||||||
|
<token key="REV" value="${version.rev}" />
|
||||||
|
<token key="BUILD" value="${version.build}" />
|
||||||
|
</replacetokens>
|
||||||
|
</filterchain>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -3,23 +3,21 @@ package cpw.mods.ironchest.client;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.BaseModMp;
|
|
||||||
import net.minecraft.src.ChestItemRenderHelper;
|
import net.minecraft.src.ChestItemRenderHelper;
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayerSP;
|
||||||
import net.minecraft.src.GuiScreen;
|
import net.minecraft.src.GuiScreen;
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraft.src.ModLoaderMp;
|
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.src.NBTTagCompound;
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.TileEntity;
|
||||||
|
import net.minecraft.src.World;
|
||||||
import net.minecraft.src.forge.MinecraftForgeClient;
|
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||||
import cpw.mods.ironchest.ChestChangerType;
|
import cpw.mods.ironchest.ChestChangerType;
|
||||||
import cpw.mods.ironchest.IProxy;
|
import cpw.mods.ironchest.IProxy;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
|
||||||
public class ClientProxy extends BaseModMp implements IProxy {
|
public class ClientProxy implements IProxy {
|
||||||
@Override
|
@Override
|
||||||
public void registerRenderInformation() {
|
public void registerRenderInformation() {
|
||||||
ChestItemRenderHelper.instance = new IronChestRenderHelper();
|
ChestItemRenderHelper.instance = new IronChestRenderHelper();
|
||||||
|
@ -44,12 +42,6 @@ public class ClientProxy extends BaseModMp implements IProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showGUI(TileEntityIronChest te, EntityPlayer player) {
|
|
||||||
GUIChest.GUI.showGUI(te, player);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getMinecraftDir() {
|
public File getMinecraftDir() {
|
||||||
return Minecraft.getMinecraftDir();
|
return Minecraft.getMinecraftDir();
|
||||||
|
@ -61,54 +53,23 @@ public class ClientProxy extends BaseModMp implements IProxy {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleTileEntityPacket(int x, int y, int z, int type, int[] intData, float[] floatData, String[] stringData) {
|
|
||||||
TileEntity te=ModLoader.getMinecraftInstance().theWorld.getBlockTileEntity(x, y, z);
|
|
||||||
if (te!=null && te instanceof TileEntityIronChest) {
|
|
||||||
TileEntityIronChest icte=(TileEntityIronChest)te;
|
|
||||||
icte.handlePacketData(type,intData,floatData,stringData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket(TileEntityIronChest tile) {
|
|
||||||
// NOOP on client
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendTileEntityUpdate(TileEntityIronChest tile) {
|
|
||||||
// NOOP on client
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRemote() {
|
public boolean isRemote() {
|
||||||
return ModLoader.getMinecraftInstance().theWorld.isRemote;
|
return ModLoader.getMinecraftInstance().theWorld.isRemote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuiScreen getGuiScreen(int ID, EntityPlayerSP player, World world, int X, int Y, int Z) {
|
||||||
|
TileEntity te = world.getBlockTileEntity(X, Y, Z);
|
||||||
|
if (te != null && te instanceof TileEntityIronChest) {
|
||||||
|
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World getCurrentWorld() {
|
||||||
|
return ModLoader.getMinecraftInstance().theWorld;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,20 +38,7 @@ public class GUIChest extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory) {
|
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory) {
|
||||||
for (GUI gui : values()) {
|
return new GUIChest(values()[chestInventory.getType().ordinal()],playerInventory,chestInventory);
|
||||||
if (chestInventory.getType()==gui.mainType) {
|
|
||||||
return new GUIChest(gui,playerInventory,chestInventory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.src.Block;
|
||||||
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.Item;
|
import net.minecraft.src.Item;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.ModelChest;
|
import net.minecraft.src.ModelChest;
|
||||||
|
@ -20,7 +21,8 @@ import net.minecraft.src.Tessellator;
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.TileEntity;
|
||||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.src.forge.ForgeHooksClient;
|
import net.minecraft.src.forge.ForgeHooksClient;
|
||||||
import net.minecraft.src.forge.ICustomItemRenderer;
|
import net.minecraft.src.forge.IItemRenderer;
|
||||||
|
import net.minecraft.src.forge.ItemRenderType;
|
||||||
import net.minecraft.src.forge.MinecraftForgeClient;
|
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.TileEntityIronChest;
|
||||||
|
@ -101,6 +103,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
glDisable(2896 /* GL_LIGHTING */);
|
glDisable(2896 /* GL_LIGHTING */);
|
||||||
glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||||
glTranslatef((float) x, (float) y, (float) z);
|
glTranslatef((float) x, (float) y, (float) z);
|
||||||
|
EntityItem customitem=new EntityItem(tileEntityRenderer.worldObj);
|
||||||
for (ItemStack item : tile.getTopItemStacks()) {
|
for (ItemStack item : tile.getTopItemStacks()) {
|
||||||
if (shift > shifts.length) {
|
if (shift > shifts.length) {
|
||||||
break;
|
break;
|
||||||
|
@ -113,7 +116,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
shiftY = shifts[shift][1];
|
shiftY = shifts[shift][1];
|
||||||
shiftZ = shifts[shift][2];
|
shiftZ = shifts[shift][2];
|
||||||
shift++;
|
shift++;
|
||||||
ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(item.itemID);
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item,ItemRenderType.ENTITY);
|
||||||
float localScale = blockScale;
|
float localScale = blockScale;
|
||||||
if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID]!=null) {
|
if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID]!=null) {
|
||||||
int j = Block.blocksList[item.itemID].getRenderType();
|
int j = Block.blocksList[item.itemID].getRenderType();
|
||||||
|
@ -135,9 +138,10 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customRenderer != null) {
|
if (customRenderer != null) {
|
||||||
|
customitem.item=item;
|
||||||
bindTextureByName("/terrain.png");
|
bindTextureByName("/terrain.png");
|
||||||
ForgeHooksClient.overrideTexture(item.getItem());
|
ForgeHooksClient.overrideTexture(item.getItem());
|
||||||
ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, item.itemID, item.getItemDamage(), 1.0F);
|
ForgeHooksClient.renderEntityItem(customRenderer, renderBlocks, customitem);
|
||||||
} else if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID]!=null && RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType())) {
|
} else if (item.itemID < Block.blocksList.length && Block.blocksList[item.itemID]!=null && RenderBlocks.renderItemIn3d(Block.blocksList[item.itemID].getRenderType())) {
|
||||||
bindTextureByName("/terrain.png");
|
bindTextureByName("/terrain.png");
|
||||||
ForgeHooksClient.overrideTexture(Block.blocksList[item.itemID]);
|
ForgeHooksClient.overrideTexture(Block.blocksList[item.itemID]);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.src.forge.ITextureProvider;
|
||||||
public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
|
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
||||||
public BlockIronChest(int id) {
|
public BlockIronChest(int id) {
|
||||||
super(id, Material.iron);
|
super(id, Material.iron);
|
||||||
setBlockName("IronChest");
|
setBlockName("IronChest");
|
||||||
|
@ -50,10 +51,12 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return 22;
|
return 22;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity getBlockEntity(int metadata) {
|
public TileEntity getBlockEntity(int metadata) {
|
||||||
return IronChestType.makeEntity(metadata);
|
return IronChestType.makeEntity(metadata);
|
||||||
|
@ -89,6 +92,7 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
return typ.getTextureRow() * 16;
|
return typ.getTextureRow() * 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer player) {
|
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer player) {
|
||||||
TileEntity te = world.getBlockTileEntity(i, j, k);
|
TileEntity te = world.getBlockTileEntity(i, j, k);
|
||||||
|
@ -107,7 +111,7 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod_IronChest.openGUI(player, (TileEntityIronChest)te);
|
player.openGui(mod_IronChest.instance, ((TileEntityIronChest) te).getType().ordinal(), world, i, j, k);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
world.markBlockNeedsUpdate(i, j, k);
|
world.markBlockNeedsUpdate(i, j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int damageDropped(int i) {
|
protected int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
|
@ -173,7 +178,8 @@ public class BlockIronChest extends BlockContainer implements ITextureProvider {
|
||||||
i1 = itemstack.stackSize;
|
i1 = itemstack.stackSize;
|
||||||
}
|
}
|
||||||
itemstack.stackSize -= i1;
|
itemstack.stackSize -= i1;
|
||||||
EntityItem entityitem = new EntityItem(world, (float)chest.xCoord + f, (float)chest.yCoord + (newSize>0 ? 1 : 0) + f1, (float)chest.zCoord + f2, new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
|
EntityItem entityitem = new EntityItem(world, (float) chest.xCoord + f, (float) chest.yCoord + (newSize > 0 ? 1 : 0) + f1, (float) chest.zCoord + f2,
|
||||||
|
new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
|
||||||
float f3 = 0.05F;
|
float f3 = 0.05F;
|
||||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public enum ChestChangerType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemChestChanger buildItem(Configuration cfg, int id) {
|
public ItemChestChanger buildItem(Configuration cfg, int id) {
|
||||||
int itemId=Integer.parseInt(cfg.getOrCreateIntProperty(itemName, Configuration.ITEM_PROPERTY, id).value);
|
int itemId=Integer.parseInt(cfg.getOrCreateIntProperty(itemName, Configuration.CATEGORY_ITEM, id).value);
|
||||||
item=new ItemChestChanger(itemId,this);
|
item=new ItemChestChanger(itemId,this);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cpw.mods.ironchest;
|
||||||
import net.minecraft.src.Container;
|
import net.minecraft.src.Container;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.src.IInventory;
|
||||||
import net.minecraft.src.InventoryPlayer;
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.Slot;
|
import net.minecraft.src.Slot;
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ package cpw.mods.ironchest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.src.NBTTagCompound;
|
||||||
import net.minecraft.src.Packet;
|
import net.minecraft.src.World;
|
||||||
|
import net.minecraft.src.forge.IGuiHandler;
|
||||||
|
|
||||||
public interface IProxy {
|
public interface IProxy extends IGuiHandler {
|
||||||
|
|
||||||
public abstract void registerRenderInformation();
|
public abstract void registerRenderInformation();
|
||||||
|
|
||||||
|
@ -15,19 +15,11 @@ public interface IProxy {
|
||||||
|
|
||||||
public abstract void registerTranslations();
|
public abstract void registerTranslations();
|
||||||
|
|
||||||
public abstract void showGUI(TileEntityIronChest te, EntityPlayer player);
|
|
||||||
|
|
||||||
public abstract File getMinecraftDir();
|
public abstract File getMinecraftDir();
|
||||||
|
|
||||||
public abstract void applyExtraDataToDrops(EntityItem item, NBTTagCompound data);
|
public abstract void applyExtraDataToDrops(EntityItem item, NBTTagCompound data);
|
||||||
|
|
||||||
public abstract void registerGUI(int guiId);
|
|
||||||
|
|
||||||
public abstract void handleTileEntityPacket(int x, int y, int z, int type, int[] intData, float[] floatData, String[] stringData);
|
|
||||||
|
|
||||||
public abstract Packet getDescriptionPacket(TileEntityIronChest tile);
|
|
||||||
|
|
||||||
public abstract void sendTileEntityUpdate(TileEntityIronChest tile);
|
|
||||||
|
|
||||||
public abstract boolean isRemote();
|
public abstract boolean isRemote();
|
||||||
|
|
||||||
|
public abstract World getCurrentWorld();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,36 +7,31 @@ 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.mod_IronChest;
|
|
||||||
import net.minecraft.src.forge.Configuration;
|
|
||||||
|
|
||||||
public enum IronChestType {
|
public enum IronChestType {
|
||||||
IRON(54, 9, true, "Iron Chest", "guiIronChest", "ironchest.png", 0, Item.ingotIron, TileEntityIronChest.class, "mmmmPmmmm","mGmG3GmGm"),
|
IRON(54, 9, true, "Iron Chest", "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", "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", "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", "copperchest.png", 3, null, TileEntityCopperChest.class, "mmmmCmmmm"),
|
||||||
SILVER(72, 9, false, "Silver Chest", "guiSilverChest", "silverchest.png", 4, null, TileEntitySilverChest.class, "mmmm0mmmm", "mGmG3GmGm"),
|
SILVER(72, 9, false, "Silver Chest", "silverchest.png", 4, null, TileEntitySilverChest.class, "mmmm0mmmm", "mGmG3GmGm"),
|
||||||
CRYSTAL(108, 12, true, "Crystal Chest", "guiDiamondChest", "crystalchest.png", 5, Item.itemsList[Block.glass.blockID], TileEntityCrystalChest.class, "GGGGPGGGG");
|
CRYSTAL(108, 12, true, "Crystal Chest", "crystalchest.png", 5, Item.itemsList[Block.glass.blockID], TileEntityCrystalChest.class, "GGGGPGGGG");
|
||||||
int size;
|
int size;
|
||||||
private int rowLength;
|
private int rowLength;
|
||||||
public String friendlyName;
|
public String friendlyName;
|
||||||
private boolean tieredChest;
|
private boolean tieredChest;
|
||||||
private String modelTexture;
|
private String modelTexture;
|
||||||
private String guiName;
|
|
||||||
private int textureRow;
|
private int textureRow;
|
||||||
public Class<? extends TileEntityIronChest> clazz;
|
public Class<? extends TileEntityIronChest> clazz;
|
||||||
Item mat;
|
Item mat;
|
||||||
private String[] recipes;
|
private String[] recipes;
|
||||||
public int guiId;
|
|
||||||
private ArrayList<ItemStack> matList;
|
private ArrayList<ItemStack> matList;
|
||||||
|
|
||||||
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 modelTexture, int textureRow, Item mat,
|
||||||
Class<? extends TileEntityIronChest> clazz, String... recipes) {
|
Class<? extends TileEntityIronChest> clazz, String... recipes) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.rowLength = rowLength;
|
this.rowLength = rowLength;
|
||||||
this.tieredChest = tieredChest;
|
this.tieredChest = tieredChest;
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
this.guiName = guiName;
|
|
||||||
this.modelTexture = "/cpw/mods/ironchest/sprites/" + modelTexture;
|
this.modelTexture = "/cpw/mods/ironchest/sprites/" + modelTexture;
|
||||||
this.textureRow = textureRow;
|
this.textureRow = textureRow;
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
|
@ -98,22 +93,6 @@ public enum IronChestType {
|
||||||
ModLoader.addRecipe(is, parts);
|
ModLoader.addRecipe(is, parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGUI() {
|
|
||||||
return guiId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initGUIs(Configuration cfg) {
|
|
||||||
int defGUI = 51;
|
|
||||||
for (IronChestType typ : values()) {
|
|
||||||
if (typ.guiName != null) {
|
|
||||||
typ.guiId = Integer.parseInt(cfg.getOrCreateIntProperty(typ.guiName, Configuration.GENERAL_PROPERTY, defGUI++).value);
|
|
||||||
mod_IronChest.proxy.registerGUI(typ.guiId);
|
|
||||||
} else {
|
|
||||||
typ.guiId = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRowCount() {
|
public int getRowCount() {
|
||||||
return size / rowLength;
|
return size / rowLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.src.Item;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
import net.minecraft.src.TileEntity;
|
import net.minecraft.src.TileEntity;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
import net.minecraft.src.mod_IronChest;
|
|
||||||
import net.minecraft.src.forge.ITextureProvider;
|
import net.minecraft.src.forge.ITextureProvider;
|
||||||
|
|
||||||
public class ItemChestChanger extends Item implements ITextureProvider {
|
public class ItemChestChanger extends Item implements ITextureProvider {
|
||||||
|
@ -32,8 +31,8 @@ public class ItemChestChanger extends Item implements ITextureProvider {
|
||||||
world.setBlockTileEntity(X, Y, Z, newchest);
|
world.setBlockTileEntity(X, Y, Z, newchest);
|
||||||
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal());
|
world.setBlockMetadataWithNotify(X, Y, Z, newchest.getType().ordinal());
|
||||||
world.notifyBlocksOfNeighborChange(X, Y, Z, world.getBlockId(X, Y, Z));
|
world.notifyBlocksOfNeighborChange(X, Y, Z, world.getBlockId(X, Y, Z));
|
||||||
|
world.markBlockNeedsUpdate(X, Y, Z);
|
||||||
stack.stackSize=0;
|
stack.stackSize=0;
|
||||||
mod_IronChest.proxy.sendTileEntityUpdate(newchest);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.src.NetworkManager;
|
||||||
|
import net.minecraft.src.Packet;
|
||||||
|
import net.minecraft.src.Packet1Login;
|
||||||
|
import net.minecraft.src.Packet250CustomPayload;
|
||||||
|
import net.minecraft.src.TileEntity;
|
||||||
|
import net.minecraft.src.World;
|
||||||
|
import net.minecraft.src.mod_IronChest;
|
||||||
|
import net.minecraft.src.forge.IConnectionHandler;
|
||||||
|
import net.minecraft.src.forge.IPacketHandler;
|
||||||
|
import net.minecraft.src.forge.MessageManager;
|
||||||
|
|
||||||
|
public class PacketHandler implements IPacketHandler, IConnectionHandler {
|
||||||
|
@Override
|
||||||
|
public void onConnect(NetworkManager network) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLogin(NetworkManager network, Packet1Login login) {
|
||||||
|
MessageManager.getInstance().registerChannel(network, this, "IronChest");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisconnect(NetworkManager network, String message, Object[] args) {
|
||||||
|
MessageManager.getInstance().removeConnection(network);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPacketData(NetworkManager network, String channel, byte[] data) {
|
||||||
|
DataInputStream dis=new DataInputStream(new ByteArrayInputStream(data));
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
int typ;
|
||||||
|
boolean hasStacks;
|
||||||
|
int[] items=null;
|
||||||
|
try {
|
||||||
|
x = dis.readInt();
|
||||||
|
y = dis.readInt();
|
||||||
|
z = dis.readInt();
|
||||||
|
typ=dis.readByte();
|
||||||
|
hasStacks=dis.readByte()!=0;
|
||||||
|
if (hasStacks) {
|
||||||
|
items = new int[24];
|
||||||
|
for (int i=0; i<items.length; i++) {
|
||||||
|
items[i]=dis.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
World world=mod_IronChest.proxy.getCurrentWorld();
|
||||||
|
TileEntity te=world.getBlockTileEntity(x, y, z);
|
||||||
|
if (te instanceof TileEntityIronChest) {
|
||||||
|
TileEntityIronChest icte = (TileEntityIronChest)te;
|
||||||
|
icte.handlePacketData(typ, items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Packet getPacket(TileEntityIronChest tileEntityIronChest) {
|
||||||
|
ByteArrayOutputStream bos=new ByteArrayOutputStream(140);
|
||||||
|
DataOutputStream dos=new DataOutputStream(bos);
|
||||||
|
int x=tileEntityIronChest.xCoord;
|
||||||
|
int y=tileEntityIronChest.yCoord;
|
||||||
|
int z=tileEntityIronChest.zCoord;
|
||||||
|
int typ=tileEntityIronChest.getType().ordinal();
|
||||||
|
int[] items=tileEntityIronChest.buildIntDataList();
|
||||||
|
boolean hasStacks=(items!=null);
|
||||||
|
try {
|
||||||
|
dos.writeInt(x);
|
||||||
|
dos.writeInt(y);
|
||||||
|
dos.writeInt(z);
|
||||||
|
dos.writeByte(typ);
|
||||||
|
dos.writeByte(hasStacks? 1 : 0);
|
||||||
|
if (hasStacks) {
|
||||||
|
for (int i=0; i<24; i++) {
|
||||||
|
dos.writeInt(items[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// UNPOSSIBLE?
|
||||||
|
}
|
||||||
|
Packet250CustomPayload pkt=new Packet250CustomPayload();
|
||||||
|
pkt.channel="IronChest";
|
||||||
|
pkt.data=bos.toByteArray();
|
||||||
|
pkt.length=bos.size();
|
||||||
|
return pkt;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
|
import net.minecraft.src.forge.MinecraftForge;
|
||||||
|
|
||||||
public enum ServerClientProxy {
|
public enum ServerClientProxy {
|
||||||
CLIENT("cpw.mods.ironchest.client.ClientProxy"),
|
CLIENT("cpw.mods.ironchest.client.ClientProxy"),
|
||||||
|
@ -21,15 +22,10 @@ public enum ServerClientProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static IProxy getProxy() {
|
public static IProxy getProxy() {
|
||||||
try {
|
if (MinecraftForge.isClient()) {
|
||||||
ModLoader.class.getMethod("getMinecraftInstance");
|
return CLIENT.buildProxy();
|
||||||
} catch (SecurityException e) {
|
} else {
|
||||||
// UNPOSSIBLE
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
return SERVER.buildProxy();
|
return SERVER.buildProxy();
|
||||||
}
|
}
|
||||||
return CLIENT.buildProxy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,9 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
for (int i = 0; i < topStacks.length; i++) {
|
for (int i = 0; i < topStacks.length; i++) {
|
||||||
topStacks[i] = null;
|
topStacks[i] = null;
|
||||||
}
|
}
|
||||||
mod_IronChest.proxy.sendTileEntityUpdate(this);
|
if (worldObj!=null) {
|
||||||
|
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hadStuff = true;
|
hadStuff = true;
|
||||||
|
@ -121,7 +123,9 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
for (int i = p; i < topStacks.length; i++) {
|
for (int i = p; i < topStacks.length; i++) {
|
||||||
topStacks[i] = null;
|
topStacks[i] = null;
|
||||||
}
|
}
|
||||||
mod_IronChest.proxy.sendTileEntityUpdate(this);
|
if (worldObj!=null) {
|
||||||
|
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -320,10 +324,10 @@ public class TileEntityIronChest extends TileEntity implements IInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
return mod_IronChest.proxy.getDescriptionPacket(this);
|
return PacketHandler.getPacket(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handlePacketData(int typeData, int[] intData, float[] floatData, String[] stringData) {
|
public void handlePacketData(int typeData, int[] intData) {
|
||||||
TileEntityIronChest chest = this;
|
TileEntityIronChest chest = this;
|
||||||
if (this.type.ordinal() != typeData) {
|
if (this.type.ordinal() != typeData) {
|
||||||
chest = updateFromMetadata(typeData);
|
chest = updateFromMetadata(typeData);
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
|
||||||
|
public class Version {
|
||||||
|
public static final String MAJOR="@MAJOR@";
|
||||||
|
public static final String MINOR="@MINOR@";
|
||||||
|
public static final String REV="@REV@";
|
||||||
|
public static final String BUILD="@BUILD@";
|
||||||
|
|
||||||
|
public static final String version() {
|
||||||
|
return MAJOR+"."+MINOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String name() {
|
||||||
|
return "Iron Chest ("+MAJOR+"."+MINOR+") rev "+REV+" build "+BUILD;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,41 +6,44 @@ import java.lang.reflect.Method;
|
||||||
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.NetworkMod;
|
||||||
import cpw.mods.ironchest.BlockIronChest;
|
import cpw.mods.ironchest.BlockIronChest;
|
||||||
import cpw.mods.ironchest.ChestChangerType;
|
import cpw.mods.ironchest.ChestChangerType;
|
||||||
import cpw.mods.ironchest.IProxy;
|
import cpw.mods.ironchest.IProxy;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
import cpw.mods.ironchest.ItemChestChanger;
|
import cpw.mods.ironchest.ItemChestChanger;
|
||||||
import cpw.mods.ironchest.ItemIronChest;
|
import cpw.mods.ironchest.ItemIronChest;
|
||||||
|
import cpw.mods.ironchest.PacketHandler;
|
||||||
import cpw.mods.ironchest.ServerClientProxy;
|
import cpw.mods.ironchest.ServerClientProxy;
|
||||||
import cpw.mods.ironchest.TileEntityIronChest;
|
import cpw.mods.ironchest.Version;
|
||||||
|
|
||||||
public class mod_IronChest extends BaseModMp {
|
public class mod_IronChest extends NetworkMod {
|
||||||
|
|
||||||
public static BlockIronChest ironChestBlock;
|
public static BlockIronChest ironChestBlock;
|
||||||
public static ItemChestChanger itemChestChanger;
|
public static ItemChestChanger itemChestChanger;
|
||||||
public static IProxy proxy;
|
public static IProxy proxy;
|
||||||
|
public static mod_IronChest instance;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return "3.1";
|
return Version.version();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
MinecraftForge.versionDetect("IronChest", 1, 4, 0);
|
MinecraftForge.versionDetect("IronChest", 2, 0, 0);
|
||||||
|
instance = this;
|
||||||
proxy = ServerClientProxy.getProxy();
|
proxy = ServerClientProxy.getProxy();
|
||||||
File cfgFile = new File(proxy.getMinecraftDir(), "config/IronChest.cfg");
|
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();
|
||||||
int bId=Integer.parseInt(cfg.getOrCreateBlockIdProperty("ironChests", 181).value);
|
int bId = cfg.getOrCreateBlockIdProperty("ironChests", 181).getInt(181);
|
||||||
if (bId >= 256) {
|
if (bId >= 256) {
|
||||||
throw new RuntimeException(String.format("IronChest detected an invalid block id %s\n", bId));
|
throw new RuntimeException(String.format("IronChest detected an invalid block id %s\n", bId));
|
||||||
}
|
}
|
||||||
ironChestBlock = new BlockIronChest(bId);
|
ironChestBlock = new BlockIronChest(bId);
|
||||||
ChestChangerType.buildItems(cfg, 19501);
|
ChestChangerType.buildItems(cfg, 19501);
|
||||||
IronChestType.initGUIs(cfg);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ModLoader.getLogger().severe("IronChest was unable to load it's configuration successfully");
|
ModLoader.getLogger().severe("IronChest was unable to load it's configuration successfully");
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
|
@ -77,17 +80,19 @@ public class mod_IronChest extends BaseModMp {
|
||||||
ChestChangerType.generateRecipe(IronChestType.DIAMOND);
|
ChestChangerType.generateRecipe(IronChestType.DIAMOND);
|
||||||
IronChestType.generateTieredRecipies(ironChestBlock);
|
IronChestType.generateTieredRecipies(ironChestBlock);
|
||||||
|
|
||||||
|
MinecraftForge.setGuiHandler(this, proxy);
|
||||||
|
MinecraftForge.registerConnectionHandler(new PacketHandler());
|
||||||
proxy.registerRenderInformation();
|
proxy.registerRenderInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void modsLoaded() {
|
public void modsLoaded() {
|
||||||
try {
|
try {
|
||||||
Class<?> equivexmaps = Class.forName("ee.EEMaps");
|
Class<?> equivexmaps = Class.forName("ee.EEMaps");
|
||||||
Method addEMC = equivexmaps.getMethod("addEMC", int.class, int.class, int.class);
|
Method addEMC = equivexmaps.getMethod("addEMC", int.class, int.class, int.class);
|
||||||
Method addMeta = equivexmaps.getMethod("addMeta", int.class, int.class);
|
Method addMeta = equivexmaps.getMethod("addMeta", int.class, int.class);
|
||||||
int[] chestEMCValues=new int[] { 8*8+256*8, 8*8+256*8+2048*8, 2*8192+8*8+256*8+2048*8+6, 85*8+8*8, 85*8+8*8+512*8, 2*8192+8*8+256*8+2048*8+6+8 };
|
int[] chestEMCValues = new int[] { 8 * 8 + 256 * 8, 8 * 8 + 256 * 8 + 2048 * 8, 2 * 8192 + 8 * 8 + 256 * 8 + 2048 * 8 + 6, 85 * 8 + 8 * 8,
|
||||||
|
85 * 8 + 8 * 8 + 512 * 8, 2 * 8192 + 8 * 8 + 256 * 8 + 2048 * 8 + 6 + 8 };
|
||||||
for (IronChestType icType : IronChestType.values()) {
|
for (IronChestType icType : IronChestType.values()) {
|
||||||
addEMC.invoke(null, ironChestBlock.blockID, icType.ordinal(), chestEMCValues[icType.ordinal()]);
|
addEMC.invoke(null, ironChestBlock.blockID, icType.ordinal(), chestEMCValues[icType.ordinal()]);
|
||||||
}
|
}
|
||||||
|
@ -98,11 +103,13 @@ public class mod_IronChest extends BaseModMp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openGUI(EntityPlayer player, TileEntityIronChest te) {
|
@Override
|
||||||
proxy.showGUI(te,player);
|
public boolean clientSideRequired() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleTileEntityPacket(int x, int y, int z, int type, int[] intData, float[] floatData, String[] stringData) {
|
@Override
|
||||||
proxy.handleTileEntityPacket(x,y,z,type,intData,floatData,stringData);
|
public boolean serverSideRequired() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,13 @@ package cpw.mods.ironchest.server;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.src.BaseModMp;
|
import net.minecraft.src.Container;
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.src.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayerMP;
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraft.src.ModLoaderMp;
|
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.src.NBTTagCompound;
|
||||||
import net.minecraft.src.Packet;
|
import net.minecraft.src.TileEntity;
|
||||||
import net.minecraft.src.mod_IronChest;
|
import net.minecraft.src.World;
|
||||||
import cpw.mods.ironchest.ContainerIronChestBase;
|
import cpw.mods.ironchest.ContainerIronChestBase;
|
||||||
import cpw.mods.ironchest.IProxy;
|
import cpw.mods.ironchest.IProxy;
|
||||||
import cpw.mods.ironchest.IronChestType;
|
import cpw.mods.ironchest.IronChestType;
|
||||||
|
@ -34,11 +33,6 @@ public class ServerProxy implements IProxy {
|
||||||
// NOOP on server
|
// 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
|
@Override
|
||||||
public File getMinecraftDir() {
|
public File getMinecraftDir() {
|
||||||
return new File(".");
|
return new File(".");
|
||||||
|
@ -49,29 +43,26 @@ public class ServerProxy implements IProxy {
|
||||||
entityitem.item.setTagCompound(data);
|
entityitem.item.setTagCompound(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerGUI(int guiId) {
|
|
||||||
// NOOP on server
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleTileEntityPacket(int x, int y, int z, int type, int[] intData, float[] floatData, String[] stringData) {
|
|
||||||
// NOOP on server
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet getDescriptionPacket(TileEntityIronChest tile) {
|
|
||||||
return ModLoaderMp.getTileEntityPacket(ModLoaderMp.getModInstance(mod_IronChest.class), tile.xCoord, tile.yCoord, tile.zCoord, tile.getType().ordinal(), tile.buildIntDataList(),null,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendTileEntityUpdate(TileEntityIronChest tile) {
|
|
||||||
ModLoaderMp.sendTileEntityPacket(tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRemote() {
|
public boolean isRemote() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Container getGuiContainer(int ID, EntityPlayerMP player, World world, int X, int Y, int Z) {
|
||||||
|
TileEntity te=world.getBlockTileEntity(X, Y, Z);
|
||||||
|
if (te!=null && te instanceof TileEntityIronChest) {
|
||||||
|
TileEntityIronChest icte=(TileEntityIronChest) te;
|
||||||
|
return new ContainerIronChestBase(player.inventory, icte, icte.getType(), 0, 0);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World getCurrentWorld() {
|
||||||
|
// NOOP on server: there's lots
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue