Posted February 14, 20169 yr I just started creating a Tile-Entity which will act as a charger for some items and i am having problems with the gui. I just set-up the GUI Handler the Gui Container, Gui Class. I copied some of the code for the methods of the inventory at Tile Entity from the official Forge Tutorials. Now, don't think that i copied the code because i don't know how to do it on my own, it's just because i am a little bit lazy. I understand every part of the code that i copied and i am certain that i could have created it on my own, so please don't hate on me copying some code. Let's get to the problem now. When i right click the block. The GUI displays and everything works, but i am concerned by a problem. The console displays some error messages: [19:40:30] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_66] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_66] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_66] Caused by: java.lang.NullPointerException at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:654) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_66] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_66] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] ... 5 more Very weird problem. It has never happen to me before. These are the classes which i think are causing the problem: (If you need more info i will update this post) Main Class: package com.ae.main; import org.lwjgl.util.glu.GLU; import org.lwjgl.util.glu.Sphere; import com.ae.GUI.GuiHandler; import com.ae.blocks.Charger; import com.ae.client.ItemRenderer; import com.ae.editv.BehaviorMelonDispenseItem; import com.ae.editv.BehaviorPumpkinDispenseItem; import com.ae.editv.BehaviorSeedDispenseItem; import com.ae.proxies.proxylib; import com.ae.tools.flintAxe; import com.ae.tools.flintHoe; import com.ae.tools.flintPickaxe; import com.ae.tools.flintShovel; import com.ae.tools.flintSword; import com.ae.tools.BaseClasses.BaseTool; import com.ae.tools.energyTool; import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemEnchantedBook; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = AdvancedElectronics.MODID, name = AdvancedElectronics.NAME, version = AdvancedElectronics.VERSION) public class AdvancedElectronics { public static final String MODID = "ae"; public static final String NAME = "AdvancedElectronics"; public static final String VERSION = "1.0"; @Instance public static AdvancedElectronics instance; @SidedProxy(clientSide = proxylib.CLIENTSIDE, serverSide = proxylib.SERVERSIDE) public static serverProxy proxy; public static int ChargerGUIID = 0; //Creative Tab public static CreativeTabs aeTab = new aeTab(CreativeTabs.getNextID(), "Advanced Electronics"); //Armor Material //Tool Material public static Item.ToolMaterial flintMat = EnumHelper.addToolMaterial("flintMat", 1, 160, 5.0F, 1.5F, 10); //Items public static Item testItem; /** * To add: * New tools to help the player have a better beginning of the game (Done !) * New ores, (probably different metals or non-metals (To do) * New redstone machines (To Do) * New energy system (probably a redstone liquid) (To Do) * New power machines (To Do) * New energy tools (To Do) * New energy armor (To Do) * Possibly a book with all the mod contents (To Do) * --------------------------------------------------------- Soon when i get more ideas */ //Blocks public static Block Charger; //Tools public static ItemAxe flintAxe; public static ItemSword flintSword; public static ItemSpade flintShovel; public static ItemPickaxe flintPickaxe; public static ItemHoe flintHoe; public static Item energyTool; //Misc @EventHandler public void preInit(FMLPreInitializationEvent event) { //Items //Blocks Charger = new Charger(); //Tools flintAxe = new flintAxe(); flintSword = new flintSword(); flintShovel = new flintShovel(); flintPickaxe = new flintPickaxe(); flintHoe = new flintHoe(); energyTool = new energyTool(); //Machine //Misc //Registering Items //Registering TE //Registering Blocks GameRegistry.registerBlock(Charger, Charger.getUnlocalizedName().substring(5)); //Registering Tools GameRegistry.registerItem(flintAxe, flintAxe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(flintSword, flintSword.getUnlocalizedName().substring(5)); GameRegistry.registerItem(flintShovel, flintShovel.getUnlocalizedName().substring(5)); GameRegistry.registerItem(flintPickaxe, flintPickaxe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(flintHoe, flintHoe.getUnlocalizedName().substring(5)); GameRegistry.registerItem(energyTool, energyTool.getUnlocalizedName().substring(5)); //Registering Misc } @EventHandler public void Init(FMLInitializationEvent event) { proxy.registerRenderInfo(); NetworkRegistry.INSTANCE.registerGuiHandler(this.instance, new GuiHandler()); } @EventHandler public void postInit(FMLPostInitializationEvent event) { BlockDispenser.dispenseBehaviorRegistry.putObject(Items.wheat_seeds, new BehaviorSeedDispenseItem()); BlockDispenser.dispenseBehaviorRegistry.putObject(Items.pumpkin_seeds, new BehaviorPumpkinDispenseItem()); BlockDispenser.dispenseBehaviorRegistry.putObject(Items.melon_seeds, new BehaviorMelonDispenseItem()); } } My Block Class: package com.ae.blocks; import com.ae.TileEntities.ChargerTE; import com.ae.main.AdvancedElectronics; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; public class Charger extends Block { public Charger() { super(Material.iron); this.setUnlocalizedName("Charger"); this.setCreativeTab(AdvancedElectronics.aeTab); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); TileEntity TE = worldIn.getTileEntity(pos); if(!playerIn.isSneaking()){ playerIn.openGui(AdvancedElectronics.instance, AdvancedElectronics.ChargerGUIID, worldIn, x, y, z); } return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new ChargerTE(); } } Tile Entity Class: (Extends a base class which holds the energy value and such) package com.ae.TileEntities; import com.ae.TileEntities.BaseClasses.EnergyChargerTE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; public class ChargerTE extends EnergyChargerTE implements ISidedInventory{ private ItemStack inv[]; public ChargerTE(){ inv = new ItemStack[4]; } @Override public void writeToNBT(NBTTagCompound nbt) { NBTTagList itemList = new NBTTagList(); for (int i = 0; i < inv.length; i++) { ItemStack stack = inv[i]; if (stack != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); stack.writeToNBT(tag); itemList.appendTag(tag); } } nbt.setTag("Inventory", itemList); super.writeToNBT(nbt); } @Override public void readFromNBT(NBTTagCompound nbt) { NBTTagList tagList = nbt.getTagList("Inventory", 10); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); byte slot = tag.getByte("Slot"); if (slot >= 0 && slot < inv.length) { inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } super.readFromNBT(nbt); } @Override public int getSizeInventory() { return inv.length; } @Override public ItemStack getStackInSlot(int index) { return inv[index]; } @Override public ItemStack decrStackSize(int index, int count) { ItemStack stack = getStackInSlot(index); if (stack != null) { if (stack.stackSize <= count) { setInventorySlotContents(index, null); } else { stack = stack.splitStack(count); if (stack.stackSize == 0) { setInventorySlotContents(index, null); } } } return stack; } @Override public ItemStack getStackInSlotOnClosing(int index) { ItemStack stack = getStackInSlot(index); if (stack != null) { setInventorySlotContents(index, null); } return stack; } @Override public void setInventorySlotContents(int index, ItemStack stack) { inv[index] = stack; if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return true; } @Override public void openInventory(EntityPlayer player) { } @Override public void closeInventory(EntityPlayer player) { } @Override public boolean isItemValidForSlot(int index, ItemStack stack) { return true; } @Override public int getField(int id) { return 0; } @Override public void setField(int id, int value) { } @Override public int getFieldCount() { return 0; } @Override public void clear() { } @Override public String getName() { return "Charger Inventory"; } @Override public boolean hasCustomName() { return true; } @Override public IChatComponent getDisplayName() { return null; } @Override public int[] getSlotsForFace(EnumFacing side) { return null; } @Override public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return false; } @Override public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { return false; } } Gui Handler: package com.ae.GUI; import com.ae.TileEntities.BaseClasses.EnergyChargerTE; import com.ae.main.AdvancedElectronics; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler{ @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if(ID == AdvancedElectronics.ChargerGUIID){ return new ContainerCharger(player.inventory, (EnergyChargerTE)te); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if(ID == AdvancedElectronics.ChargerGUIID){ return new GuiCharger(player.inventory, (EnergyChargerTE)te); } return null; } } Container: package com.ae.GUI; import com.ae.TileEntities.BaseClasses.EnergyChargerTE; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; public class ContainerCharger extends Container{ public ContainerCharger(InventoryPlayer inventory, EnergyChargerTE te) { } @Override public boolean canInteractWith(EntityPlayer playerIn) { return true; } } Gui Class: package com.ae.GUI; import com.ae.TileEntities.BaseClasses.EnergyChargerTE; import com.ae.main.AdvancedElectronics; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; public class GuiCharger extends GuiContainer{ private IInventory playerInv; private EnergyChargerTE te; private ResourceLocation texture = new ResourceLocation(AdvancedElectronics.MODID + ":textures/gui/charger.png"); public GuiCharger(InventoryPlayer inventory, EnergyChargerTE te) { super(new ContainerCharger(inventory, te)); this.playerInv = inventory; this.te = te; this.xSize = 176; this.ySize = 166; } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(texture); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); } } I know that there's a lot of classes there, but i am worried that this problem will cause bigger problems later. If any of you have the patience to look through everything and give me an answer, i will greatly appreciate it. Thank you for the time UPDATE: I just tried to add slots to the container and now the game crashes with another NullPointerException which i believe comes from the last error.
February 14, 20169 yr Author I mostly want to know if this is a problem of the build version of forge that i am running or i completely messed up. If it's a forge build problem then i have to upgrade right now. And it might be since it's been some time since i have created this project. However i don't want to make wrong statements, by saying that this is a forge problem. By any means i am not expert at this and i am requiring the help of some who know more about the programming language and Forge as a project in general.
February 14, 20169 yr Put a breakpoint on the line that the exception is thrown from (line 654 of NetHandlerPlayServer ) and run Minecraft in debug mode. When the breakpoint is hit, look at what's null and having a method called on it or a field access from it. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 15, 20169 yr Author This is what's written in line 654 of NetHandlerPlayServer: this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); This is what the debugger says: And this is the method in which the line 654 takes part in: /** * Processes block placement and block activation (anvil, furnace, etc.) */ public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); boolean flag = false; boolean placeResult = true; BlockPos blockpos = packetIn.getPosition(); EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); this.playerEntity.markPlayerActive(); if (packetIn.getPlacedBlockDirection() == 255) { if (itemstack == null) { return; } PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); if (event.useItem != Event.Result.DENY) { this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); } } else if (blockpos.getY() >= this.serverController.getBuildLimit() - 1 && (enumfacing == EnumFacing.UP || blockpos.getY() >= this.serverController.getBuildLimit())) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())}); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation)); flag = true; } else { double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; dist *= dist; if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) { // record block place result so we can update client itemstack size if place event was cancelled. placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); } flag = true; } if (flag) { this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing))); } itemstack = this.playerEntity.inventory.getCurrentItem(); if (itemstack != null && itemstack.stackSize == 0) { this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null; itemstack = null; } if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) { this.playerEntity.isChangingQuantityOnly = true; this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); this.playerEntity.openContainer.detectAndSendChanges(); this.playerEntity.isChangingQuantityOnly = false; if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled { this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); } } }
February 15, 20169 yr I'm not familiar with Eclipse's debugger. Does it not show the values of all current variables somewhere? Does it tell you the value of a variable if you mouseover it? IntelliJ IDEA's debugger looks like this: Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 15, 20169 yr Author Yes hovering over different variables does bring up soma values. The only value that it's null at the C08PacketPlayerBlockPlacement is the stack.
February 15, 20169 yr I don't understand what you mean, sorry. The only values that could cause this crash are this.playerEntity , this.playerEntity.openContainer , slot and this.playerEntity.inventory . Which of these is null ? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 15, 20169 yr Author None of them. I rechecked again. I had forgotten to register my tile entities. Even after i did. The console displays the same message but now i am able to add slots to the gui.
February 15, 20169 yr So it's definitely still throwing a NullPointerException on line 654 of NetHandlerPlayServer ? Does this happen directly after resuming from the breakpoint on this line when none of the values are null ? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 15, 20169 yr Author Sorry for the long response. I was at school. When i returned there was a problem with my building's electric system, so they had to work for about an hour. I just opened eclipse and ran the debugger again. I no longer get that error now ( for some reason ). I can add slots that belong to the player inventory. But when i try to add slots to my tile entity inventory, as soon as i try to open the gui, minecraft crashes with this error: ---- Minecraft Crash Report ---- // Don't be sad. I'll do better next time, I promise! Time: 16-02-15 7.55.MD Description: Ticking entity java.lang.NullPointerException: Ticking entity at net.minecraft.inventory.Slot.getStack(Slot.java:79) at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97) at com.ae.GUI.ContainerCharger.detectAndSendChanges(ContainerCharger.java:33) at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) at net.minecraft.world.World.updateEntity(World.java:1997) at net.minecraft.world.World.updateEntities(World.java:1823) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.inventory.Slot.getStack(Slot.java:79) at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97) at com.ae.GUI.ContainerCharger.detectAndSendChanges(ContainerCharger.java:33) at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) at net.minecraft.world.World.updateEntity(World.java:1997) -- Entity being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 335 Entity Name: Player671 Entity's Exact location: -14,62, 78,00, 161,56 Entity's Block location: -15,00,78,00,161,00 - World: (-15,78,161), Chunk: (at 1,4,1 in -1,10; contains blocks -16,0,160 to -1,255,175), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0,00, -0,08, 0,00 Entity's Rider: ~~ERROR~~ NullPointerException: null Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.updateEntities(World.java:1823) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) -- Affected level -- Details: Level name: TestWorld All players: 1 total; [EntityPlayerMP['Player671'/335, l='TestWorld', x=-14,62, y=78,00, z=161,56]] Chunk stats: ServerChunkCache: 767 Drop: 0 Level seed: 124857476866170520 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: -228,00,64,00,256,00 - World: (-228,64,256), Chunk: (at 12,4,0 in -15,16; contains blocks -240,0,256 to -225,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 74678 game time, 12560 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 75600 (now: false), thunder time: 679 (now: true) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) at java.lang.Thread.run(Unknown Source) -- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_66, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 737720064 bytes (703 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1450.jar) UCHIJAAAA Forge{11.14.3.1450} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1450.jar) UCHIJAAAA ae{1.0} [AdvancedElectronics] (bin) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 1 / 8; [EntityPlayerMP['Player671'/335, l='TestWorld', x=-14,62, y=78,00, z=161,56]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' The class of Tile Entity is on my original post.
February 15, 20169 yr The IInventory you passed to the Slot constructor is null . I suspect this is because you haven't overridden Block#hasTileEntity to return true , so your TileEntity isn't being created. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 16, 20169 yr Author Well i have overridden createTileEntity, shouldn't that create the tile-entity for that block? Anyway i overrided hasTileEntity but i am still getting the same problem.
February 16, 20169 yr Block#createTileEntity is only called if Block#hasTileEntity returns true . Upload your latest FML log and Block , Container and GuiContainer classes to Gist with syntax highlighting and link them here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 16, 20169 yr Author The Block Class: https://gist.github.com/anonymous/ecd39b293c6e9c3e1027 The Tile-Entity Class: https://gist.github.com/anonymous/4f25e127ff126602848b The Gui Handler Class: https://gist.github.com/anonymous/84ec07e27abbc9a45da9 The Container Class: https://gist.github.com/anonymous/9c57f12d747c4ca36c69 The Gui Class: https://gist.github.com/anonymous/ec53474e0863ac05351e The Main Mod Class: https://gist.github.com/anonymous/e1ce366d6f90bbc0f38e Latest Log: https://gist.github.com/anonymous/27bac0f0c47d6270ae40
February 16, 20169 yr Author To make this thing easier for later, i created a repository in github. You can check that out here: https://github.com/Cerandior/AdvancedElectronics
February 16, 20169 yr You've overridden the deprecated method Block#hasTileEntity() . This method is never called, so your TileEntity is never created. You need to override Block#hasTileEntity(IBlockState) instead. I would recommend creating a Git repository in the mod's root directory (where build.gradle and the src directory are) instead of in the src/main directory. IDE project files (e.g. Eclipse's .project file) don't need to be included in the repository, they can be generated by Gradle. The $ cat .gitignore line of your .gitignore isn't doing anything and shouldn't be in there, it's a command that prints the contents a file (.gitignore in this case). I assume you copied it from this tutorial by Jabelar, it looks like he just screwed up the formatting. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 16, 20169 yr Author Yes i just followed that tutorial. I am not experienced with git so i just went and did step by step what he said. As for the main problem. That serms convincing, i will try it when i get home
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.