Hmm, Interesting how you wrote this code. To be honest, you probably copied it from somewhere else. But this is a very easy to fix error. It's a syntax error. This means that is doesn't really affect any logic or anything, just isn't how the Java language works. I suggest reading here for Java tutorials. They're extremely well explained and go quite advanced as well! As for your specific problem, here's the correct code, error free (I do still suggest that you read the tutorials to understand why this works the way it does:
package noahc3.MaterialBlobs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemDirtBlob extends Item
{
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
Didn't copy it, just quick referencing guides when I need them which tends to lead to choppy code while I'm learning a new language. I'm more fluent in C#, so i'm learning Java syntax as I go. I'd use tutorials but I just can't stand them and so I just learn how to write in a new language through trial and error (most of the time :P)
Anyways, looking at the code side by side, I'm now realizing I popped the if statement in the wrong place like a noob, should have checked it more carefully. Guess that's what being tired can do to you.
While it is not the exact same, it is very similar because instead of coordinates, you will have to use BlockPos, I haven't coded a lot of 1.8 but I believe there are some static final fields in the BlockPos class that you can easily adapt the code to. Or if you wanna simplify it, you can just make a new BlockPos with the given coordinates.
While it is not impossible, it might be a bit difficult. The way the speed of the item is set in the code is from the constructor of the EntityThrowable class. It uses the method setThrowingHeading(...), so maybe you could override that method and set it yourself? I haven't tried this but that's what I'd start with.
Hello!
Didn't copy it, just quick referencing guides when I need them which tends to lead to choppy code while I'm learning a new language. I'm more fluent in C#, so i'm learning Java syntax as I go. I'd use tutorials but I just can't stand them and so I just learn how to write in a new language through trial and error (most of the time :P)
Anyways, looking at the code side by side, I'm now realizing I popped the if statement in the wrong place like a noob, should have checked it more carefully. Guess that's what being tired can do to you.
Either way, thanks!
No problem! I'm actually trying to learn C# next. It's quite similar to Java, isn't it?
Hello!
After I put this code in eclipse:
with my Entity instead of EntityGrenade, eclipse gives me the error "unreachable code" for the whole "if" statement.
I have an Entity class for my entity, and I've done everything except the part where it actually explodes.
Minecraft runs, but when I right click the item, the game crashes because of the unreachable code.
Do you know how to fix this? Thanks.
You could post the whole class into this website here and then send me the link, it seems that there's a problem with the code itself.
Hello!
Hi, great tutorial everything works fine but id like to make it render as a snowball or an egg, any help?
I won't tell you the answer but something has to change in the GrenadeClient.java class
Hello!
No problem. I don't mind at all. You don't need to.
Hello!
i have a small quiestion what is the switch case part for ? and how do you do it in 1.8 ? because you can't change the coordinates like that in 1.8
Beginner forge developer
While it is not the exact same, it is very similar because instead of coordinates, you will have to use BlockPos, I haven't coded a lot of 1.8 but I believe there are some static final fields in the BlockPos class that you can easily adapt the code to. Or if you wanna simplify it, you can just make a new BlockPos with the given coordinates.
Hello!
Do you plan on making any helpful tutorials like this one in the future?
I will be bluntly honest with you, I do not. It is very unlikely that I will be making any more tutorials.
Hello!
Hi, this tutorial is very nice!
But I want to adjustment of speed of entity.
So, please tell me about how to it.
While it is not impossible, it might be a bit difficult. The way the speed of the item is set in the code is from the constructor of the EntityThrowable class. It uses the method setThrowingHeading(...), so maybe you could override that method and set it yourself? I haven't tried this but that's what I'd start with.
Hello!
Oh...
I see.
I try it.
Thank you!
For the explodey bit, whats the "mop" stand for?