Jump to content

[SOLVED] [1.15.2] Custom structure makes chunks fail to save


Tobo

Recommended Posts

I have a custom structure (just a large tree) that I have generating in forests. It works fine, however no edits to my world actually save, i.e breaking and placing blocks.

Latest.Log: VVV

Spoiler

[14May2020 12:26:55.729] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[14May2020 12:26:55.730] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[14May2020 12:26:55.734] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Changing view distance to 11, from 10
[14May2020 12:26:58.458] [Netty Local Client IO #0/INFO] [net.minecraftforge.fml.network.NetworkHooks/]: Connected to a modded server.
[14May2020 12:26:58.605] [Server thread/INFO] [net.minecraft.server.management.PlayerList/]: Dev[local:E:0f557564] logged in with entity id 373 at (-84.5, 68.0, -237.5)
[14May2020 12:26:58.658] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev joined the game
[14May2020 12:26:58.840] [Render thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake
[14May2020 12:26:59.636] [Render thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 0 advancements
[14May2020 12:27:01.080] [Server thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake
[14May2020 12:27:01.088] [Server thread/WARN] [net.minecraft.server.MinecraftServer/]: Can't keep up! Is the server overloaded? Running 2442ms or 48 ticks behind
[14May2020 12:27:05.414] [Render thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 4 advancements
[14May2020 12:27:09.323] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game...
[14May2020 12:27:09.477] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'New World'/minecraft:overworld
[14May2020 12:27:09.517] [Server thread/ERROR] [net.minecraft.world.server.ChunkManager/]: Failed to save chunk -5,-15
java.lang.RuntimeException: StructurePiece "com.tobogganeer.emeraldandruby.world.structures.TreePiece$Piece": "null" missing ID Mapping, Modder see MapGenStructureIO
	at net.minecraft.world.gen.feature.structure.StructurePiece.write(StructurePiece.java:66) ~[?:?]
	at net.minecraft.world.gen.feature.structure.StructureStart.write(StructureStart.java:91) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.writeStructures(ChunkSerializer.java:409) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:359) ~[?:?]
	at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:702) ~[?:?]
	at net.minecraft.world.server.ChunkManager.lambda$save$9(ChunkManager.java:372) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_251]
	at java.util.Iterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_251]
	at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:369) [?:?]
	at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:317) [?:?]
	at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:778) [?:?]
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:542) [?:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:115) [?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:660) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
[14May2020 12:27:09.524] [Server thread/ERROR] [net.minecraft.world.server.ChunkManager/]: Failed to save chunk -6,-16
java.lang.RuntimeException: StructurePiece "com.tobogganeer.emeraldandruby.world.structures.TreePiece$Piece": "null" missing ID Mapping, Modder see MapGenStructureIO
	at net.minecraft.world.gen.feature.structure.StructurePiece.write(StructurePiece.java:66) ~[?:?]
	at net.minecraft.world.gen.feature.structure.StructureStart.write(StructureStart.java:91) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.writeStructures(ChunkSerializer.java:409) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:359) ~[?:?]
	at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:702) ~[?:?]
	at net.minecraft.world.server.ChunkManager.lambda$save$9(ChunkManager.java:372) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_251]
	at java.util.Iterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_251]
	at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:369) [?:?]
	at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:317) [?:?]
	at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:778) [?:?]
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:542) [?:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:115) [?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:660) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
[14May2020 12:27:09.530] [Server thread/ERROR] [net.minecraft.world.server.ChunkManager/]: Failed to save chunk -6,-15
java.lang.RuntimeException: StructurePiece "com.tobogganeer.emeraldandruby.world.structures.TreePiece$Piece": "null" missing ID Mapping, Modder see MapGenStructureIO
	at net.minecraft.world.gen.feature.structure.StructurePiece.write(StructurePiece.java:66) ~[?:?]
	at net.minecraft.world.gen.feature.structure.StructureStart.write(StructureStart.java:91) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.writeStructures(ChunkSerializer.java:409) ~[?:?]
	at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:359) ~[?:?]
	at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:702) ~[?:?]
	at net.minecraft.world.server.ChunkManager.lambda$save$9(ChunkManager.java:372) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_251]
	at java.util.Iterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_251]
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_251]
	at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_251]
	at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:369) [?:?]
	at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:317) [?:?]
	at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:778) [?:?]
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:542) [?:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:115) [?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:660) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]

 

I can see that my tree piece seems to be missing an ID mapping, and I'm not really sure what that means or how I could add one.

Here is my TreePiece class: VVV

Spoiler

public class TreePiece {
	
	public static class Piece extends TemplateStructurePiece {
		
		public Piece(TemplateManager templateMgr, CompoundNBT nbt) {
			super(EmeraldAndRuby.TREE_PIECE, nbt);
			this.setupTemplate(templateMgr);
		}

