Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How do I generate blocks onthe surface (Like flowers)


Kander16
 Share

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

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • when i tried joining a world my mc crashed exit code -805306369
    • Hello There! In the 73rd episode of Bed Wars we get into a lobby with a guy who had a cool name and for some reason Ben is very impressed with the name and thus the title!  
    • I have been trying to install forge, but I can't even get the installer to run. I'm really not sure what the issue is, first let me make sure I am even using the installer right, I downloaded the forge installer matching my minecraft version (1.19.2), if I double click the .jar from the download then I see a flash of a black window that immediately disappears. If I use a command prompt, I receive the following output: C:\Users\austi> java -jar forge-1.19.2-43.0.19-installer.jar Error: Unable to access jarfile forge-1.19.2-43.0.19-installer.jar   I feel like this is more likely a java issue than a forge issue but I was hoping that people here might be able to help. I've tried a couple versions of java, at first I was using 8 I believe because all of the install guides for forge were a bit older so they linked to the java website rather than oracle. I tried version 18 from the oracle site and received the same result from command prompt. It is also entirely possible that I am doing something else wrong that is blatantly obvious to everyone else.
    • Here is my configuration: % java -version java version "18.0.2" 2022-07-19 Java(TM) SE Runtime Environment (build 18.0.2+9-61) Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing) forge-1.19-41.1.0-mdk on macOS Monterey 12.5 I ran the command: ./gradlew genEclipseRuns and was hoping it will generate the Eclipse project files for me. The run log is at https://gist.github.com/arun-gupta/06b983a6976b4c0a0f510d0dc225ddd3 and the generated directory structure is at https://gist.github.com/arun-gupta/3f5bfc70ec5d3d903b0f97d42840abda. In previous versions (1.12-ish), it used to generate an eclipse directory but 1.19 does not seem to have it. I tried opening the top-level forge directory but Eclipse does not recognize it as a project as well. How do I open this project in Eclipse now?  
    • I didn't put in credentials, I used it only for testing installing forge. But still the problem mentioned above.
  • Topics

×
×
  • Create New...

Important Information

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