Jump to content

[1.8] [SOLVED] Problems generating custom block in village


Recommended Posts

So I've made some corn and I'm trying to get it to generate as a Village field.

I basically copied what happens in net.minecraft.world.gen.structure.StructureVillagePieces#Field2 since it will be exactly the same except for replacing the crop. The field base generates fine but everything I try to get my corn generated does not work. It generates an empty field.

It looks to me through some testing that I'm either getting a block state wrong to spawn but It could be that I've missed something in my actual block class that messes with calling a block state of corn externally. I get no relevant console output during init or village generation. Can anyone help?


If this is an issue with the forge version i'm using (1.8-, let me  know that too...


BlockCorn: http://pastebin.com/0f49NDuS

ComponentCornField: http://pastebin.com/sTTHZtSE

CornWorldGen: http://pastebin.com/Pu3u2PJs


In my main class I've added the lines

MapGenStructureIO.registerStructureComponent(ComponentCornField.class, "Vicf");
        VillagerRegistry.instance().registerVillageCreationHandler(new CornWorldGen());



Link to comment
Share on other sites

  • 2 weeks later...

if you get an empty field, then you're almost there. just find the bug.


check the max height in debugger - if it's 1 you get an empty field. i see a weird line with maxY  in it (copied from the torches class), maybe you should rework that.


next thing to try is using world.setblockstate instead of component.func_175804_a i had problems with those methods - clipping logic in there is weird.


also, try replacing corn with carrots in one row, just to see if it's about corn.

Link to comment
Share on other sites

Alright so It looks like you're right with that function. I generated my block just fine at a world spawn point. I already know that I can generate other blocks in the dirt patches in the field, so that works too, but I've figured it out, thanks.


I wanted to use world.setblockstate originally but I didn't see how I can get the position of the generated village part within addComponentParts() to do so. If youre reading this in the future, it can be done as follows but is not needed

BlockPos pos = new BlockPos(this.getXWithOffset(0,0),this.getYWithOffset(0),this.getZWithOffset(0,0));



function func_175811_a works fine for me, I needed to change how I get my block to

Block  corn = GameRegistry.findBlock(Corn.MODID, "corn");

Instead of referencing the final instance I had been using in my main class for registration.

Link to comment
Share on other sites

Its more than likely that you never set the field in your main class to anything.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.


Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.


DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

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.