Jump to content

[1.11.2] Village Generation


chipoodle

Recommended Posts

Hi folks,

 

I'm trying to generate a custom village, so i called in my proxy this:

 

public class MapGenEventHandler {

	public static void register() {
		MinecraftForge.TERRAIN_GEN_BUS.register(new MapGenEventHandler());
	}
	
	@SubscribeEvent(priority = EventPriority.LOWEST)
	public void initMapGen(InitMapGenEvent event) {
		event.setNewGen(new MapGenRogueVillage());
		
		
	}	
}

 

Next i extended MapGenStructure


 

public class MapGenRogueVillage extends MapGenStructure {
...
}

 

Then i just copied vanilla class StructureVillagePieces into my class  StructureRogueVillagePieces. But in the method:

public static List<StructureRogueVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(Random random, int size)
    {
        List<StructureRogueVillagePieces.PieceWeight> list = Lists.<StructureRogueVillagePieces.PieceWeight>newArrayList();
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.House4Garden.class, 4, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.Church.class, 20, MathHelper.getInt(random, 0 + size, 1 + size)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.House1.class, 20, MathHelper.getInt(random, 0 + size, 2 + size)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.WoodHut.class, 3, MathHelper.getInt(random, 2 + size, 5 + size * 3)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.Hall.class, 15, MathHelper.getInt(random, 0 + size, 2 + size)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.Field1.class, 3, MathHelper.getInt(random, 1 + size, 4 + size)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.Field2.class, 3, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.House2.class, 15, MathHelper.getInt(random, 0, 1 + size)));
        list.add(new StructureRogueVillagePieces.PieceWeight(StructureRogueVillagePieces.House3.class, 8, MathHelper.getInt(random, 0 + size, 3 + size * 2)));
        net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, size);
        Iterator<StructureRogueVillagePieces.PieceWeight> iterator = list.iterator();

        while (iterator.hasNext())
        {
            if (((StructureRogueVillagePieces.PieceWeight)iterator.next()).villagePiecesLimit == 0)
            {
                iterator.remove();
            }
        }

        return list;
    }

 

i get an error in this line: 

 net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, size);

 

Because i can't cast from StructureRogueVillagePieces.PieceWeight to StructureVillagePieces.PieceWeight. Is there a way to solve this? for example another method to register village pieces that accept my custom PieceWeight  list.

 

 

Thanks in advance.

Link to comment
Share on other sites

If you have a type mismatch, then it looks as if you have a Java problem. You must seek Java help elsewhere.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.