• Posts

    • Hey there. I am having problem with adding loot to chests in my structure. Structure is built using jigsaw pieces just like vanilla villages. However I cannot find a word about placing loot in the chests. Does anyone know how to do it? / Where to find the code about populating vanilla villages chests?
    • Hi! I have been working on a mod, that creates an ash-rain event, where ash blocks start falling from the sky. Currently I use the player tick event to spawn the blocks around the player. The only problem is, this seems to cause extreme lag, even when the block creation rate is such that only 10-20 blocks are falling at any time. I have tested much larger amounts of manually placed blocks falling at once and not causing lag. I have also tried creating sand blocks instead of the custom ash block to no difference, so the problem is not in the block itself either. Here is the code. If anyone knows what the problem might be, I would be very grateful. I assume its probably some mechanic I dont know about, and will go dig in it some more, but I'm stumped. @Mod.EventBusSubscriber(bus= Mod.EventBusSubscriber.Bus.FORGE) public static class WorldEvents{ private static final int ASHFALLRADIUS = 7*16; private static final float ASHFALLINTERVAL = 1; private static float interval = 0.f; @SubscribeEvent public static void onTick(TickEvent.PlayerTickEvent tickEvent) { PlayerEntity player = tickEvent.player; World world = tickEvent.player.world; if(world.isRemote()) { Random rand = world.getRandom(); interval += rand.nextFloat(); if(interval > 5.f) { BlockPos dropPos = new BlockPos( player.posX + rand.nextInt(ASHFALLRADIUS * 2) - ASHFALLRADIUS, 150, player.posZ + rand.nextInt(ASHFALLRADIUS * 2) - ASHFALLRADIUS); if (world.getChunkProvider().isChunkLoaded(new ChunkPos(dropPos))) { BlockState state = ashBlock.getDefaultState().with(ashBlock.LAYERS, rand.nextInt(8) + 1); world.setBlockState(dropPos, state, 6); } interval = 0; } } } }  
    • I installed forge for 1.12.2 and when I ran the launcher it crashed, no crash report. Help?
    • You must pass the correct ContainerType instance to the Container constructor. You passed null.
    • I made some changes and now have a problem opening the gui again and it says there is a mapping missing. It said it is at the line : "return super.write(tag)"  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.item.Items; 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); public CabinFurnaceTileEntity() { super(BlockList.cabin_furnace_tile_entity); } @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); } private IItemHandler createHandler() { return new ItemStackHandler(3) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return stack.getItem() == Items.DIAMOND; } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { if (stack.getItem() != Items.DIAMOND) { return stack; } return super.insertItem(slot, stack, simulate); } }; } @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new CabinFurnaceContainer(p_createMenu_1_, pos, p_createMenu_2_, p_createMenu_3_); } @Override public ITextComponent getDisplayName() { return new StringTextComponent("cabinfurnace"); } @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); } }   Error   [m[36m[10:17:44] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 029 [m[33m[10:17:44] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Is the server overloaded? Running 3870ms or 77 ticks behind [m[32m[10:17:49] [Client thread/INFO] [minecraft/AdvancementList]: Loaded 2 advancements [m[1;31m[10:18:00] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.UnsupportedOperationException: Unable to construct this menu by type at net.minecraft.inventory.container.Container.getType(Container.java:52) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.openGui(NetworkHooks.java:189) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.openGui(NetworkHooks.java:154) ~[?:?] {re:classloading} at com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnace.onBlockActivated(CabinFurnace.java:69) ~[?:?] {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.driveUntil(ThreadTaskExecutor.java:123) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:706) [?:?] {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[10:18:00] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.UnsupportedOperationException: Unable to construct this menu by type at net.minecraft.inventory.container.Container.getType(Container.java:52) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.openGui(NetworkHooks.java:189) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.openGui(NetworkHooks.java:154) ~[?:?] {re:classloading} at com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnace.onBlockActivated(CabinFurnace.java:69) ~[?:?] {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.driveUntil(ThreadTaskExecutor.java:123) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:706) [?:?] {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[32m[10:18:01] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [m[32m[10:18:01] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 029'/minecraft:overworld [m[1;31m[10:18:01] [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 com.log_cabin_blocks.objects.blocks.utility_blocks.cooking_utilities.cabin_furnace.CabinFurnaceTileEntity.write(CabinFurnaceTileEntity.java:47) ~[?:?] {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[10:18:02] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 029 [m[32m[10:18:10] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 029'/minecraft:overworld [m[36m[10:18:10] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 029 [m[32m[10:18:10] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game [m[32m[10:18:10] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Stopping singleplayer server as player logged out [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [m[32m[10:18:10] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test Area 029'/minecraft:overworld [m[32m[10:18:11] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 029): All chunks are saved [m[36m[10:18:11] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test Area 029 [m[32m[10:18:11] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (Test Area 029): All chunks are saved [m[32m[10:18:11] [Client thread/INFO] [minecraft/Minecraft]: Stopping! [m  
  • Topics

  • Who's Online (See full list)