Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] How do I generate dungeon-like structures with Jigsaw blocks?


Professor_Boxtrot
 Share

Recommended Posts

I was playing around with structures the other day, and I found that I was able to get one working quite easily. I went on to the next step, and took a look at some other mods/some vanilla structures that use Jigsaw blocks. I put something together, but I'm having trouble getting the structure pieces (even just the starting piece) to spawn in the world. I am able to spawn the individual pieces with a structure block in-game perfectly fine though.

 

The logger shows that it's attempting to spawn the structure, but none of the pieces are ever created. I was wondering if I was doing something wrong with the piece class:

 

public class PathDungeonPieces {
	public static void start(ChunkGenerator<?> chunkGeneratorIn, TemplateManager templateManagerIn, BlockPos posIn, List<StructurePiece> structurePieces, SharedSeedRandom p_215139_4_) {
		DungeonMod.LOGGER.info("Adding pieces...");
		JigsawManager.addPieces(new ResourceLocation(DungeonMod.MOD_ID, "path_dungeon/center"), 7, PathDungeonPieces.Piece::new, chunkGeneratorIn, templateManagerIn, posIn, structurePieces, p_215139_4_);
		DungeonMod.LOGGER.info("Pieces added");
	}
	
	static {
		JigsawManager.REGISTRY.register(new JigsawPattern(new ResourceLocation(DungeonMod.MOD_ID, "path_dungeon/center"), new ResourceLocation("empty"), ImmutableList.of(Pair.of(new SingleJigsawPiece(DungeonMod.MOD_ID + ":path_dungeon/center"), 1)), JigsawPattern.PlacementBehaviour.RIGID));
		JigsawManager.REGISTRY.register(new JigsawPattern(new ResourceLocation(DungeonMod.MOD_ID, "path_dungeon/pieces"), new ResourceLocation("empty"), ImmutableList.of(Pair.of(new ListJigsawPiece(ImmutableList.of(new SingleJigsawPiece(DungeonMod.MOD_ID + ":path_dungeon/path_straight"), new SingleJigsawPiece(DungeonMod.MOD_ID + ":path_dungeon/path_turn_right"), new SingleJigsawPiece(DungeonMod.MOD_ID + ":path_dungeon/path_turn_left"), new SingleJigsawPiece(DungeonMod.MOD_ID + ":path_dungeon/path_end"))), 1)), JigsawPattern.PlacementBehaviour.RIGID));
	}
	
	public static class Piece extends AbstractVillagePiece {
		public Piece(TemplateManager templateManagerIn, JigsawPiece jigsawPieceIn, BlockPos posIn, int p_i50560_4_, Rotation rotationIn, MutableBoundingBox boundsIn) {
			super(FeatureInit.PATH_DUNGEON_PIECE, templateManagerIn, jigsawPieceIn, posIn, p_i50560_4_, rotationIn, boundsIn);
		}
		
		public Piece(TemplateManager templateManagerIn, CompoundNBT nbt) {
			super(templateManagerIn, nbt, FeatureInit.PATH_DUNGEON_PIECE);
		}
	}
}

 

And here's my feature init class:

 

@Mod.EventBusSubscriber(bus = Bus.MOD, modid = DungeonMod.MOD_ID)
public class FeatureInit {
	
	public static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(ForgeRegistries.FEATURES, DungeonMod.MOD_ID);
	
	
	public static IStructurePieceType PATH_DUNGEON_PIECE = PathDungeonPieces.Piece::new;
	
	
	public static final RegistryObject<PathDungeon> PATH_DUNGEON = FEATURES.register("path_dungeon", () -> new PathDungeon(NoFeatureConfig::deserialize));
	
	@SubscribeEvent
	public static void registerStructurePieces(RegistryEvent.Register<Feature<?>> event) {
		Registry.register(Registry.STRUCTURE_PIECE, "path_dungeon", PATH_DUNGEON_PIECE);
	}
}

 

And here's my package folder for my dungeon pieces:

image.png.2546930ed3bf0dd4811233a71f42271b.png

 

I have my code and Jigsaw blocks set up exactly how I see other mods/vanilla structures have it. Is there something I'm doing wrong here?

 

 

 

Link to comment
Share on other sites

1 hour ago, Professor_Boxtrot said:

public static final RegistryObject<PathDungeon> PATH_DUNGEON = FEATURES.register("path_dungeon", () -> new PathDungeon(NoFeatureConfig::deserialize)); @SubscribeEvent public static void registerStructurePieces(RegistryEvent.Register<Feature<?>> event) { Registry.register(Registry.STRUCTURE_PIECE, "path_dungeon", PATH_DUNGEON_PIECE); }

Pick one, not both.

 

Also, you never attach the feature nor the structure to a biome. You can do that on common setup or load complete, either works.

Link to comment
Share on other sites

7 minutes ago, Professor_Boxtrot said:

seeing as I did get another non-jigsaw structure to spawn fine.

Ah ok, that makes more sense.

 

My knowledge of how the jigsaw manager is limited so I try to eliminate the main issues first. My assumption is having to do with the AbstractVillagePiece and it expecting something different; however, this is a guess as my experience with world generation predates the existence of the jigsaw system.

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.