Jump to content

How do I generate blocks onthe surface (Like flowers)


Kander16

Recommended Posts

Hi,

 

My question is that I wanted to create a plant (StrawberryBush) that grows on top of grass, how do I do this?

I think its the easiest way with the events, but I don't know how to do this.

 

Thanks.

 

 

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

//Appears to be x coordinate (offset by +-  I'd assume from the middle of the chunk
            int i1 = p_76484_3_ + p_76484_2_.nextInt( - p_76484_2_.nextInt(;
//y +- 4 (probably from top block at center of chunk
            int j1 = p_76484_4_ + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
//z coordinate of the chunk +- 8 (once again, probably from center)
            int k1 = p_76484_5_ + p_76484_2_.nextInt( - p_76484_2_.nextInt(;

//If the the block at given location is air and the block below it is grass (And as a final check, can we really put it there) spawn the block!
            if (p_76484_1_.isAirBlock(i1, j1, k1) && p_76484_1_.getBlock(i1, j1 - 1, k1) == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(p_76484_1_, i1, j1, k1))
            {

 

I have no idea what

p_76484_2_.nextInt(4),

inside the set block is.

Link to comment
Share on other sites

I have no idea what p_76484_2_.nextInt(4), inside the set block is.

 

Setting a random metadata facing, perhaps. :|

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

Hi,

 

Do i need to register it too before this actually works?

 

I think of

world.setBlock(i1, j1, k1, Chef.bushStrawberryBush, random.nextInt(75), 10);

that the

random.nextInt(75), 10)

the chance to spawn is.

 

Thanks.

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

Use an event, an event is something that happens in minecraft like a chuk load or terain gen, that is how they spawn caves and caverns and mineshaft, well you get the idea. there is a tutorial on them in the forge or a really good one @ http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and (soory if it isnt a hyper link) but that contains things like terrain gen. So TRY IT OUT .But yes that needs to be in some sort of forge-registered class and a tickhandler probobly that watches Chunk.Load but would be very complicated, i would highly suggest that you use events though. They greatly reduce lag be being called upon only when needed. This is irrelevant but FYI, strawberries aren't grown on bushes

Link to comment
Share on other sites

Decoratebiome event, right?

 

If you ask me, I think this is where it generates the pumpkins and things like that.

 

    @HasResult
    public static class Decorate extends DecorateBiomeEvent
    {
        /** Use CUSTOM to filter custom event types
        */
        public static enum EventType { BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, LILYPAD, FLOWERS, GRASS, LAKE, PUMPKIN, REED, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM }
       
        public final EventType type;
       
        public Decorate(World world, Random rand, int worldX, int worldZ, EventType type)
        {
            super(world, rand, worldX, worldZ);
            this.type = type;
        }
    }
}[/Code]

 

but how do I let him generate my own strawberrybush?

 

Thanks.

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

I've never worked with this event before, sorry. I dont like random stuff that much. But that i do not know but i do know that you can but some registery is involved hence;

 public static enum EventType

  {
      BIG_SHROOM,  CACTUS,  CLAY,  DEAD_BUSH,  LILYPAD,  FLOWERS,  GRASS,  LAKE,  PUMPKIN,  REED,  SAND,  SAND_PASS2,  SHROOM,  TREE,  CUSTOM // < that;
      
      private EventType() {}
    }

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.