Jump to content

Recommended Posts

Posted
4 hours ago, V0idWa1k3r said:

I think you ment BlockPos, not BlockState.

 

OP, how do you know that this does not work? Did you place a breakpoint after those 2 if statements and it is not being triggered? Because there are more thing that would stop your structure from spawning later down the line. Those 2 checks apart from creating a new BlockPos object every time(don't do that btw) look fine.

 

 


 

As @Choonster said, do not use getBiomeForCoordsBody.

 

Why are you comparing classes here? If your intention is making the structure only spawn in the plains biome you can either use BiomeDictionary or directly compare the biome to Biomes.PLAINS.

 

 

This will be true if the block above the inital ground height is not air thus forbiding your structure from spawning. Tallgrass, for example...

 

You do not need this. You can return from a loop directly when your air check fails. With your current code you are just wasting time in the loop if the structure won't generate.

 

Never use IDs. They can and will change. Blocks class exists for a reason.

getStateFromMeta should not be called. Use BlockStates. A state with meta 0 will most likely be the default state. 

This way of spawning structures is very confusing and painful to update/fix later. Use templates if they are available in whatever version you are modding for.

 

Do not create a new Random object every time you need to do something. You have an instance of Random passed as an argument.

 

nextInt returns a value from 0 to the number specified excluding this number. nextInt(15) will return a number from a range of [0-14].

 

=>

world.getHeight(i, k)

 

random.nextInt(10) == 0 is much more understandable and does pretty much the same.

 

Yay! I solved it all I had to do was get rid of this statement: world.getBlockState(new BlockPos(i + x, j + y + 1, k + z)).getBlock() != Blocks.AIR . Thank you to everyone who helped me!

Posted

And...you know...all those other things...

  • Like 1

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.

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.