TLHPoE Posted December 29, 2015 Share Posted December 29, 2015 I have little to no knowledge of world generation (besides basic ore generation), and making a new village home seemed like a good place to start. This is what I have so far VillageHandler: package enlistment.village; import java.util.ArrayList; import java.util.Random; import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraftforge.fml.common.registry.VillagerRegistry; public class VillageHandler { public static void init() { ArrayList<StructureVillagePieces.PieceWeight> pieces = new ArrayList<StructureVillagePieces.PieceWeight>(); pieces.add(new StructureVillagePieces.PieceWeight(VillageTroopHome.class, 100, 100)); VillagerRegistry.addExtraVillageComponents(pieces, new Random(), 100); } } VIllageTroopHome: package enlistment.village; import java.util.Random; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureVillagePieces; public class VillageTroopHome extends StructureVillagePieces.Village { public VillageTroopHome(StructureVillagePieces.Start start, int type, Random random, StructureBoundingBox bb, EnumFacing direction) { super(start, type); this.coordBaseMode = direction; this.boundingBox = bb; } @Override public boolean addComponentParts(World world, Random random, StructureBoundingBox bb) { System.out.println("HI"); if(this.field_143015_k < 0) { this.field_143015_k = this.getAverageGroundLevel(world, bb); if(this.field_143015_k < 0) { return true; } this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 12 - 1, 0); } this.fillWithBlocks(world, bb, 1, 1, 1, 3, 3, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); this.fillWithBlocks(world, bb, 2, 2, 2, 2, 100, 2, Blocks.glass.getDefaultState(), Blocks.glass.getDefaultState(), false); this.spawnVillagers(world, bb, 2, 1, 2, 1); return true; } } Looking through the source code of Minecraft, I haven't been able to decipher what the cryptic integers in the VIllagerRegistry#addExtraVillageComponents method does, so I set them to 100 for testing purposes. Also I set the integers in the StructureVillagePieces#PieceWeight constructor to 100 for the same reason. The questions I have besides the integers are if I'm using the correct methods, extending the right classes, and passing the right objects. Quote Kain Link to comment Share on other sites More sharing options...
Recommended Posts
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.