Posted March 4, 201411 yr Hello everybody, im new to this forum and this is my very first post :=) So, basically, i want that i can place saplings and stuff on my own block. a quick look revealed that it has todo with the "canThisPlantGrowOnThisBlockID" method inside BlockFlower. It checks for the id of the blocked to be placed and only when it matches it places it. Problem is, that the block that are allowed are hardcoded. i searched around a bit and came to the conclusion that i need a coremod and need to patch this method using bytecode manipulation. Now, i really have no clue on how todo those things^^ It would be cool if you could help me and yeah, any help is much appreciated regards, Marc
March 4, 201411 yr If you extend Block, you can override any (non-private or final) method in Block. If you extend BlockFlower....
March 5, 201411 yr Author yeah i mean vanilla saplings thats why i need to patch the BlockFlower.class ^^
March 5, 201411 yr Saplings are subclasses of BlockBush not BlockFlower from looking at 1,7.2 code. However, trying to get a sapling to be plantable, is not a simple matter of deriving a class from grass, dirt, or farmland. protected boolean canPlaceBlockOn(Block p_149854_1_) { return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == Blocks.farmland; } The above code hard-wires the check for a specific block, not just a suitably derived type of block. The code should have been written more like to make growing on other blocks readily possible. protected boolean canPlaceBlockOn(Block p_149854_1_) { return BlockGrass.class.isInstance(p_149854_1_) || BlockDirt.class.isInstance(p_149854_1_) || BlockFarmland.class.isInstance(p_149854_1_); } I'm not sure (other than a coremod) how to make such things work. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
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.