I think you have to add the enchantment to the ItemStack object via the method addEnchantment (at least in 1.7.2, I think it's the same in 1.6.4), which takes an Enchantment object and an int indicating the level. If you just want the effect, however, override hasEffect and make it return true. For example, in Forge, I assume you do it like this to enchant it on crafting:
GameRegistry.addRecipe(new ItemStack(ModItems.yourItem).addEnchantment(Enchantment.sharpness, 5), new Object[] {" X ", " X ", " Y ", new ItemStack(Items.stick), "Y", new ItemStack(Blocks.obsidian), "X"});
By the way, if possible, update to 1.7.2, it's the recommended version and Minecraft's code is cleaner. EDIT: Wait, this method existed? Why can't Forge just have some bleeding documentation?!
Thank you so much, guys! You are very nice to me, and are really helpful! You guys are definitely going in the credits of my mod
For learning java, it can vary what's the best - I learnt most of it via books, but some learn best via video tutorials. Minecraft's "Basic" java is some moderately advanced OOP (packages, interfaces, etcetera), which any good java tutorial will cover early on.
If you want to get to advanced, which is what allows you to make AMAZING mods (EG. Forge, my current API project, or any real sort of API), you'd have to learn annotations, generics, and, if you use Java 8 (which not many do quite yet in the modding community, but when Minecraft hits java 7 (it had better), I'll be moving on to Java 8, if just for type/variable annotations), Lambda expressions, possibly more. But if this is a test mod, just ignore this paragraph.
Done that? Ok, good.
You can override the onItemRightClick method. Summoning the fireball will be the hard part, but you can look in the ghast code for fireball launching code. You are passed the player and the world object, which is everything needed for summoning fireballs.
Thanks for the help. The mod is in a sort-of Beta stage, where I'm really just testing to see what works best. However later on, I will make it a bit more advanced, having more content. The idea of the mod is "What Could Have Been" in Minecraft, adding more uses to stuff not normally used (Emerald, obsidian, blaze rods, etc.) Thanks for replying, and I guess I better start studying!
NOTE: I now have a new problem with textures, please look at latest post.
Fixed, but my client doesn't want to start anymore.
ORIGINAL POST:
Here's the thing:
I'm making a Minecraft Mod for 1.6.4, and I am trying to add in Blaze Swords which when right-clicked, spawn fireballs that shoot away from the player. I would also like help with adding enchantments on items so when they spawn, they already have the enchantment.
If it helps, here's my code for BlazeSword.java:
package eclipsis.mod.items;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemSword;
public class BlazeSword extends ItemSword{
public BlazeSword(int par1, EnumToolMaterial par2EnumToolMaterial) {
super(2010, par2EnumToolMaterial);
}
}
I have the sword working fine, it does what it's supposed to, textures are ok, but I don't know how to do this stuff, and help would be much, much, MUCH appreciated.
Thanks in advance to anyone who will help.
NOTE: Also, if you think I should learn Basic Java before doing any of this, please link me to a place where I can learn the Basics of Java that are used by Minecraft. Thanks for your time.
0
"void is an invalid type for the variable onCreation"
Here:
https://www.dropbox....o2cr8o/void.png
ANYONE Help?
0
https://www.dropbox....ctis9y7/Wat.png
Help...
EDIT: Am I missing any imports or anything? It doesn't look like it, but... Just need to be sure.
NEXT EDIT: I am offline, but please still post a solution. Thanks!!!
0
Thank you so much, guys! You are very nice to me, and are really helpful! You guys are definitely going in the credits of my mod
0
Something like this, but pre-enchanted:
https://www.dropbox....0j6n1m/ench.png
Thanks. Just a few tips, methods, maybe a line of code will help.
0
Thanks for the help. The mod is in a sort-of Beta stage, where I'm really just testing to see what works best. However later on, I will make it a bit more advanced, having more content. The idea of the mod is "What Could Have Been" in Minecraft, adding more uses to stuff not normally used (Emerald, obsidian, blaze rods, etc.) Thanks for replying, and I guess I better start studying!
0
NOTE: I now have a new problem with textures, please look at latest post.Fixed, but my client doesn't want to start anymore.
ORIGINAL POST:
Here's the thing:
I'm making a Minecraft Mod for 1.6.4, and I am trying to add in Blaze Swords which when right-clicked, spawn fireballs that shoot away from the player. I would also like help with adding enchantments on items so when they spawn, they already have the enchantment.
If it helps, here's my code for BlazeSword.java:
I have the sword working fine, it does what it's supposed to, textures are ok, but I don't know how to do this stuff, and help would be much, much, MUCH appreciated.
Thanks in advance to anyone who will help.
NOTE: Also, if you think I should learn Basic Java before doing any of this, please link me to a place where I can learn the Basics of Java that are used by Minecraft. Thanks for your time.