Fixed GUI handler for transport, fixed gates showing up in creative inventory, moved pipeid in TEGenPipe to corestate

This commit is contained in:
Krapht 2012-08-14 23:18:03 +02:00
parent 796cf27f35
commit fc1d0fee95
6 changed files with 34 additions and 8 deletions

View file

@ -16,9 +16,11 @@ import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import buildcraft.BuildCraftTransport;
import buildcraft.core.DefaultProps;
import buildcraft.transport.FacadeItemRenderer;
import buildcraft.transport.GuiHandler;
import buildcraft.transport.IPipeRenderState;
import buildcraft.transport.PipeItemRenderer;
import buildcraft.transport.PipeWorldRenderer;
@ -55,6 +57,7 @@ public class mod_BuildCraftTransport {
BuildCraftTransport.initialize();
BuildCraftTransport.initializeModel(this);
NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsWood.shiftedIndex, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsCobblestone.shiftedIndex, pipeItemRenderer);

View file

@ -11,8 +11,26 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
// TODO Auto-generated method stub
return null;
if (!world.blockExists(x, y, z))
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (!(tile instanceof TileGenericPipe))
return null;
TileGenericPipe pipe = (TileGenericPipe) tile;
switch (ID) {
case GuiIds.PIPE_DIAMOND:
return new CraftingDiamondPipe(player.inventory, (PipeLogicDiamond)pipe.pipe.logic);
case GuiIds.GATES:
return new CraftingGateInterface(player.inventory, pipe.pipe);
default:
return null;
}
}
@Override

View file

@ -11,7 +11,6 @@ package buildcraft.api.core;
import net.minecraftforge.common.Orientation;
@Deprecated //- Convert to the forge orientation once proper support is added
public enum Orientations {
YNeg, // 0
YPos, // 1

View file

@ -56,6 +56,12 @@ public class ItemGate extends ItemBuildCraft {
return (new StringBuilder()).append(super.getItemName()).append(".").append(itemstack.getItemDamage()).toString();
}
@Override
@SideOnly(Side.CLIENT)
public CreativeTabs getCreativeTab() {
return CreativeTabs.tabMisc;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) {

View file

@ -177,8 +177,9 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
}
// Do not try to update gates client side.
if(CoreProxy.isRemote())
return;
if (worldObj.isRemote) return;
// if(CoreProxy.isRemote())
// return;
if (actionTracker.markTimeIfDelay(worldObj, 10))
resolveActions();

View file

@ -96,8 +96,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
//Store the pipe key to prevent losing pipes when a user forgets to include an addon
int key;
@TileNetworkData
public int pipeId = -1;
//public int pipeId = -1;
public TileGenericPipe() {
@ -306,7 +305,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
pipe.setTile(this);
pipeId = pipe.itemID;
coreState.pipeId = pipe.itemID;
pipeBound = true;
}
}