Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

 

Posted

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

 

Posted

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

Posted

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

Posted

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!

Posted

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!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Add the crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here  
    • So i have a forge modded aternos server that worked just fine for a month untill today it suddenly crashes most of the time giving errors and idk which mod is causing the error or its smth else here is the crash log link https://mclo.gs/gGkzGKT
    • Struggling to decipher a crash report I'm getting in a custom modpack I'm tinkering with. The crash happens on startup, but weirdly, only some of the time. It seems to be related to Steves Carts, but weirdly it only started happening recently, and I can't identify if another mod is conflicting, or why it is only happening some of the time:   java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.player.Player.m_20202_()" because "player" is null at vswe.stevescarts.events.OverlayEventHandler.onRenderTick(OverlayEventHandler.java:24) ~[stevescarts-1.20.1-1.1.14.jar%23527!/:1.20.1-1.1.14] {re:classloading} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.5.jar%23127!/:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.5.jar%23127!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%23127!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%23127!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(ForgeEventFactory.java:919) ~[forge-1.20.1-47.1.106-universal.jar%23581!/:?] {re:mixin,re:classloading,pl:mixin:APP:modernfix-forge.mixins.json:perf.potential_spawns_alloc.ForgeEventFactoryMixin,pl:mixin:A} at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1148) ~[client-1.20.1-20230612.114412-srg.jar%23576!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick_render_call,xf:fml:xaerominimap:xaero_minecraftclient,xf:fml:xaeroworldmap:xaero_wm_minecraftclient,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick_render_call,xf:fml:xaerominimap:xaero_minecraftclient,xf:fml:xaeroworldmap:xaero_wm_minecraftclient,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718) ~[client-1.20.1-20230612.114412-srg.jar%23576!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick_render_call,xf:fml:xaerominimap:xaero_minecraftclient,xf:fml:xaeroworldmap:xaero_wm_minecraftclient,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick,xf:fml:xaeroworldmap:xaero_wm_minecraft_runtick_render_call,xf:fml:xaerominimap:xaero_minecraftclient,xf:fml:xaeroworldmap:xaero_wm_minecraftclient,pl:mixin:A,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:218) ~[minecraft-1.20.1-client.jar:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:APP:flywheel.mixins.json:ClientMainMixin,pl:mixin:A,pl:runtimedistcleaner:A}     Including some extra info in case any of it is relevant^. Appreciate any ideas/advice!    
  • Topics

×
×
  • Create New...

Important Information

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