Posted November 21, 20195 yr I am so close to creating a custom furnace block but I ran into this error: [32m[12:36:44] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [m[32m[12:36:44] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 010'/minecraft:overworld [m[1;31m[12:36:44] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.RuntimeException: class com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:72) ~[?:?] {re:classloading} at net.minecraft.tileentity.TileEntity.write(TileEntity.java:66) ~[?:?] {re:classloading} at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:444) ~[?:?] {re:classloading} at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] {re:classloading} at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:677) ~[?:?] {re:classloading} at net.minecraft.world.server.ChunkManager.lambda$save$9(ChunkManager.java:352) ~[?:?] {re:classloading} at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.Iterator.forEachRemaining(Unknown Source) [?:1.8.0_201] {} at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_201] {} at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:349) [?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:309) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:770) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:528) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:113) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {} [m[36m[12:36:45] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 010 [m[32m[12:36:51] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected [m[32m[12:36:51] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game [m[32m[12:36:51] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Stopping singleplayer server as player logged out [m[32m[12:36:51] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [m[32m[12:36:51] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [m[32m[12:36:51] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [m[32m[12:36:51] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 010'/minecraft:overworld [m[1;31m[12:36:51] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.RuntimeException: class com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:72) ~[?:?] {re:classloading} at net.minecraft.tileentity.TileEntity.write(TileEntity.java:66) ~[?:?] {re:classloading} at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:444) ~[?:?] {re:classloading} at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] {re:classloading} at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:677) ~[?:?] {re:classloading} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_201] {} at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:336) [?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:309) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:770) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:528) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:571) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:235) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:685) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {} [m[32m[12:36:51] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 010): All chunks are saved [m[36m[12:36:51] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 010 [m[32m[12:36:51] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 010): All chunks are saved [m[32m[12:36:52] [Client thread/INFO] [minecraft/Minecraft]: Stopping! [m It does not link me to any specific line of code I created so I can't find what went wrong. Can someone please help me find out what I might be missing? package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import javax.annotation.Nullable; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; public class CabinFurnaceTileEntity extends TileEntity implements INamedContainerProvider { public CabinFurnaceTileEntity() { super(BlockList.cabin_furnace_tile_entity); } @Nullable @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new CabinFurnaceContainer(p_createMenu_1_, world, pos, p_createMenu_2_, p_createMenu_3_); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("cabinfurnace"); } }
November 21, 20195 yr Author Problem is I did register them: @SubscribeEvent public static void registerTileEntities (final RegistryEvent.Register<TileEntityType<?>> event) { event.getRegistry().register(TileEntityType.Builder.create(CabinFurnaceTileEntity::new, BlockList.cabin_furnace).build(null).setRegistryName("cabin_furnace")); }
November 21, 20195 yr Author 4 minutes ago, diesieben07 said: Where do you set this field? package com.log_cabin_blocks.objects.blocks; import com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceContainer; import com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity; import net.minecraft.block.Block; import net.minecraft.inventory.container.ContainerType; import net.minecraft.tileentity.TileEntityType; public class BlockList { public static Block oak_log_wall_type_0; public static Block oak_log_wall_type_1; public static Block oak_log_corner; public static Block oak_cabin_door; public static Block oak_window_frame; public static Block water_pump; public static Block cabin_furnace; public static TileEntityType<CabinFurnaceTileEntity> cabin_furnace_tile_entity; public static ContainerType<CabinFurnaceContainer> cabin_furnace_container; } I placed it in the blockslist class... Saw someone else do that in their mod. Edited November 21, 20195 yr by Kenneth201998
November 21, 20195 yr Author 5 minutes ago, diesieben07 said: Is the method called? Use the debugger. And yes the method is called.
November 21, 20195 yr Author Just now, diesieben07 said: That does not answer my question. what do you mean by: 6 minutes ago, diesieben07 said: Where do you set this field? then? Edited November 21, 20195 yr by Kenneth201998
November 21, 20195 yr Author 2 minutes ago, diesieben07 said: I mean where do you set the field's value. Now that you ask, I don't think I did. I placed the field without a set value in my blockslist class. Do you know what the set value might look like? I posted the blocklist class in one of the replies above. Edited November 21, 20195 yr by Kenneth201998
November 21, 20195 yr Author I have tried: package com.log_cabin_blocks.objects.blocks; import com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceContainer; import com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity; import net.minecraft.block.Block; import net.minecraft.inventory.container.ContainerType; import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.registries.ObjectHolder; public class BlockList { public static Block oak_log_wall_type_0; public static Block oak_log_wall_type_1; public static Block oak_log_corner; public static Block oak_cabin_door; public static Block oak_window_frame; public static Block water_pump; @ObjectHolder("lcb:cabin_furnace") public static Block cabin_furnace; @ObjectHolder("lcb:cabin_furnace") public static TileEntityType<CabinFurnaceTileEntity> cabin_furnace_tile_entity; @ObjectHolder("lcb:cabin_furnace") public static ContainerType<CabinFurnaceContainer> cabin_furnace_container; } but now nothing happens when I right click on the block Can you show me what setting the tile entity type would look like?
November 21, 20195 yr Author 11 minutes ago, diesieben07 said: If your mod ID really is lcb you need to change it immediately. Mod IDs need to be unique. "lcb" is not unique. Show your right click code. I originally had: @Override public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { player.openContainer(state.getContainer(worldIn, pos)); return true; } but then changed it to: @Override public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { TileEntity te = worldIn.getTileEntity(pos); if(te instanceof CabinFurnaceTileEntity) { player.openContainer((INamedContainerProvider) te); } return true; } But now get a new error: [m[1;31m[13:49:12] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.RuntimeException: Slot 1 not in valid range - [0,1) at net.minecraftforge.items.ItemStackHandler.validateSlotIndex(ItemStackHandler.java:217) ~[?:?] {re:classloading} at net.minecraftforge.items.ItemStackHandler.getStackInSlot(ItemStackHandler.java:73) ~[?:?] {re:classloading} at net.minecraftforge.items.SlotItemHandler.getStack(SlotItemHandler.java:54) ~[?:?] {re:classloading} at net.minecraft.inventory.container.Container.getInventory(Container.java:117) ~[?:?] {re:classloading} at net.minecraft.inventory.container.Container.addListener(Container.java:97) ~[?:?] {re:classloading} at net.minecraft.entity.player.ServerPlayerEntity.openContainer(ServerPlayerEntity.java:866) ~[?:?] {re:classloading,pl:accesstransformer:B} at com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnace.onBlockActivated(CabinFurnace.java:64) ~[?:?] {re:classloading} at net.minecraft.block.BlockState.onBlockActivated(BlockState.java:296) ~[?:?] {re:classloading} at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:332) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:870) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:42) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:726) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:720) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:705) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:650) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {} [m[1;31m[13:49:12] [Client thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client java.lang.NullPointerException: null at com.log_cabin_blocks.LogCabinBlocks$RegistryEvents.lambda$1(LogCabinBlocks.java:108) ~[main/:?] {re:classloading} at net.minecraftforge.fml.network.IContainerFactory.create(IContainerFactory.java:34) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.inventory.container.ContainerType.create(ContainerType.java:46) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.gui.ScreenManager$IScreenFactory.createScreen(ScreenManager.java:113) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.ScreenManager.lambda$openScreen$0(ScreenManager.java:42) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.util.Optional.ifPresent(Unknown Source) ~[?:1.8.0_201] {} at net.minecraft.client.gui.ScreenManager.openScreen(ScreenManager.java:42) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.network.play.ClientPlayNetHandler.func_217272_a(ClientPlayNetHandler.java:1094) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.network.play.server.SOpenWindowPacket.processPacket(SOpenWindowPacket.java:47) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.network.play.server.SOpenWindowPacket.processPacket(SOpenWindowPacket.java:14) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:896) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] {} at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] {} at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.70_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {} [m[32m[13:49:13] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [m[32m[13:49:13] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 014'/minecraft:overworld [m[36m[13:49:14] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 014 [m[32m[13:49:14] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected [m[32m[13:49:14] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game [m[32m[13:49:14] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Stopping singleplayer server as player logged out [m[32m[13:49:14] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [m[32m[13:49:14] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [m[32m[13:49:14] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [m[32m[13:49:14] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 014'/minecraft:overworld [m[32m[13:49:15] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 014): All chunks are saved [m[36m[13:49:15] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 014 [m[32m[13:49:15] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 014): All chunks are saved [m[32m[13:49:37] [Client thread/INFO] [minecraft/Minecraft]: Stopping! [m Edited November 21, 20195 yr by Kenneth201998
November 21, 20195 yr Author Here is also the code to the tile entity: package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class CabinFurnaceTileEntity extends TileEntity implements INamedContainerProvider { private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); @SuppressWarnings("unchecked") @Override public void read(CompoundNBT tag) { CompoundNBT invTag = tag.getCompound("inv"); handler.ifPresent(h -> ((INBTSerializable<CompoundNBT>)h).deserializeNBT(invTag)); super.read(tag); } @SuppressWarnings("unchecked") @Override public CompoundNBT write(CompoundNBT tag) { handler.ifPresent(h -> { CompoundNBT compound = ((INBTSerializable<CompoundNBT>)h).serializeNBT(); tag.put("inv", compound); }); return super.write(tag); } public CabinFurnaceTileEntity() { super(BlockList.cabin_furnace_tile_entity); } private IItemHandler createHandler () { return new ItemStackHandler(1) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { return stack; } }; } @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Nullable @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new CabinFurnaceContainer(p_createMenu_1_, world, pos, p_createMenu_2_, p_createMenu_3_); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("cabinfurnace"); } } which I based off the code here: https://github.com/McJty/YouTubeModding14/blob/master/src/main/java/com/mcjty/mytutorial/blocks/FirstBlockTile.java
November 21, 20195 yr Author Ok, so I made some changes. Here is the code as of now for the tile entity and the container: package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class CabinFurnaceTileEntity extends TileEntity implements INamedContainerProvider { private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); @SuppressWarnings("unchecked") @Override public void read(CompoundNBT tag) { CompoundNBT invTag = tag.getCompound("inv"); handler.ifPresent(h -> ((INBTSerializable<CompoundNBT>) h).deserializeNBT(invTag)); super.read(tag); } @SuppressWarnings("unchecked") @Override public CompoundNBT write(CompoundNBT tag) { handler.ifPresent(h -> { CompoundNBT compound = ((INBTSerializable<CompoundNBT>) h).serializeNBT(); tag.put("inv", compound); }); return super.write(tag); } public CabinFurnaceTileEntity() { super(BlockList.cabin_furnace_tile_entity); } private IItemHandler createHandler() { return new ItemStackHandler(3) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { if(slot != 2) { return true; } else { return false; } } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { return stack; } }; } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Nullable @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new CabinFurnaceContainer(p_createMenu_1_, world, pos, p_createMenu_2_, p_createMenu_3_); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("cabinfurnace"); } } package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.SlotItemHandler; public class CabinFurnaceContainer extends Container { private TileEntity tile_entity; public CabinFurnaceContainer(int id, World world, BlockPos pos, PlayerInventory player_inventory, PlayerEntity player) { super(BlockList.cabin_furnace_container, id); this.tile_entity = world.getTileEntity(pos); this.tile_entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { this.addSlot(new SlotItemHandler(h, 0, 26, 21)); this.addSlot(new SlotItemHandler(h, 1, 26, 48)); this.addSlot(new SlotItemHandler(h, 2, 80, 35)); }); int si; int sj; for (si = 0; si < 3; ++si) { for (sj = 0; sj < 9; ++sj) { this.addSlot(new Slot(player_inventory, sj + (si + 1) * 9, 0 + 8 + sj * 18, 0 + 84 + si * 18)); } } for (si = 0; si < 9; ++si) { this.addSlot(new Slot(player_inventory, si, 0 + 8 + si * 18, 0 + 142)); } } @Override public boolean canInteractWith(PlayerEntity playerIn) { return true; } @Override public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = (Slot) this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < 3) { if (!this.mergeItemStack(itemstack1, 3, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (!this.mergeItemStack(itemstack1, 0, 3, false)) { if (index < 3 + 27) { if (!this.mergeItemStack(itemstack1, 3 + 27, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else { if (!this.mergeItemStack(itemstack1, 3, 3 + 27, false)) { return ItemStack.EMPTY; } } return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) { boolean flag = false; int i = startIndex; if (reverseDirection) { i = endIndex - 1; } if (stack.isStackable()) { while (!stack.isEmpty()) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot = this.inventorySlots.get(i); ItemStack itemstack = slot.getStack(); if (slot.isItemValid(itemstack) && !itemstack.isEmpty() && areItemsAndTagsEqual(stack, itemstack)) { int j = itemstack.getCount() + stack.getCount(); int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize()); if (j <= maxSize) { stack.setCount(0); itemstack.setCount(j); slot.putStack(itemstack); flag = true; } else if (itemstack.getCount() < maxSize) { stack.shrink(maxSize - itemstack.getCount()); itemstack.setCount(maxSize); slot.putStack(itemstack); flag = true; } } if (reverseDirection) { --i; } else { ++i; } } } if (!stack.isEmpty()) { if (reverseDirection) { i = endIndex - 1; } else { i = startIndex; } while (true) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot1 = this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); if (itemstack1.isEmpty() && slot1.isItemValid(stack)) { if (stack.getCount() > slot1.getSlotStackLimit()) { slot1.putStack(stack.split(slot1.getSlotStackLimit())); } else { slot1.putStack(stack.split(stack.getCount())); } slot1.onSlotChanged(); flag = true; break; } if (reverseDirection) { --i; } else { ++i; } } } return flag; } @Override public void onContainerClosed(PlayerEntity playerIn) { super.onContainerClosed(playerIn); } } The block GUI now opens. But the only way I can put item stacks in the first two slots is by shift clicking them. Any fixes?
November 21, 20195 yr Author 7 minutes ago, Kenneth201998 said: Ok, so I made some changes. Here is the code as of now for the tile entity and the container: package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class CabinFurnaceTileEntity extends TileEntity implements INamedContainerProvider { private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); @SuppressWarnings("unchecked") @Override public void read(CompoundNBT tag) { CompoundNBT invTag = tag.getCompound("inv"); handler.ifPresent(h -> ((INBTSerializable<CompoundNBT>) h).deserializeNBT(invTag)); super.read(tag); } @SuppressWarnings("unchecked") @Override public CompoundNBT write(CompoundNBT tag) { handler.ifPresent(h -> { CompoundNBT compound = ((INBTSerializable<CompoundNBT>) h).serializeNBT(); tag.put("inv", compound); }); return super.write(tag); } public CabinFurnaceTileEntity() { super(BlockList.cabin_furnace_tile_entity); } private IItemHandler createHandler() { return new ItemStackHandler(3) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { if(slot != 2) { return true; } else { return false; } } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { return stack; } }; } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Nullable @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new CabinFurnaceContainer(p_createMenu_1_, world, pos, p_createMenu_2_, p_createMenu_3_); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("cabinfurnace"); } } package com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.SlotItemHandler; public class CabinFurnaceContainer extends Container { private TileEntity tile_entity; public CabinFurnaceContainer(int id, World world, BlockPos pos, PlayerInventory player_inventory, PlayerEntity player) { super(BlockList.cabin_furnace_container, id); this.tile_entity = world.getTileEntity(pos); this.tile_entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { this.addSlot(new SlotItemHandler(h, 0, 26, 21)); this.addSlot(new SlotItemHandler(h, 1, 26, 48)); this.addSlot(new SlotItemHandler(h, 2, 80, 35)); }); int si; int sj; for (si = 0; si < 3; ++si) { for (sj = 0; sj < 9; ++sj) { this.addSlot(new Slot(player_inventory, sj + (si + 1) * 9, 0 + 8 + sj * 18, 0 + 84 + si * 18)); } } for (si = 0; si < 9; ++si) { this.addSlot(new Slot(player_inventory, si, 0 + 8 + si * 18, 0 + 142)); } } @Override public boolean canInteractWith(PlayerEntity playerIn) { return true; } @Override public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = (Slot) this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < 3) { if (!this.mergeItemStack(itemstack1, 3, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (!this.mergeItemStack(itemstack1, 0, 3, false)) { if (index < 3 + 27) { if (!this.mergeItemStack(itemstack1, 3 + 27, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else { if (!this.mergeItemStack(itemstack1, 3, 3 + 27, false)) { return ItemStack.EMPTY; } } return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) { boolean flag = false; int i = startIndex; if (reverseDirection) { i = endIndex - 1; } if (stack.isStackable()) { while (!stack.isEmpty()) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot = this.inventorySlots.get(i); ItemStack itemstack = slot.getStack(); if (slot.isItemValid(itemstack) && !itemstack.isEmpty() && areItemsAndTagsEqual(stack, itemstack)) { int j = itemstack.getCount() + stack.getCount(); int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize()); if (j <= maxSize) { stack.setCount(0); itemstack.setCount(j); slot.putStack(itemstack); flag = true; } else if (itemstack.getCount() < maxSize) { stack.shrink(maxSize - itemstack.getCount()); itemstack.setCount(maxSize); slot.putStack(itemstack); flag = true; } } if (reverseDirection) { --i; } else { ++i; } } } if (!stack.isEmpty()) { if (reverseDirection) { i = endIndex - 1; } else { i = startIndex; } while (true) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot1 = this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); if (itemstack1.isEmpty() && slot1.isItemValid(stack)) { if (stack.getCount() > slot1.getSlotStackLimit()) { slot1.putStack(stack.split(slot1.getSlotStackLimit())); } else { slot1.putStack(stack.split(stack.getCount())); } slot1.onSlotChanged(); flag = true; break; } if (reverseDirection) { --i; } else { ++i; } } } return flag; } @Override public void onContainerClosed(PlayerEntity playerIn) { super.onContainerClosed(playerIn); } } The block GUI now opens. But the only way I can put item stacks in the first two slots is by shift clicking them. Any fixes? Edit: Changed code in Tile entity insert item to : @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { return super.insertItem(slot, stack, simulate); } and that seemed to fix it.
November 21, 20195 yr 20 minutes ago, Kenneth201998 said: and that seemed to fix it. Why are you overriding a function that you do nothing but call the existing implementation? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 22, 20195 yr Author Made major changes: Here is the tile entity: package com.log_cabin_blocks.objects.blocks.workstations.furnace_station; import com.log_cabin_blocks.LogCabinBlocks; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class FurnaceStationTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider { protected ItemStackHandler slots = new ItemStackHandler(); private final LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots); public FurnaceStationTileEntity() { super(BlockList.cabin_furnace_tile_entity); slots = new ItemStackHandler(); slots.setSize(3); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return slots_holder.cast(); } return super.getCapability(cap, side); } @Override public void read(CompoundNBT tag) { super.read(tag); slots.deserializeNBT(tag.getCompound("kenmodlcb:slots")); } @Override public CompoundNBT write(CompoundNBT tag) { super.write(tag); tag.put("kenmodlcb:slots", slots.serializeNBT()); return tag; } @Override public void tick() { LogCabinBlocks.debugString("TEST"); } @Override public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) { return new FurnaceStationContainer(id, player_inventory, slots, this); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("furnacestation"); } public void openGUI (ServerPlayerEntity player) { if(!world.isRemote) { NetworkHooks.openGui(player, this, getPos()); } } } But it still gives the missing mapping error: [1;31m[16:13:32] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraft.crash.ReportedException: Ticking block entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:869) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {} Caused by: java.lang.NullPointerException at net.minecraft.world.World.func_217391_K(World.java:670) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:370) ~[?:?] {re:classloading} at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) ~[?:?] {re:classloading,pl:accesstransformer:B} ... 4 more [m[1;31m[16:13:32] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\carri\OneDrive\Desktop\Forge Mods\11_54 AM 11_19_2019\Log_Cabin_Blocks\run\.\crash-reports\crash-2019-11-22_16.13.32-server.txt [m[32m[16:13:32] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [m[32m[16:13:32] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [m[32m[16:13:32] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected [m[32m[16:13:32] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game [m[32m[16:13:32] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Stopping singleplayer server as player logged out [m[32m[16:13:32] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [m[32m[16:13:32] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 033'/minecraft:overworld [m[1;31m[16:13:32] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStationTileEntity has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.RuntimeException: class com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStationTileEntity is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:72) ~[?:?] {re:classloading} at net.minecraft.tileentity.TileEntity.write(TileEntity.java:66) ~[?:?] {re:classloading} at com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStationTileEntity.write(FurnaceStationTileEntity.java:50) ~[?:?] {re:classloading} at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:444) ~[?:?] {re:classloading} at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] {re:classloading} at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:677) ~[?:?] {re:classloading} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:1.8.0_201] {} at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_201] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_201] {} at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_201] {} at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:336) [?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:309) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:770) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:528) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:571) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:235) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:685) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {} [m[32m[16:13:33] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 033): All chunks are saved [m[36m[16:13:33] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 033 [m[32m[16:13:33] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 033): All chunks are saved [m It crashes at the exact same time I place the block. Any fixes?
November 22, 20195 yr Author package com.log_cabin_blocks; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.log_cabin_blocks.objects.blocks.BlockList; import com.log_cabin_blocks.objects.blocks.doors.KenmodDoorBase; import com.log_cabin_blocks.objects.blocks.utility_blocks.water_utility_blocks.WaterPump; import com.log_cabin_blocks.objects.blocks.walls.LogWall; import com.log_cabin_blocks.objects.blocks.walls.LogWallCorner; import com.log_cabin_blocks.objects.blocks.window_frames.WindowFrame; import com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStation; import com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStationContainer; import com.log_cabin_blocks.objects.blocks.workstations.furnace_station.FurnaceStationTileEntity; import com.log_cabin_blocks.objects.items.ItemList; import com.log_cabin_blocks.proxy.ClientProxy; import com.log_cabin_blocks.proxy.IProxy; import com.log_cabin_blocks.proxy.ServerProxy; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.inventory.container.ContainerType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolType; import net.minecraftforge.common.extensions.IForgeContainerType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.network.NetworkRegistry; import net.minecraftforge.fml.network.simple.SimpleChannel; @Mod("kenmodlcb") public class LogCabinBlocks { public static LogCabinBlocks instance; public static final String modid = "kenmodlcb"; private static final Logger logger = LogManager.getLogger(modid); private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel PACKET_HANDLER = NetworkRegistry.newSimpleChannel(new ResourceLocation("kenmod", "kenmod"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals); public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy()); public LogCabinBlocks () { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); MinecraftForge.EVENT_BUS.register(this); } private void setup (final FMLCommonSetupEvent event) { proxy.init(); debugString("Settup method registered..."); } private void clientRegistries (final FMLClientSetupEvent event) { debugString("Client registries method registered..."); } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( ItemList.oak_log_wall_type_0 = new BlockItem(BlockList.oak_log_wall_type_0, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.oak_log_wall_type_0.getRegistryName()), ItemList.oak_log_wall_type_1 = new BlockItem(BlockList.oak_log_wall_type_1, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.oak_log_wall_type_1.getRegistryName()), ItemList.oak_log_wall_corner = new BlockItem(BlockList.oak_log_corner, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.oak_log_corner.getRegistryName()), ItemList.oak_cabin_door = new BlockItem(BlockList.oak_cabin_door, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.oak_cabin_door.getRegistryName()), ItemList.oak_window_frame = new BlockItem(BlockList.oak_window_frame, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(BlockList.oak_window_frame.getRegistryName()), ItemList.water_pump = new BlockItem(BlockList.water_pump, new Item.Properties().group(ItemGroup.DECORATIONS)).setRegistryName(BlockList.water_pump.getRegistryName()), ItemList.furnace_station= new BlockItem(BlockList.furnace_station, new Item.Properties().group(ItemGroup.DECORATIONS)).setRegistryName(BlockList.furnace_station.getRegistryName()) ); debugString("Items registered..."); } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { event.getRegistry().registerAll( BlockList.oak_log_wall_type_0 = new LogWall(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0F).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_log_wall_type_0")), BlockList.oak_log_wall_type_1 = new LogWall(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0F).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_log_wall_type_1")), BlockList.oak_log_corner = new LogWallCorner(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0f).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_log_wall_corner")), BlockList.oak_cabin_door = new KenmodDoorBase(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0F).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_cabin_door")), BlockList.oak_window_frame = new WindowFrame(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0F).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_window_frame")), BlockList.water_pump = new WaterPump(Block.Properties.create(Material.ROCK).hardnessAndResistance(10.0F).sound(SoundType.STONE).harvestTool(ToolType.PICKAXE)).setRegistryName(location("water_pump")), BlockList.furnace_station = new FurnaceStation(Block.Properties.create(Material.ROCK).hardnessAndResistance(10.0F).sound(SoundType.STONE).harvestTool(ToolType.PICKAXE)).setRegistryName(location("furnace_station")) ); debugString("Blocks registered..."); } //START TILE ENTITY REGISTRY @SubscribeEvent public static void registerTileEntities (final RegistryEvent.Register<TileEntityType<?>> event) { event.getRegistry().register(TileEntityType.Builder.create(FurnaceStationTileEntity::new, BlockList.furnace_station).build(null).setRegistryName("furnace_station")); debugString("Tile entities registered..."); } //END TILE ENTITY REGISTRY @SubscribeEvent public static void registerContainer(RegistryEvent.Register<ContainerType<?>> event) { event.getRegistry().register(IForgeContainerType.create((windowId, inv, data) -> { return new FurnaceStationContainer (windowId, inv, data); }).setRegistryName("furnace_station")); debugString("Containers registered..."); } } private static ResourceLocation location(String name) { return new ResourceLocation(modid, name); } public static void debugString (String toSay) { logger.info(toSay); } }
November 23, 20195 yr Author 4 hours ago, diesieben07 said: Where do you initialize this field? I have changed the code to my main class by adding this: @SuppressWarnings("rawtypes") private static TileEntityType registerTileEntity (Supplier<TileEntity> supplier, String registryName, Block block, RegistryEvent.Register<TileEntityType<?>> regitstryEvent) { TileEntityType tileEntityType = TileEntityType.Builder.create(supplier, block).build(null); tileEntityType.setRegistryName(registryName); regitstryEvent.getRegistry().register(tileEntityType); return tileEntityType; } And by changing my subscribe event to this: @SuppressWarnings("unchecked") @SubscribeEvent public static void registerTileEntities (final RegistryEvent.Register<TileEntityType<?>> event) { //event.getRegistry().register(TileEntityType.Builder.create(FurnaceStationTileEntity::new, BlockList.furnace_station).build(null).setRegistryName("furnace_station")); BlockList.furnace_station_tile_entity = registerTileEntity(FurnaceStationTileEntity::new, "furnace_station", BlockList.furnace_station, event); debugString("Tile entities registered..."); } But it still gives me the same error even though I initialized it. The error keeps pointing me to the "write" method in the blocks tile entity, specifically at the line: super.write(tag) package com.log_cabin_blocks.objects.blocks.workstations.furnace_station; import com.log_cabin_blocks.LogCabinBlocks; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class FurnaceStationTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider { protected ItemStackHandler slots = new ItemStackHandler(); private final LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots); public FurnaceStationTileEntity() { super(BlockList.cabin_furnace_tile_entity); slots = new ItemStackHandler(); slots.setSize(3); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return slots_holder.cast(); } return super.getCapability(cap, side); } @Override public void read(CompoundNBT tag) { super.read(tag); slots.deserializeNBT(tag.getCompound("kenmodlcb:slots")); } @Override public CompoundNBT write(CompoundNBT tag) { super.write(tag); tag.put("kenmodlcb:slots", slots.serializeNBT()); return tag; } @Override public void tick() { LogCabinBlocks.debugString("TEST"); } @Override public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) { return new FurnaceStationContainer(id, player_inventory, slots, this); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("furnace_station"); } public void openGUI (ServerPlayerEntity player) { if(!world.isRemote) { NetworkHooks.openGui(player, this, getPos()); } } } I am sure the problem is there... I just don't know how to fix it yet. Edited November 23, 20195 yr by Kenneth201998
November 23, 20195 yr Author 9 minutes ago, diesieben07 said: Why? Look closely. Ok some after those fixes it gives me another error when I right click on the block: [m[33m[09:46:36] [Client thread/WARN] [minecraft/ScreenManager]: Trying to open invalid screen with name: block.kenmodlcb.furnace_station Here is the tile entity code: package com.log_cabin_blocks.objects.blocks.workstations.furnace_station; import com.log_cabin_blocks.objects.blocks.BlockList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; public class FurnaceStationTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider { protected ItemStackHandler slots = new ItemStackHandler(); private final LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots); public FurnaceStationTileEntity() { super(BlockList.furnace_station_tile_entity); slots = new ItemStackHandler(); slots.setSize(3); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return slots_holder.cast(); } return super.getCapability(cap, side); } @Override public void read(CompoundNBT tag) { super.read(tag); slots.deserializeNBT(tag.getCompound("kenmodlcb:slots")); } @Override public CompoundNBT write(CompoundNBT tag) { super.write(tag); tag.put("kenmodlcb:slots", slots.serializeNBT()); return tag; } @Override public void tick() { } @Override public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) { return new FurnaceStationContainer(id, player_inventory, slots, this); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("block.kenmodlcb.furnace_station"); } public void openGUI (ServerPlayerEntity player) { if(!world.isRemote) { NetworkHooks.openGui(player, this, getPos()); } } }
November 23, 20195 yr Author Fixed it: @SubscribeEvent public static void registerContainer(RegistryEvent.Register<ContainerType<?>> event) { BlockList.furnace_station_container = IForgeContainerType.create(FurnaceStationContainer::new); BlockList.furnace_station_container.setRegistryName("furnace_station_container"); event.getRegistry().register(BlockList.furnace_station_container); debugString("Containers registered..."); } ^^^ New subscribe event ^^^ Thanks everyone for the help
November 23, 20195 yr 3 hours ago, Kenneth201998 said: BlockList.furnace_station_container = Use ObjectHolder Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 24, 20195 yr Author 14 hours ago, Draco18s said: Use ObjectHolder Whatever I did seems to work. My furnace is now fully functional and I am implementing custom recipes.
November 24, 20195 yr 3 hours ago, Kenneth201998 said: Whatever I did seems to work. My furnace is now fully functional and I am implementing custom recipes. You should still use an ObjectHolder. There is no reason to assign the field yourself. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.