Jump to content

Village house return value?


luisc99

Recommended Posts

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;
}

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

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 :P

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

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 :P

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

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 :P

 

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

Link to comment
Share on other sites

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 :P

 

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;
}
}

 

Link to comment
Share on other sites

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;
}
}

 

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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!

Link to comment
Share on other sites

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

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!

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.



×
×
  • Create New...

Important Information

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