Jump to content

How to spawn a block?


Mr.sKrabs

Recommended Posts

Use

IWorldGenerator

and

GameRegistry.registerWorldGenerator

to generate something in the world.

 

You can use

World#getTopSolidOrLiquidBlock

to get the y coordinate of the highest solid block (excluding leaves) at the specified x and z coordinates (which is usually the ground).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I have attempted it a few times with no success.

I know the basic of how it works I am having problem in creating the CLASS

which the GameRegistry References in the Main class of the mod.

 

Of course i am using IWorldGeneration as extending.

But the code that i am writing inside is not correct doesn't matter how hard i think plus World getTopSolidOrLiquidBlock cannot be an int You'll understand if i post the code.

Link to comment
Share on other sites

GameRegistry.registerWorldGenerator(new HarshNatureRegen()); I have error in this

I've written this in Normal initilization.

 

And this is the code of the Class itself.

 

https://gist.github.com/anonymous/6122189b9ecd22efd6f5

 

Now I know there is a way of doing this in another way but I dont know if I should this is the other way using Case

https://gist.github.com/anonymous/ea5442d9d65e72a7b8ff

Link to comment
Share on other sites

From the Start to the red brackets

 

The constructor WorldGenMinable(Block, int) is undefined

 

(new WorldGenMinable(HarshNatureBlocks.BerryBush, 5)).generate(world, random, blockX, blockY, blockZ);

 

for "Generate"

The method generate(World, Random, BlockPos) in the type WorldGenMinable is not applicable for the arguments (World, Random, int, int, int)

 

Link to comment
Share on other sites

From the Start to the red brackets

 

The constructor WorldGenMinable(Block, int) is undefined

 

(new WorldGenMinable(HarshNatureBlocks.BerryBush, 5)).generate(world, random, blockX, blockY, blockZ);

 

for "Generate"

The method generate(World, Random, BlockPos) in the type WorldGenMinable is not applicable for the arguments (World, Random, int, int, int)

 

You're using the 1.7.10 method signatures, but they were changed in 1.8. If you look at the

WorldGenMinable

class, you'll see the new signatures for the constructor and the

generate

method.

 

In 1.8, most

Block

and metadata method parameters were replaced with an

IBlockState

parameter and individual coordinate parameters were replaced with a

BlockPos

parameter.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

https://gist.github.com/anonymous/de993d247807b28b17b4

 

Got the regeneration to work,but one problem it seems I can't manage to make us so it will spawn above ground,Not at the sky...

On ground

WorldGenMinable

is designed for replacing a terrain block (e.g. stone) with another block (e.g. ore), but your bushes are supposed to generate on top of the ground rather than in it or in the air. I'd recommend looking at

WorldGenTallGrass

to see how it determines where the ground level is and then generates on top of it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

WorldGenTallGrass

only works with

Blocks.tall_grass

. I meant for you to look at the class to see how it chooses the generation position rather than use the class itself.

 

In future, please give your Gist files the appropriate file extension (.java for Java code) so syntax highlighting works.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

We'll I've tried a few things...

1.Line 48 https://gist.github.com/anonymous/fdc3d4a47dd6535b2e69

In a world that I have already opened there are chunks not being loaded(a giant hole in earth)

When i open a new world i get his error

https://gist.github.com/anonymous/67abb6ba4c186036b6d9

 

Block.tallgrass

does not work at all,give me the error which the constructor is undefined.

 

Now the boolean of the generate in the WorldGenTallGrass uses the same of World random Blockpos.

But I've understood how it generates,its a boolean returning true or false..

It looks for the block pos if its not in air and does not have leaves it breaks the method.

I know how it generates but Still no clue what to pass in,What to write,I know this is not a tutorial of some sort but explain to me slowly what to do

Link to comment
Share on other sites

Then what should I do?.

My berry bush is a block,if WorldGenTallGrass wont generate it then what should I use...

I though of WorldGenFlowers but my block needs to be a flower type....

 

Use the same logic as

WorldGenTallGrass

does for finding the ground level, then generate your block instead of tall grass.

WorldGenTallGrass#generate

is called from

BiomeDecorator#genDecorations

, you can trace the call locations from there to see how the initial position is determined.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Everything went smootly except one thing

https://gist.github.com/anonymous/abdfd33a08c3774ddc37

 

I dont know what to pass in the new WorldGenTallGrass()

Everything i try gives off an error,I went to the class WorldGenTallGrass

 

and it tells me to fill in BlockTallGrass.EnumType

 

Like I've tried to tell you several times: don't use the

WorldGenTallGrass

class (because it can't be used to generate your block), adapt the logic from its

generate

method into your own class.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I understood what Im suppose to do but I dont know what to write..go step by step and let me understand whats going on

now dont give me the "Learn Java" shit,I dont know what you think but its not a day proccess.

And I started the other day and i'm not going to freeze my mod untill I know Java fully...

Link to comment
Share on other sites

Ey ey Fuck you too.

Do you think that I'll be lazy with a problem that I am stuck with 72 hours?...

Yes I did try looked every where can't find 1 block who uses the WorldGenTallGrass..

Even looked at fucking Tall Grass..

 

2InAZWq.gif

 

1.7.10 is no longer supported by forge, you are on your own.

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.

Announcements



×
×
  • Create New...

Important Information

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