		public Piece(TemplateManager templateMgr, ResourceLocation resLoc, BlockPos blockPos, Rotation rot, int offsetY) {
			super(EmeraldAndRuby.TREE_PIECE, 0);
			this.templatePosition = new BlockPos(blockPos.getX(), blockPos.getY() - offsetY, blockPos.getZ());
			this.setupTemplate(templateMgr);
		}

		private void setupTemplate(TemplateManager templateMgr) {
	         Template template = templateMgr.getTemplateDefaulted(EmeraldAndRuby.TREE_LOC);
	         PlacementSettings placementsettings = (new PlacementSettings())
	        		 	.setRotation(Rotation.NONE)
	        		 	.setMirror(Mirror.NONE)
	        		 	.setCenterOffset(BlockPos.ZERO)
	        		 	.addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK);
	         this.setup(template, this.templatePosition, placementsettings);
		}
		
		@Override
		public boolean func_225577_a_(IWorld worldIn, ChunkGenerator<?> chunkGenIn, Random rand, MutableBoundingBox mutableBB, ChunkPos chunkPos) 
		{
			PlacementSettings placementsettings = (new PlacementSettings()).setRotation(Rotation.NONE).setMirror(Mirror.NONE).setCenterOffset(BlockPos.ZERO).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK);
			BlockPos blockpos1 = this.templatePosition.add(Template.transformedBlockPos(placementsettings, new BlockPos(3, 0, 0)));
			int strucHeight = worldIn.getHeight(Heightmap.Type.WORLD_SURFACE_WG, blockpos1.getX(), blockpos1.getZ());
			this.templatePosition = this.templatePosition.add(0, strucHeight, 0);
			boolean superReturn = super.func_225577_a_(worldIn, chunkGenIn, rand, mutableBB, chunkPos);
			return superReturn;
		}

		@Override
		protected void handleDataMarker(String function, BlockPos pos, IWorld worldIn, Random rand,
				MutableBoundingBox sbb) {
			// Could this be it?
		}
	}

}

 

And here is my TreeStructure class: VVV

Spoiler

public class TreeStructure extends ScatteredStructure<NoFeatureConfig> 
{
	   public TreeStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> TreeConfigIn) {
	      super(TreeConfigIn);
	   }

	   @Override
	   public String getStructureName() {
	      return EmeraldAndRuby.TREE_LOC.toString();
	   }

	   @Override
	   public int getSize() {
	      return 1;
	   }

	   @Override
	   public Structure.IStartFactory getStartFactory() {
	      return TreeStructure.Start::new;
	   }
	   
	   @Override
	public boolean func_225558_a_(BiomeManager biomeManagerIn, ChunkGenerator<?> generatorIn, Random randIn, int chunkX,
			int chunkZ, Biome biomeIn) {
		//return biomeIn.hasStructure(this);
		   return generatorIn.hasStructure(biomeIn, this);
	}

	   @Override
	   protected int getSeedModifier() {
	      return 165745296;
	   }

	   public static class Start extends MarginedStructureStart {
	      public Start(Structure<?> p_i225815_1_, int p_i225815_2_, int p_i225815_3_, MutableBoundingBox p_i225815_4_, int p_i225815_5_, long p_i225815_6_) {
	         super(p_i225815_1_, p_i225815_2_, p_i225815_3_, p_i225815_4_, p_i225815_5_, p_i225815_6_);
	      }

	      @Override
      public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn) {
    	int worldX = chunkX * 16;
	    int worldZ = chunkZ * 16;
		BlockPos blockpos = new BlockPos(worldX, 0, worldZ);
		this.components.add(new TreePiece.Piece(templateManagerIn, EmeraldAndRuby.TREE_LOC, blockpos, Rotation.randomRotation(new Random()), 1));
        this.recalculateStructureSize();
	    //}
      }
   }
}

 

Also in my main class I have these two lines:VVV

Spoiler

public static final ResourceLocation TREE_LOC = new ResourceLocation(MOD_ID, "tree");
public static IStructurePieceType TREE_PIECE = null;

 

If any more information is required I can provide it, but I'm just pretty lost on this. Any help is greatly appreciated :D

 

 

EDIT: Now that i look at it, in my main class I set TREE_PIECE to null and then super TREE_PIECE, so I am effectively passing through null. However, I am unsure what to put instead of null. I will take a look in the vanilla code.

 

EDIT 2: I fixed it! It was what I thought, I changed 

public static IStructurePieceType TREE_PIECE = null;

into

public static IStructurePieceType TREE_PIECE = IStructurePieceType.register(TreePiece::new, MOD_ID + "tree_piece");

 

Edited by Tobo
I figured it out :D
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.