Sooo...I am literally new to the world of modders, have been a constant mod user but never dived inside the programming of mods, until yesterday that I started a project-tutorial based on videos that, looking at these forums, seem to be quite "popular" since I've read about many complaining about them (may I be not completely an horrible programmer?).
This is also my first time ever typing in a forum, so please go easy on me. ?
Alright, gotta speak about the problem. Long story short, I've made a sort of furnace (which is called "electric" but still it is not), with the gui and I guess everything needed BUT once in game if I right-click on it to open the gui it doesn't work, and if I repeat that action for a couple times it actually crashes the game. Will ya give me some help understanding the problem? I almost copied (literally ctrl+c - ctrl+v) the classes that I saw too different, but still in the video works but in my game doesn't.
I'mma paste the error log and the files under here, hoping not to put anything in the wrong way.
Log:
[01:40:18] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:23] [pool-2-thread-1/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@5fc07f75[id=d566deca-6b21-32cb-af90-4edf09eeac2e,name=Player312,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?]
at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3181) [Minecraft.class:?]
at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
[01:40:25] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:41] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 4882ms behind, skipping 97 tick(s)
[01:40:41] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:43] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:43] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:43] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:44] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.NullPointerException
at com.luciusforking.techvariety.blocks.machines.ContainerElectricFurnace.<init>(ContainerElectricFurnace.java:23) ~[ContainerElectricFurnace.class:?]
at com.luciusforking.techvariety.util.handlers.GuiHandler.getServerGuiElement(GuiHandler.java:16) ~[GuiHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:253) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
at com.luciusforking.techvariety.blocks.machines.BlockElectricFurnace.onBlockActivated(BlockElectricFurnace.java:56) ~[BlockElectricFurnace.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:475) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:769) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
... 5 more
[01:40:46] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[01:40:46] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[01:41:27] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[01:41:27] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[01:41:27] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Player312 lost connection: Disconnected
[01:41:27] [Server thread/INFO] [minecraft/MinecraftServer]: Player312 left the game
[01:41:27] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Stopping singleplayer server as player logged out
[01:41:27] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[01:41:27] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[01:41:29] [Server thread/INFO] [FML]: Unloading dimension 0
[01:41:29] [Server thread/INFO] [FML]: Applying holder lookups
[01:41:29] [Server thread/INFO] [FML]: Holder lookups applied
[01:41:31] [main/INFO] [minecraft/Minecraft]: Stopping!
Block:
package com.luciusforking.techvariety.blocks.machines;
import java.util.Random;
import com.luciusforking.techvariety.Main;
import com.luciusforking.techvariety.blocks.BlockBase;
import com.luciusforking.techvariety.init.ModBlocks;
import com.luciusforking.techvariety.util.Reference;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockElectricFurnace extends BlockBase implements ITileEntityProvider{
public static final PropertyDirection FACING=BlockHorizontal.FACING;
public static final PropertyBool BURNING=PropertyBool.create("burning");
public BlockElectricFurnace(String name) {
super(name, Material.IRON);
setSoundType(SoundType.METAL);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(BURNING, false));
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(ModBlocks.ELECTRIC_FURNACE);
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return new ItemStack(ModBlocks.ELECTRIC_FURNACE);
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!worldIn.isRemote) {
playerIn.openGui(Main.instance, Reference.GUI_ELECTRIC_FURNACE, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
if(!worldIn.isRemote) {
IBlockState north=worldIn.getBlockState(pos.north());
IBlockState south=worldIn.getBlockState(pos.south());
IBlockState west=worldIn.getBlockState(pos.west());
IBlockState east=worldIn.getBlockState(pos.east());
EnumFacing face=(EnumFacing)state.getValue(FACING);
if(face==EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) face =EnumFacing.SOUTH;
else if(face==EnumFacing.SOUTH && !north.isFullBlock() && south.isFullBlock()) face =EnumFacing.NORTH;
else if(face==EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) face =EnumFacing.EAST;
else if(face==EnumFacing.EAST && !west.isFullBlock() && east.isFullBlock()) face =EnumFacing.WEST;
worldIn.setBlockState(pos, state.withProperty(FACING, face), 2);
}
}
public static void setState(boolean active, World worldIn, BlockPos pos) {
IBlockState state=worldIn.getBlockState(pos);
TileEntity tileEntity=worldIn.getTileEntity(pos);
if(active) worldIn.setBlockState(pos, ModBlocks.ELECTRIC_FURNACE.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(BURNING, true), 3);
else worldIn.setBlockState(pos, ModBlocks.ELECTRIC_FURNACE.getDefaultState().withProperty(FACING, state.getValue(FACING)).withProperty(BURNING, false), 3);
if(tileEntity != null) {
tileEntity.validate();
worldIn.setTileEntity(pos, tileEntity);
}
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileEntityElectricFurnace();
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
worldIn.setBlockState(pos, this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
}
@Override
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
@Override
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {BURNING, FACING});
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing=EnumFacing.getFront(meta);
if(facing.getAxis()==EnumFacing.Axis.Y) facing=EnumFacing.NORTH;
return this.getDefaultState().withProperty(FACING, facing);
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing)state.getValue(FACING)).getIndex();
}
}
TileEntity:
package com.luciusforking.techvariety.blocks.machines;
import com.luciusforking.techvariety.init.ModBlocks;
import com.luciusforking.techvariety.init.ModItems;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.ItemStackHandler;
public class TileEntityElectricFurnace extends TileEntity implements ITickable
{
private ItemStackHandler handler = new ItemStackHandler(4);
private String customName;
private ItemStack smelting = ItemStack.EMPTY;
private int burnTime;
private int currentBurnTime;
private int cookTime;
private int totalCookTime = 200;
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return true;
else return false;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) this.handler;
return super.getCapability(capability, facing);
}
public boolean hasCustomName()
{
return this.customName != null && !this.customName.isEmpty();
}
public void setCustomName(String customName)
{
this.customName = customName;
}
@Override
public ITextComponent getDisplayName()
{
return this.hasCustomName() ? new TextComponentString(this.customName) : new TextComponentTranslation("container.sintering_furnace");
}
@Override
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.handler.deserializeNBT(compound.getCompoundTag("Inventory"));
this.burnTime = compound.getInteger("BurnTime");
this.cookTime = compound.getInteger("CookTime");
this.totalCookTime = compound.getInteger("CookTimeTotal");
this.currentBurnTime = getItemBurnTime((ItemStack)this.handler.getStackInSlot(2));
if(compound.hasKey("CustomName", 8)) this.setCustomName(compound.getString("CustomName"));
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setInteger("BurnTime", (short)this.burnTime);
compound.setInteger("CookTime", (short)this.cookTime);
compound.setInteger("CookTimeTotal", (short)this.totalCookTime);
compound.setTag("Inventory", this.handler.serializeNBT());
if(this.hasCustomName()) compound.setString("CustomName", this.customName);
return compound;
}
public boolean isBurning()
{
return this.burnTime > 0;
}
@SideOnly(Side.CLIENT)
public static boolean isBurning(TileEntityElectricFurnace te)
{
return te.getField(0) > 0;
}
public void update()
{
if(this.isBurning())
{
--this.burnTime;
BlockElectricFurnace.setState(true, world, pos);
}
ItemStack[] inputs = new ItemStack[] {handler.getStackInSlot(0), handler.getStackInSlot(1)};
ItemStack fuel = this.handler.getStackInSlot(2);
if(this.isBurning() || !fuel.isEmpty() && !this.handler.getStackInSlot(0).isEmpty() || this.handler.getStackInSlot(1).isEmpty())
{
if(!this.isBurning() && this.canSmelt())
{
this.burnTime = getItemBurnTime(fuel);
this.currentBurnTime = burnTime;
if(this.isBurning() && !fuel.isEmpty())
{
Item item = fuel.getItem();
fuel.shrink(1);
if(fuel.isEmpty())
{
ItemStack item1 = item.getContainerItem(fuel);
this.handler.setStackInSlot(2, item1);
}
}
}
}
if(this.isBurning() && this.canSmelt() && cookTime > 0)
{
cookTime++;
if(cookTime == totalCookTime)
{
if(handler.getStackInSlot(3).getCount() > 0)
{
handler.getStackInSlot(3).grow(1);
}
else
{
handler.insertItem(3, smelting, false);
}
smelting = ItemStack.EMPTY;
cookTime = 0;
return;
}
}
else
{
if(this.canSmelt() && this.isBurning())
{
ItemStack output = ElectricFurnaceRecipes.getInstance().getResult(inputs[0], inputs[1]);
if(!output.isEmpty())
{
smelting = output;
cookTime++;
inputs[0].shrink(1);
inputs[1].shrink(1);
handler.setStackInSlot(0, inputs[0]);
handler.setStackInSlot(1, inputs[1]);
}
}
}
}
private boolean canSmelt()
{
if(((ItemStack)this.handler.getStackInSlot(0)).isEmpty() || ((ItemStack)this.handler.getStackInSlot(1)).isEmpty()) return false;
else
{
ItemStack result = ElectricFurnaceRecipes.getInstance().getResult((ItemStack)this.handler.getStackInSlot(0), (ItemStack)this.handler.getStackInSlot(1));
if(result.isEmpty()) return false;
else
{
ItemStack output = (ItemStack)this.handler.getStackInSlot(3);
if(output.isEmpty()) return true;
if(!output.isItemEqual(result)) return false;
int res = output.getCount() + result.getCount();
return res <= 64 && res <= output.getMaxStackSize();
}
}
}
public static int getItemBurnTime(ItemStack fuel) {
if(fuel.isEmpty()) return 0;
else {
Item item=fuel.getItem();
if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
Block block=Block.getBlockFromItem(item);
if(block==ModBlocks.RUBY_BLOCK) return 32000;
}
if(item == ModItems.RUBY) return 3200;
if(item == Items.BLAZE_ROD) return 2400;
return 0;
}
}
public static boolean isItemFuel(ItemStack fuel)
{
return getItemBurnTime(fuel) > 0;
}
public boolean isUsableByPlayer(EntityPlayer player)
{
return this.world.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}
public int getField(int id)
{
switch(id)
{
case 0:
return this.burnTime;
case 1:
return this.currentBurnTime;
case 2:
return this.cookTime;
case 3:
return this.totalCookTime;
default:
return 0;
}
}
public void setField(int id, int value)
{
switch(id)
{
case 0:
this.burnTime = value;
break;
case 1:
this.currentBurnTime = value;
break;
case 2:
this.cookTime = value;
break;
case 3:
this.totalCookTime = value;
}
}
}
Container:
package com.luciusforking.techvariety.blocks.machines;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;
public class ContainerElectricFurnace extends Container
{
private final TileEntityElectricFurnace tileentity;
private int cookTime, totalCookTime, burnTime, currentBurnTime;
public ContainerElectricFurnace(InventoryPlayer player, TileEntityElectricFurnace tileentity)
{
this.tileentity = tileentity;
IItemHandler handler = tileentity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
this.addSlotToContainer(new SlotItemHandler(handler, 0, 25, 10));
this.addSlotToContainer(new SlotItemHandler(handler, 1, 53, 10));
this.addSlotToContainer(new SlotItemHandler(handler, 2, 39, 39));
this.addSlotToContainer(new SlotItemHandler(handler, 3, 102, 25));
for(int y = 0; y < 3; y++)
{
for(int x = 0; x < 9; x++)
{
this.addSlotToContainer(new Slot(player, x + y*9 + 9, 8 + x*18, 84 + y*18));
}
}
for(int x = 0; x < 9; x++)
{
this.addSlotToContainer(new Slot(player, x, 8 + x * 18, 142));
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for(int i = 0; i < this.listeners.size(); ++i)
{
IContainerListener listener = (IContainerListener)this.listeners.get(i);
if(this.cookTime != this.tileentity.getField(2)) listener.sendWindowProperty(this, 2, this.tileentity.getField(2));
if(this.burnTime != this.tileentity.getField(0)) listener.sendWindowProperty(this, 0, this.tileentity.getField(0));
if(this.currentBurnTime != this.tileentity.getField(1)) listener.sendWindowProperty(this, 1, this.tileentity.getField(1));
if(this.totalCookTime != this.tileentity.getField(3)) listener.sendWindowProperty(this, 3, this.tileentity.getField(3));
}
this.cookTime = this.tileentity.getField(2);
this.burnTime = this.tileentity.getField(0);
this.currentBurnTime = this.tileentity.getField(1);
this.totalCookTime = this.tileentity.getField(3);
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int id, int data)
{
this.tileentity.setField(id, data);
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileentity.isUsableByPlayer(playerIn);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
ItemStack stack = ItemStack.EMPTY;
Slot slot = (Slot)this.inventorySlots.get(index);
if(slot != null && slot.getHasStack())
{
ItemStack stack1 = slot.getStack();
stack = stack1.copy();
if(index == 3)
{
if(!this.mergeItemStack(stack1, 4, 40, true)) return ItemStack.EMPTY;
slot.onSlotChange(stack1, stack);
}
else if(index != 2 && index != 1 && index != 0)
{
Slot slot1 = (Slot)this.inventorySlots.get(index + 1);
if(!ElectricFurnaceRecipes.getInstance().getResult(stack1, slot1.getStack()).isEmpty())
{
if(!this.mergeItemStack(stack1, 0, 2, false))
{
return ItemStack.EMPTY;
}
else if(TileEntityElectricFurnace.isItemFuel(stack1))
{
if(!this.mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
}
else if(TileEntityElectricFurnace.isItemFuel(stack1))
{
if(!this.mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
}
else if(TileEntityElectricFurnace.isItemFuel(stack1))
{
if(!this.mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
}
else if(index >= 4 && index < 31)
{
if(!this.mergeItemStack(stack1, 31, 40, false)) return ItemStack.EMPTY;
}
else if(index >= 31 && index < 40 && !this.mergeItemStack(stack1, 4, 31, false))
{
return ItemStack.EMPTY;
}
}
}
else if(!this.mergeItemStack(stack1, 4, 40, false))
{
return ItemStack.EMPTY;
}
if(stack1.isEmpty())
{
slot.putStack(ItemStack.EMPTY);
}
else
{
slot.onSlotChanged();
}
if(stack1.getCount() == stack.getCount()) return ItemStack.EMPTY;
slot.onTake(playerIn, stack1);
}
return stack;
}
}
And for last, Gui:
package com.luciusforking.techvariety.blocks.machines;
import com.luciusforking.techvariety.util.Reference;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GuiElectricFurnace extends GuiContainer{
private static final ResourceLocation TEXTURES=new ResourceLocation(Reference.MOD_ID+":textures/gui/electric_furnace.png");
private final InventoryPlayer player;
private final TileEntityElectricFurnace tileEntity;
public GuiElectricFurnace(InventoryPlayer player, TileEntityElectricFurnace tileEntity) {
super(new ContainerElectricFurnace(player, tileEntity));
this.player=player;
this.tileEntity=tileEntity;
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String tileName=this.tileEntity.getDisplayName().getUnformattedText();
this.fontRenderer.drawString(tileName, (this.xSize/2 - this.fontRenderer.getStringWidth(tileName)/2) + 3, 8, 4210752);
this.fontRenderer.drawString(this.player.getDisplayName().getUnformattedText(), 122, this.ySize-96+2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0f, 1.0f, 1.0f);
this.mc.getTextureManager().bindTexture(TEXTURES);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
if(TileEntityElectricFurnace.isBurning(tileEntity)){
int k=this.getBurnLeftScaled(13);
this.drawTexturedModalRect(this.guiLeft+37, this.guiTop+22+12-k, 132, 12-k, 14, k+1);
}
int l=this.getCookProgressionScaled(25);
this.drawTexturedModalRect(this.guiLeft+65, this.guiTop+19+25, 132, 14, l+1, 16);
}
private int getBurnLeftScaled(int pixels) {
int i= this.tileEntity.getField(1);
if(i==0) i=200;
return this.tileEntity.getField(0)*pixels/i;
}
private int getCookProgressionScaled(int pixels) {
int i=this.tileEntity.getField(2);
int j=this.tileEntity.getField(3);
return j!=0 && i!=0 ? i*pixels/j:0;
}
}
Thank you a lot for your time, and sorry again for the mess that I may have done, from which I seem to not be able to escape. ?