Everything posted by shucke
-
PacketHandler to open a GUI?
use: FMLNetworkHandler.openGui() instead of: player.openGui then the methods in the gui handler will be called.
-
Custom Furnace without Fuel
You just have to replace the isBurning() method in your furnace tile entity by something that checks if there is an redstone signal. i found this in the dispenser class dont know if its working but you can give it a try. public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { /*your tile entity name*/ te = (/*your tile entity name*/par1World.getBlockTileEntity(par2, par3, par4); if (!par1World.isRemote && (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4))) { te.isPowered(true); }else{ te.isPowered(false); } } then you just need a variable to the tile entity and add a method for the block to acces. so instead of public boolean isBurning() { return this.furnaceBurnTime > 0; } you put private boolean powered; public void isPowered(boolean b) { powered = true; } and then you just need to replace the part where it checks if the furnace is burning to check if the furnaces is beiing powered. so replace if (this.isBurning() && this.canSmelt()) with if (this.powered == true && this.canSmelt()) didnt test it but i think that should work.
-
Gui Slots Acting Weird
Hello, I am trying to open a GuiContainer when clicked on a button when in a GuiScreen. the gui opens just fine but when i try to drag some items to the slots they start to act all weird. sometimes when i click on 1 of my custom slots i drag out my armour for some reason. and when i try to move around items in my player inventory it acts all weird. the items duplicate to the slot nesxt to them i pick up items i didnt even select and all that kind of stuf. i hope someone can find what is wrong with my code cuz i cant find the error. anyway here is my code: Block Gui (Screen) Gui (Container) Container CommonProxy TileEntity Base File
-
GuiScreen Buttons won't Show
still doesnt work
-
GuiScreen Buttons won't Show
Doesn't seems to work. the buttons do show up though only just for a split second. and the background also renders so the drawScreen is beeing called.
-
GuiScreen Buttons won't Show
When im opening my GuiScreen my buttons wont showup but the background does. but i can still click the buttons if i click with the mouse where the buttons should be. I did registered my IGui Handler so there shouldn't be a problem there. anyway here is my code: CommonProxy Class Gui Class Block Class BaseMod Class my container gui's work but this one doesn't. i tried to figure it out by mself but i can't figgure out what's wrong. no errors in eclipse to.
-
[URGENT]Help with ITextureProvider
you spelled your file name wrong else if (itemstack.itemID == MiscBlocksAndItems.ObsidianLeggings.shiftedIndex) { return "/MiscBlcoksAndItems/Obsidian_2.png"; } dont know if this is the reason but it would create a problem
-
Multipile Structures are generating
Im having a little problem with my structure generation. it generates fine but i only want 1 structure to generate and there are more structres generating. most of the time 3 or 4 and sometimes even 5. here is the code that generates my structure public class WorldGenerator implements IWorldGenerator{ private boolean alreadyRendered = false; @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { System.out.println("generating called"); generateWatchtower(world, random, chunkX*16, chunkZ*16); } private void generateWatchtower(World world, Random random, int i, int j) { while(alreadyRendered == false){ int startX = world.getWorldInfo().getSpawnX(); int startZ = world.getWorldInfo().getSpawnZ(); int Xcoord1 = startX + random.nextInt(30) + 20; int Zcoord1 = startZ + random.nextInt(30) + 20; int blocks[] = new int[]{Block.grass.blockID, Block.sand.blockID, Block.stone.blockID}; int iii; for (int ii = 0; ii < 128; ii++){ if(world.canBlockSeeTheSky(Xcoord1, ii+1, Zcoord1) == true){ iii = world.getBlockId(Xcoord1, ii, Zcoord1); if(iii == blocks[0] || iii == blocks[1] || iii == blocks[2]){ new WorldGenWatchtower().generate(world, random, Xcoord1, ii+1, Zcoord1); alreadyRendered = true; } } } } } sometimes there arent structures generating at all. when i generate a superflat map most of the time the structures wont generate. im really hoping someone can help me with this because i really dont know a solution.
-
Display Item based on TileEntity
my goal here is to display an item just like the item Frame does and get the item that needs to be displayed from the blocks tile entity. but the problem is that the tile entity doesnt update untill you open the gui on the block. and i made a sort of lock on the block so the only player who can open the gui is the player who placed it down. So my question is: can i send a packet to all the other clients when the inventory is changed? or can i let the server send a packet like every 60 ticks to all players?
-
Upgrading to 1.4.2 Error
I tried that but it didn't work. I do have containers in my mod... do you know how to handle them now?
-
Upgrading to 1.4.2 Error
I have just upgraded my mcp to 7.19 (MC 1.4.2) and downloaded the new forge versin for mc 1.4.2. now i replaced every error i could find. and was error free after a few fixes. now when i start minecraft it gives me the following error: 2012-10-28 18:24:36 [sEVERE] [ForgeModLoader] Caught exception from ElectricalEngineering java.lang.IllegalArgumentException: Can not set static mineconomy.common.BaseMineConomy field mineconomy.common.BaseMineConomy.MineConomyInstance to electricalengineering.common.BaseElectricalEngineering at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) at sun.reflect.UnsafeStaticObjectFieldAccessorImpl.set(UnsafeStaticObjectFieldAccessorImpl.java:61) at java.lang.reflect.Field.set(Field.java:657) at cpw.mods.fml.common.FMLModContainer.parseSimpleFieldAnnotation(FMLModContainer.java:398) at cpw.mods.fml.common.FMLModContainer.processFieldAnnotations(FMLModContainer.java:324) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:418) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83) at cpw.mods.fml.common.Loader.loadMods(Loader.java:478) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:150) at net.minecraft.client.Minecraft.startGame(Minecraft.java:420) at net.minecraft.client.Minecraft.run(Minecraft.java:752) at java.lang.Thread.run(Thread.java:662) and a couple more of these for the same reason. i am probarly missing something obvious here but does someone knows how to fix this?
-
Detect entity in front of block.
I'm sorry if i was a little brief in my first post but i didn't know how to explain it any further. now what i want to do is send of a redstone signal if a entity is in front of the block. just like tripwire but you dont have to layout a line of tripwire. i hope this was a little less brief in your opinnion but i dont know how to explain it any further. and can you explain a little bit more about the AABB function to detect entity's? i already found this function in the pressure plate class: public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity){ } bu i dont know how to extend the collision box of the block.
-
Detect entity in front of block.
Title says it all. how can i detect if there is an entity in front of a my custom Block?
-
Entity wont spawn when created in GUIScreen
i changed: [codeEntityClientPlayerMP playerr = (EntityClientPlayerMP) player; playerr.sendQueue.addToSendQueue(packet);][/code] to: PacketDispatcher.sendPacketToServer(packet);[/Code] and it still doesnt work. maybe i'm missing something obvious: here is my code: Base Class: [code]package mineconomy.common; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.network.NetworkRegistry; @Mod(modid = "MineConomy", name = "Mine Conomy", version = "0.1") @NetworkMod( clientSideRequired = true, serverSideRequired = false, versionBounds = "[0.1]", channels = {"MineConomy"}, packetHandler = PacketHandler.class /*clientPacketHandlerSpec = @SidedPacketHandler(channels = {"MineConomyClient"}, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = {"MineConomyServer"}, packetHandler = ServerPacketHandler.class)*/) public class BaseMineConomy { @SidedProxy(clientSide = "mineconomy.client.ClientProxy", serverSide = "mineconomy.common.CommonProxy") public static CommonProxy proxy; @Instance public static BaseMineConomy instance; @Init public void Load(FMLInitializationEvent evt){ proxy.registerRenderInformation(); NetworkRegistry.instance().registerGuiHandler(instance, proxy); } @PreInit public void PreLoad(FMLInitializationEvent evt){ } } Gui: private void BuildPacketItemSpawn(int x, int y, int z, int i) { int id = 0; //Defining the amount of bytes that has to be sent ByteArrayOutputStream bos = new ByteArrayOutputStream(24); DataOutputStream outputStream = new DataOutputStream(bos); try{ outputStream.writeInt(id); outputStream.writeInt(x); outputStream.writeInt(y); outputStream.writeInt(z); outputStream.writeInt(i); }catch(Exception ex){ ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "MineConomy"; packet.data = bos.toByteArray(); packet.length = bos.size(); PacketDispatcher.sendPacketToServer(packet); }[/Code] PacketHandler: [Code]package mineconomy.common; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.src.Block; import net.minecraft.src.EntityItem; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.NetworkManager; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.World; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; public class PacketHandler implements IPacketHandler{ @Override public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player) { if(packet.channel.equals("MineConomy")){ handlePacket(packet, player); } } private void handlePacket(Packet250CustomPayload packet, Player player) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); int id; try{id = inputStream.readInt();}catch(IOException ex){ex.printStackTrace();return;} switch(id){ case 0: int x; int y; int z; int i; try { x = inputStream.readInt(); y = inputStream.readInt(); z = inputStream.readInt(); i = inputStream.readInt(); } catch (IOException e) { e.printStackTrace(); return; } World world = Minecraft.getMinecraft().theWorld; TileEntityVendingMachine tile = (TileEntityVendingMachine)world.getBlockTileEntity(x,y,z); Item item = tile.Items[i-1]; EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(item, 1)); entityitem.delayBeforeCanPickup = 10; entityitem.motionY += 10; world.spawnEntityInWorld(entityitem); break; } } }[/Code] CommonProxy: [Code]@Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); if (te != null){ switch(ID){ case 1: return new ContainerVendingMachine(player.inventory, (TileEntityVendingMachine)te); } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); if (te != null){ switch(ID){ case 0: return new GuiVendingMachine((TileEntityVendingMachine) te, x, y, z, world, player); case 1: return new GuiVendingMachineConfig(player.inventory,(TileEntityVendingMachine)te); } } return null; }[/Code] I have no clue what is wrong with the code and why it wont send the packet to the server.
-
Inventory checking(Still need Help!)
I think you need to put it in a class which mplements ITickHandler. http://www.minecraftforge.net/wiki/Tutorials/Upgrading_To_Forge_for_1.3.1#Ticking this should explain how to make a client ticker. then all you need to do is add a new method to the clientTicker. public Item getCurrentItemEquipped(EntityPlayer entityplayer) throws NullPointerException{ return entityplayer.inventory.getCurrentItem().getItem(); } and add this to the onTickInGame method: EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; Item item = getCurrentItemEquipped(player); if(item != null){ if(item.shiftedIndex == "Your Item ID"){ //Perfom Action } }
-
Entity wont spawn when created in GUIScreen
It worked Thank you ver much the item spawns now but i cant pick it up. i think the packet i send is somehow only send to the client instead of the server. i used this code to send my packet: EntityClientPlayerMP playerr = (EntityClientPlayerMP) player; playerr.sendQueue.addToSendQueue(packet);[/Code] and this to spawn the item in(Inside my PacketHandler.class) [Code]World world = Minecraft.getMinecraft().theWorld; EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(i, 1, 0)); world.spawnEntityInWorld(entityitem); [/Code] but in my packet handler when i do the !world.isRemote check it doesnt return false which should be if you are on a server. i followed the tutorial on packages on the forge wiki: http://www.minecraftforge.net/wiki/Tutorials/Packet_Handling#Building_the_Packet so the code is about the same.
-
Entity wont spawn when created in GUIScreen
I can't make an new ItemStack from an int and int. i need to define an item as the first variable. unless i am missing something obvious here...
-
Checking Loop
for an block like a furnace you need to add an tileEntity to it. then you can just use the onUpdate() function witch fires at every ingame tick. there are a lot of good Tile Entity tutorials online. just search for it.
-
[Request] Gun tutorial Forge
i personally think to look at the ItemBow.java because a bow is actually just a gun except for the fact that you need to pull the string at a bow and you porbally dont need to do that with a gun now what you want to do to make a gun is spawn an bullet entity in the world if the right mouse button is down. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) in the ItemBow.java i found this code to spawn the Arrow (I stripped most of it): EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, 2.0F); if (!par2World.isRemote) { par2World.spawnEntityInWorld(var8); } this should spawn arrows when you right click with the item. I hope this helps.
-
Entity wont spawn when created in GUIScreen
I am trying to let the vending machine spit out an item. but since it needs to be handled trough packets i sended the x,y,z coordiates to the server but the item that needs to be spawned is defined in the gui and since you cant send items trough packets i send the itemID to the server. and from the dispenser source code i found: EntityItem var12 = new EntityItem(par0World, par6, par8 - 0.3D, par10, par1ItemStack); par0World.spawnEntityInWorld(var12); so im trying to spawn an item in the world with this code but instead of an itemid you need the Item type to spawn the item. So my question: is there a way to convert the itemID to an Item type. sorry if i was a little vague in my last post but english isnt my first language
-
Entity wont spawn when created in GUIScreen
Alright so now i send a packet to the server whenever a button is pressed. but the item that have to be spawned is defined in the gui. so i have to send the item id as integer to the server. but how can i see what itemid is belongs to what item?
-
Entity wont spawn when created in GUIScreen
Once again i am having troubles with the multiplayer GUI's. The gui opens and all but when i tried to spawn an entity from my guiScreen it doesnt spawn the entity on the servers side. i registered my gui hadler and all but it think it have something to do with my getServerGuiElement. @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); if (te != null){ switch(ID){ case 0: return new GuiVendingMachine((TileEntityVendingMachine) te, x, y, z, world); } } return null; } it worked for the container to open return a new container but i dont know what to return at the servers side. btw this is the code for openening my gui: FMLNetworkHandler.openGui(par5EntityPlayer, BaseMineConomy.instance, 0, par1World, par2, par3, par4); Thanks in advance
-
[SOLVED]GUI Problem
Tank you very much it worked like a charm
-
[SOLVED]GUI Problem
As the title says it i have a small issue with my gui's. Since i recently updated to forge 4.1.1 i have no clue how to work with networking or anything else. but my problem is that i cant pickup items from my custom gui. when i do it imidiatly puts it back in place it was in before. this worked in minecraft 1.2.5. i have registerd my proxy, guiHandler and Tile Entity. i have also used the getServerGuiElement & getClientGuiElement function in my CommonProxy.class. i used the openGui function instead of the modloader one. Here is my code: Main Class @Mod(modid = "RocketEngineering", name = "Rocket Engineering", version = "0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false, versionBounds = "[0.1]") public class BaseRocketEngineering { public static int renderId; @SidedProxy(clientSide = "rocketengineering.client.ClientProxy", serverSide = "rocketengineering.common.CommonProxy") public static CommonProxy proxy; @Instance public static BaseRocketEngineering instance; public class RocketEngineering{ } @Init public void Load(FMLInitializationEvent evt){ proxy.registerRenderInformation(); //ClientProxy.registerRenderInformation(); NetworkRegistry.instance().registerGuiHandler(instance, proxy); } CommonProxy public class CommonProxy implements IGuiHandler{ public void registerRenderInformation(){ //Keep Clear on Server RegisterBlocks(); AddSmelting(); RegisterTileEntitys(); } public static void RegisterTileEntitys() { GameRegistry.registerTileEntity(TileEntityDataCable.class, "Tile Entity Data Cable"); GameRegistry.registerTileEntity(TileEntityRocketAssembly.class, "Tile Entity Rocket Assembly"); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); if(te != null){ switch(ID){ case 0: return new ContainerRocketAssembly(player.inventory, (TileEntityRocketAssembly)te); } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getBlockTileEntity(x, y, z); if (te != null){ switch(ID){ case 0: return GuiRocketAssembly.buildGUI(player.inventory, (TileEntityRocketAssembly) te); } } return null; } public World getClientWorld() { return null; } } Block Code: public class BlockRocketAssembly extends BlockContainer{ protected BlockRocketAssembly(int i){ super(i, Material.rock); this.setCreativeTab(CreativeTabs.tabDeco); } public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){ if(!par1World.isRemote){ return true; } Object obj = (TileEntityRocketAssembly)par1World.getBlockTileEntity(par2, par3, par4); //ModLoader.openGUI(par5EntityPlayer, new GuiRocketAssembly(par5EntityPlayer.inventory, (TileEntityRocketAssembly)(obj))); par5EntityPlayer.openGui((Object)BaseRocketEngineering.instance, 0, par1World, par2, par3, par4); return true; } @Override public TileEntity createNewTileEntity(World var1) { return new TileEntityRocketAssembly(); } } Tile Entity: package rocketengineering.common; import net.minecraft.src.EntityPlayer; import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagList; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ISidedInventory; import net.minecraftforge.common.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; public class TileEntityRocketAssembly extends TileEntity implements IInventory, ISidedInventory { /** * The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] furnaceItemStacks = new ItemStack[3]; public int getSizeInventory() { return this.furnaceItemStacks.length; } /** * Returns the stack in slot i */ public ItemStack getStackInSlot(int par1) { return this.furnaceItemStacks[par1]; } public ItemStack decrStackSize(int par1, int par2) { if (this.furnaceItemStacks[par1] != null) { ItemStack var3; if (this.furnaceItemStacks[par1].stackSize <= par2) { var3 = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return var3; } else { var3 = this.furnaceItemStacks[par1].splitStack(par2); if (this.furnaceItemStacks[par1].stackSize == 0) { this.furnaceItemStacks[par1] = null; } return var3; } } else { return null; } } public ItemStack getStackInSlotOnClosing(int par1) { if (this.furnaceItemStacks[par1] != null) { ItemStack var2 = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return var2; } else { return null; } } public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.furnaceItemStacks[par1] = par2ItemStack; if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } } public String getInvName() { return "container.furnace"; } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < this.furnaceItemStacks.length) { this.furnaceItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4); } } } /** * Writes a tile entity to NBT. */ public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) { if (this.furnaceItemStacks[var3] != null) { NBTTagCompound var4 = new NBTTagCompound(); var4.setByte("Slot", (byte)var3); this.furnaceItemStacks[var3].writeToNBT(var4); var2.appendTag(var4); } } par1NBTTagCompound.setTag("Items", var2); } /** * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't * this more of a set than a get?* */ public int getInventoryStackLimit() { return 64; } public void updateEntity(){ } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openChest() {} public void closeChest() {} @Override public int getStartInventorySide(ForgeDirection side) { if (side == ForgeDirection.DOWN) return 1; if (side == ForgeDirection.UP) return 0; return 2; } @Override public int getSizeInventorySide(ForgeDirection side) { return 1; } } Gui: package rocketengineering.common; import net.minecraft.src.GuiContainer; import net.minecraft.src.IInventory; import net.minecraft.src.InventoryPlayer; import net.minecraft.src.StatCollector; import org.lwjgl.opengl.GL11; public class GuiRocketAssembly extends GuiContainer { private TileEntityRocketAssembly assemblyInventory; public GuiRocketAssembly(InventoryPlayer par1InventoryPlayer, TileEntityRocketAssembly par2TileEntityRocketAssembly) { super(new ContainerRocketAssembly(par1InventoryPlayer, par2TileEntityRocketAssembly)); this.assemblyInventory = par2TileEntityRocketAssembly; } public static GuiRocketAssembly buildGUI(InventoryPlayer playerInventory, TileEntityRocketAssembly assemblyInventory) { return new GuiRocketAssembly(playerInventory, assemblyInventory); } /** * Draw the foreground layer for the GuiContainer (everythin in front of the items) */ protected void drawGuiContainerForegroundLayer() { this.fontRenderer.drawString(StatCollector.translateToLocal("Rocket Assembly"), 30, 6, 4210752); this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } /** * Draw the background layer for the GuiContainer (everything behind the items) */ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { drawDefaultBackground(); int var4 = this.mc.renderEngine.getTexture("/rocketengineering/resources/gui/rocketAssembly.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(var4); int var5 = (this.width - this.xSize) / 2; int var6 = (this.height - this.ySize) / 2; this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize); int var7; } } Container: package rocketengineering.common; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; import java.util.Iterator; import net.minecraft.src.Container; import net.minecraft.src.EntityPlayer; import net.minecraft.src.ICrafting; import net.minecraft.src.InventoryPlayer; import net.minecraft.src.ItemStack; import net.minecraft.src.Slot; public class ContainerRocketAssembly extends Container { private TileEntityRocketAssembly assembly; private int lastCookTime = 0; private int lastBurnTime = 0; private int lastItemBurnTime = 0; public ContainerRocketAssembly(InventoryPlayer par1InventoryPlayer, TileEntityRocketAssembly par2) { this.assembly = par2; this.addSlotToContainer(new Slot(par2, 0, 26, 55)); this.addSlotToContainer(new Slot(par2, 0, 26, 35)); this.addSlotToContainer(new Slot(par2, 0, 26, 15)); int var3; for (var3 = 0; var3 < 3; ++var3) { for (int var4 = 0; var4 < 9; ++var4) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); } } for (var3 = 0; var3 < 9; ++var3) { this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); } } public void addCraftingToCrafters(ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); } /** * Updates crafting matrix; called from onCraftMatrixChanged. Args: none */ public void updateCraftingResults() { super.updateCraftingResults(); } public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.assembly.isUseableByPlayer(par1EntityPlayer); } /** * Called to transfer a stack from one inventory to the other eg. when shift clicking. */ public ItemStack transferStackInSlot(int par1) { ItemStack var2 = null; return var2; } } I really hope someone can help me with this issue because i have been trying to solve it for quite a while now but nothing i tried seemed to work.
IPS spam blocked by CleanTalk.