Jump to content

Recommended Posts

Posted

I have now employed quite a few "days" with Java. Now I am working on Minecraft mods. My first mods are now finished and work fine with no errors. (many new items, blocks, crafting recipes ....)

 

My next idea is the melons blocks on "Hopper" grow.

Since I still have difficulties in implementing how to begin there.

 

Can I use "Forge" simply override the melons class, or change it? If so, how?

 

 

BlockStem.java:

 

[....]
/**
     * is the block grass, dirt or farmland
     */
    protected boolean canPlaceBlockOn(Block ground)
    {
        return ground == Blocks.farmland;
    }
[....]

 

 

The search API was not really helped (and also in the forum or google).

Maybe I've also just looking for the wrong, who knows.

 

Thanks for the help.

Greetings from Germany

 

PS: Sorry for the bad english ... Google's fault: D :o:P

Posted

You can't directly replace whole class without using ASM.

You can replace registry, but them you will create huge incompatybility.

 

Best way is to utilize events.

In your case you might want to use "PlaceEvent". Google on how to use Forge events.

 

Write what exacly do you need for more help.

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

Posted

Okay it works.. it was a fail in eclipse..

 

Now, the discription of the event ist:

 

 

net.minecraftforge.event.world.BlockEvent.PlaceEvent

@Cancelable

Called when a block is placed by a player. If a Block Place event is cancelled, the block will not be placed.

 

Player? melon_block is set by melon_stam ? or not?

 

Posted

My next idea is the melons blocks on "Hopper" grow.

 

I don't understand what you want.

 

Write what exacly do you need for more help.

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

Posted

@Ernio He wants to change the way melons blocks behave, which is not necessarily only when placed by players, but when they grow from stems.

 

@OP I'm not sure if this will work, but you could try BlockEvent.NeighborNotifyEvent - it fires whenever a block notifies its neighbors that it has changed, and may fire for stems when they set the melon block, or perhaps for the melon block when it is first set in the world.

 

I'll leave digging around in the code / testing it up to you, but that's where I'd start.

Posted

oooor you could replace the stews instead of the melons, because there is no reason the replace the behaviour of the melon. you want to change the behavior of the stews, and tell them where to put melons

Posted

Well there are many ways to do it, replace melons, replace pistons, replace hoppers, etc..

Probably your best bet would be to create a new block that acts like a hopper that allows melons to grow on them.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Hey,

 

okay thx i will test it..

I thought it is the stem that prevents the melon block to set it on the top of the hopper... on creativ i can manualy place a melon block on the top of the hopper... only in surrival the stem dont place the melon block on a hopper...

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.