I just recently created a new crop that works completely fine, everything is working as it should. Except for one thing, the crop won't break when you jump on it. The farmland turns to dirt as it should however the crop stays there and continues to grow on the dirt block. In 1.7.10 you would use the canBlockStay method. Would you still use this method or has it changed since that update? Any help appreciated.
What do you mean? All vanilla crops break after they've been trampled or jumped on
I assume you've looked at BlockCrops in 1.8.9 and seen that it still has canBlockStay(). Why would a 1.7.10 method and a 1.8.9 method in the same class with the same name do different things?
Anyway for future reference the best way to find a method from one version in another is this:
If you don't want to look through the code manually, you can find the SRG name of the method using the old version's MCP mappings and then look up the corresponding MCP name (if any) in the new version's mappings.
You can find the MCP mappings used by your ForgeGradle workspaces in ~/.gradle/caches/minecraft/de/oceanlabs/mcp/<mappings_channel>/<mappings_version> (replace ~ with %USERPROFILE% on Windows).
You can also use MCPBot instead of searching the mappings yourself.
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_){
return p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == Blocks.farmland;
}
public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_){
return p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == Blocks.farmland;
}
You don't need this, it's a direct copy of BlockCrops#canBlockStay(). If a class doesn't override a method in it's superclass, the superclass's method is called. That's the point of inheritance; it allows you to make classes with common code and then extend those classes to make things, instead of having duplicate code everywhere which is a pain to maintain because every time you fix a bug in it you need to change the code in multiple places, instead of just in the superclass.
Other than that I don't know, your crop should uproot.
I have no idea how to fix this, there's nothing wrong with my crop class as far as I'm concerned all I know is that it happens to all of my crops which all extend CropBlock
If you get an error on print, you can remove it! the rest of the code should suffice. also, if you have an error, post the error log
Be careful when using scala classes in a java mod. A mod I work on had an issue with a scala class, that was fixed by using the java equivalent instead.
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
Be careful when using scala classes in a java mod. A mod I work on had an issue with a scala class, that was fixed by using the java equivalent instead.
what is the java alternative to print? i didn't know there was a difference!
I just recently created a new crop that works completely fine, everything is working as it should. Except for one thing, the crop won't break when you jump on it. The farmland turns to dirt as it should however the crop stays there and continues to grow on the dirt block. In 1.7.10 you would use the canBlockStay method. Would you still use this method or has it changed since that update? Any help appreciated.
Why do you think it would?
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
What do you mean? All vanilla crops break after they've been trampled or jumped on
I assume you've looked at BlockCrops in 1.8.9 and seen that it still has canBlockStay(). Why would a 1.7.10 method and a 1.8.9 method in the same class with the same name do different things?
Anyway for future reference the best way to find a method from one version in another is this:
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Well in 1.7.10 the method was something like
Now in 1.8.9 the method from BlockCrops is
I'm a little confused because BlockCarrot extends BlockCrop and so does my crop
However carrots break when trampled on and mine does not.
I see what you mean now. Can you post your crop code?
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
I overrided the method just so i can edit it if it needs to be edited.
You don't need this, it's a direct copy of BlockCrops#canBlockStay(). If a class doesn't override a method in it's superclass, the superclass's method is called. That's the point of inheritance; it allows you to make classes with common code and then extend those classes to make things, instead of having duplicate code everywhere which is a pain to maintain because every time you fix a bug in it you need to change the code in multiple places, instead of just in the superclass.
Other than that I don't know, your crop should uproot.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Well that's really strange, do you think it has something to do with BlockCrops?
Also having this problem
I have no idea how to fix this, there's nothing wrong with my crop class as far as I'm concerned all I know is that it happens to all of my crops which all extend CropBlock
I thought it might have something to do with this but adding it to my crop class didn't seem to do anything
Here is what i did for my crops, i used the method onNeighborBlockChange().
Then have the plant check for cropland beneath it, and if there is, do nothing, but if there is, do worldIn.destroyBlock(pos, true);
Here is some of the code i used in my lettuce crops:
You could probably do a direct copy/paste.
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
Thanks, but I get an error on print
It says it's undefined for the type Console
I figured it out I added this to my code
Nevermind, it works now but if i place something next to it, it also breaks
If you get an error on print, you can remove it! the rest of the code should suffice. also, if you have an error, post the error log
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
Be careful when using scala classes in a java mod. A mod I work on had an issue with a scala class, that was fixed by using the java equivalent instead.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
what is the java alternative to print? i didn't know there was a difference!
Hello everyone! PMiner here! I have a YouTube Channel! I also made the Mod Urbanization!
If you would be so kind as to help me with my mod, Click Here!
System.out.println()
or System.out.print()
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things