Posted April 17, 201312 yr Hey! I am making a mod that includes having a custom village house for my villagers to spawn on. I have got MineCraft to register my village home when it spawns villages, but it just spawns blank space and not my house as there is not value for buildComponent(). I understand that you need to return a value in order it build the village component, but as this method is not in vanilla code, and is nearly totally undocumented, I am unsure as to what this return value is. Amy help would be much appreciated! Thanks! Luis Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; }
April 17, 201312 yr Author Hey! I am making a mod that includes having a custom village house for my villagers to spawn on. I have got MineCraft to register my village home when it spawns villages, but it just spawns blank space and not my house as there is not value for buildComponent(). I understand that you need to return a value in order it build the village component, but as this method is not in vanilla code, and is nearly totally undocumented, I am unsure as to what this return value is. Amy help would be much appreciated! Thanks! Luis Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; }
April 17, 201312 yr Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; } Ehm well it has the return type of void which means it shouldn't return anything, simply typing [cod€]return;[/code] would do to signal the method is done executing. As for what it should be doing I'm not sure, but I guess you would put the code here to build the component and then let the method finish or return; if you wish to make it stop before it has executed the whole block of code If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; } Ehm well it has the return type of void which means it shouldn't return anything, simply typing [cod€]return;[/code] would do to signal the method is done executing. As for what it should be doing I'm not sure, but I guess you would put the code here to build the component and then let the method finish or return; if you wish to make it stop before it has executed the whole block of code If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr Author Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; } Ehm well it has the return type of void which means it shouldn't return anything, simply typing return; would do to signal the method is done executing. As for what it should be doing I'm not sure, but I guess you would put the code here to build the component and then let the method finish or return; if you wish to make it stop before it has executed the whole block of code When I created the VillageComponentDecoShop.class eclipse inserted it as an unimplemented method and from what I can tell, it is what runs when the house is being build. Because I am returning null nothing generates. I know that the generation code goes there but I don't know what the generation code would be as like I said before, village component creation is nearly undocumented. Ehm well it has the return type of void which means it shouldn't return anything. It might not be void, I just wrote that from memory. But I think it is
April 17, 201312 yr Author Just to solve any confusion, it is this that I am unsure as to what to return. @Override public static void buildComponent() { return null; } Ehm well it has the return type of void which means it shouldn't return anything, simply typing return; would do to signal the method is done executing. As for what it should be doing I'm not sure, but I guess you would put the code here to build the component and then let the method finish or return; if you wish to make it stop before it has executed the whole block of code When I created the VillageComponentDecoShop.class eclipse inserted it as an unimplemented method and from what I can tell, it is what runs when the house is being build. Because I am returning null nothing generates. I know that the generation code goes there but I don't know what the generation code would be as like I said before, village component creation is nearly undocumented. Ehm well it has the return type of void which means it shouldn't return anything. It might not be void, I just wrote that from memory. But I think it is
April 17, 201312 yr Well if it IS void then it whon't return anything. Anyways have you read the post "Minecraft NPC Villages Explained (Or, Why Are My Villagers Clumping Together?)" if not, it might be worth reading when you are looking into villages and it's code http://www.minecraftforge.net/forum/index.php/topic,7351.0.html If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr Well if it IS void then it whon't return anything. Anyways have you read the post "Minecraft NPC Villages Explained (Or, Why Are My Villagers Clumping Together?)" if not, it might be worth reading when you are looking into villages and it's code http://www.minecraftforge.net/forum/index.php/topic,7351.0.html If you guys dont get it.. then well ya.. try harder...
April 18, 201312 yr Author Well if it IS void then it whon't return anything. Anyways have you read the post "Minecraft NPC Villages Explained (Or, Why Are My Villagers Clumping Together?)" if not, it might be worth reading when you are looking into villages and it's code http://www.minecraftforge.net/forum/index.php/topic,7351.0.html Upon looking at the code, I have found out that it is not void. Also, that topic explains more about villages that it does about it's components. I have included my code for my village component for you to have a look at, in case it might help. again, this is a methood that has to be in the class, but there is no documentation on what to do with it. //Copyright luisc99 2013 package luisc99.DecoCraft; import java.awt.List; import java.util.Random; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; import net.minecraft.util.MathHelper; import net.minecraft.world.gen.structure.ComponentVillagePathGen; import net.minecraft.world.gen.structure.ComponentVillageStartPiece; import net.minecraft.world.gen.structure.StructureVillagePieceWeight; public class VillageComponentDecoShop implements IVillageCreationHandler { @Override public StructureVillagePieceWeight getVillagePieceWeight(Random random, int i) { return (new StructureVillagePieceWeight(ComponentVillageDecoShop.class, 20, MathHelper.getRandomIntegerInRange(random, 0+i, 1+i))); } @Override public Class<?> getComponentClass() { return ComponentVillageDecoShop.class; } @Override public Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, java.util.List pieces, Random random, int p1, int p2, int p3, int p4, int p5) { return null; } }
April 18, 201312 yr Author Well if it IS void then it whon't return anything. Anyways have you read the post "Minecraft NPC Villages Explained (Or, Why Are My Villagers Clumping Together?)" if not, it might be worth reading when you are looking into villages and it's code http://www.minecraftforge.net/forum/index.php/topic,7351.0.html Upon looking at the code, I have found out that it is not void. Also, that topic explains more about villages that it does about it's components. I have included my code for my village component for you to have a look at, in case it might help. again, this is a methood that has to be in the class, but there is no documentation on what to do with it. //Copyright luisc99 2013 package luisc99.DecoCraft; import java.awt.List; import java.util.Random; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; import net.minecraft.util.MathHelper; import net.minecraft.world.gen.structure.ComponentVillagePathGen; import net.minecraft.world.gen.structure.ComponentVillageStartPiece; import net.minecraft.world.gen.structure.StructureVillagePieceWeight; public class VillageComponentDecoShop implements IVillageCreationHandler { @Override public StructureVillagePieceWeight getVillagePieceWeight(Random random, int i) { return (new StructureVillagePieceWeight(ComponentVillageDecoShop.class, 20, MathHelper.getRandomIntegerInRange(random, 0+i, 1+i))); } @Override public Class<?> getComponentClass() { return ComponentVillageDecoShop.class; } @Override public Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, java.util.List pieces, Random random, int p1, int p2, int p3, int p4, int p5) { return null; } }
April 19, 201312 yr Well I see from the interface IVillageCreationHandler which you are implementing that it wants it return type to be an object. When I follow the code backwards I find that the net.minecraft.world.gen.structure.StructureVillagePieces contains the line (line 102) where it is calling for the buildComponent() method and later converting the Object into it's true type. Which seems to be "ComponentVillage". So I would assume that your method will return an object of the type ComponentVillage. I'm not familiar with the code of Villages, structures and components so I can't tell you more than what I see from the code at a glance. I would suggest that you read up on and understand the code which calls the methods of your interface and you may also want to check out the other classes of the net.minecraft.world.gen.structure package If you guys dont get it.. then well ya.. try harder...
April 19, 201312 yr Well I see from the interface IVillageCreationHandler which you are implementing that it wants it return type to be an object. When I follow the code backwards I find that the net.minecraft.world.gen.structure.StructureVillagePieces contains the line (line 102) where it is calling for the buildComponent() method and later converting the Object into it's true type. Which seems to be "ComponentVillage". So I would assume that your method will return an object of the type ComponentVillage. I'm not familiar with the code of Villages, structures and components so I can't tell you more than what I see from the code at a glance. I would suggest that you read up on and understand the code which calls the methods of your interface and you may also want to check out the other classes of the net.minecraft.world.gen.structure package If you guys dont get it.. then well ya.. try harder...
April 19, 201312 yr Author Well I see from the interface IVillageCreationHandler which you are implementing that it wants it return type to be an object. When I follow the code backwards I find that the net.minecraft.world.gen.structure.StructureVillagePieces contains the line (line 102) where it is calling for the buildComponent() method and later converting the Object into it's true type. Which seems to be "ComponentVillage". So I would assume that your method will return an object of the type ComponentVillage. I'm not familiar with the code of Villages, structures and components so I can't tell you more than what I see from the code at a glance. I would suggest that you read up on and understand the code which calls the methods of your interface and you may also want to check out the other classes of the net.minecraft.world.gen.structure package Ok, thanks for your your help!
April 19, 201312 yr Author Well I see from the interface IVillageCreationHandler which you are implementing that it wants it return type to be an object. When I follow the code backwards I find that the net.minecraft.world.gen.structure.StructureVillagePieces contains the line (line 102) where it is calling for the buildComponent() method and later converting the Object into it's true type. Which seems to be "ComponentVillage". So I would assume that your method will return an object of the type ComponentVillage. I'm not familiar with the code of Villages, structures and components so I can't tell you more than what I see from the code at a glance. I would suggest that you read up on and understand the code which calls the methods of your interface and you may also want to check out the other classes of the net.minecraft.world.gen.structure package Ok, thanks for your your help!
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.