Posted June 12, 201510 yr 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
June 13, 201510 yr 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.
June 13, 201510 yr Author Hey, thx for the answer... I can't find the event "PlaceEvent" or any other events in eclipse... ? No events.. nothing But i can't find the event here too... http://www.minecraftforge.net/wiki/Event_Reference#BlockEvent
June 13, 201510 yr net.minecraftforge.event.world.BlockEvent.PlaceEvent If it's not there, you setup your workspace badly. http://www.minecraftforge.net/forum/index.php/topic,14048.0.html 1.7.10 is no longer supported by forge, you are on your own.
June 13, 201510 yr Author 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?
June 13, 201510 yr 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.
June 13, 201510 yr @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. http://i.imgur.com/NdrFdld.png[/img]
June 13, 201510 yr Author Hey ho, the BlockEvent.NeighborNotifyEvent don't fires when stems set the melon block... i have try it.. any other ideas?
June 14, 201510 yr Look at World#setBlockState - each time the stem grows, that method is called, which should allow you to make your checks (using the block snapshot event) and see if you want to place a melon block on top of a hopper. http://i.imgur.com/NdrFdld.png[/img]
June 14, 201510 yr 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
June 14, 201510 yr Why are you wanting to grow melons on hoppers? I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 15, 201510 yr Author hey, i have a melon cutter ... see here: http://minecraft-bauideen.de/img/big_551.jpg[/img] The method with pistons is too big.. i like small
June 15, 201510 yr 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
June 15, 201510 yr Author 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.