Jump to content

cheezytacos

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by cheezytacos

  1. so... I would always recheck the instantiations and I would never see that the water sword was pointing to the fire sword the whole time. Thanks!
  2. So I have 2 classes for 2 different swords. The water sword which gives you waterbreathing and Speed underwater and the fire sword which gives you fireaspect 2 upon crafting. The water sword gets fireaspect 2 when I craft it. Fire Sword public class ItemFireDiremondSword extends ItemSword { public ItemFireDiremondSword(int par1, EnumToolMaterial par2EnumToolMaterial) { super(par1, par2EnumToolMaterial); } public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { System.out.println("Made the sword"); par1ItemStack.addEnchantment(Enchantment.fireAspect, 2); } } Water Sword public class ItemWaterDiremondSword extends ItemSword { public ItemWaterDiremondSword(int par1, EnumToolMaterial par2EnumToolMaterial) { super(par1, par2EnumToolMaterial); } public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) { EntityPlayer Player; if(entity instanceof EntityPlayer) { Player = (EntityPlayer) entity; if(Player.getCurrentEquippedItem().equals(this)) { if(Player.isInWater()) { Player.addPotionEffect((new PotionEffect(Potion.waterBreathing.getId(), 0, 1))); Player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 0, 10))); } } else { Player.curePotionEffects(itemstack); } } } I was really confused because in the basemod class, they are instantiated as using different materials and different items.
  3. Thank you very much! I did not realize that the basemod wasn't as good as the @mod. The @mod is a lot better when I took a look at it.
  4. Ive seen people post very organized code on the forums so im not sure how it will look. This is the main class. package SwiggitySwooty; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.src.BaseMod; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; public class StoneRods extends BaseMod{ //creates a creative tab for the mod public static CreativeTabs tabStoneRods = new CreativeTabs("tabStoneRods") { public ItemStack getIconItemStack() { return new ItemStack(StoneRods.Orb, 1, 0); } }; //initializes the items public final static Item CobbleStoneRod = new ItemCobbleStoneRod(2066).setTextureName("StoneRods:CobbleStoneRod").setUnlocalizedName("cobbleRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1); public final static Item StoneRod = new ItemStoneRod(2067).setTextureName("StoneRods:StoneRod").setUnlocalizedName("stoneRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1); public final static Item ChiseledStoneRod = new ItemChiseledStoneRod(2068).setTextureName("StoneRods:ChiseledStoneRod").setUnlocalizedName("chiseledStoneRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1); public final static Item EnderWand = new ItemEnderWand(2071).setTextureName("StoneRods:Ender_Wand").setUnlocalizedName("enderWand").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1).setMaxDamage(256); public final static Item Orb = new ItemOrb(2073).setTextureName("StoneRods:Orb").setUnlocalizedName("orb").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(64); public final static Item LavaWand = new ItemLavaWand(2072,0).setTextureName("StoneRods:Lava_Wand").setUnlocalizedName("lavaWand").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1); //enabling crafting of mod items and all vanilla items with ItemStacks //initializes the blocks //Overrides the getVersion() Method @Override public String getVersion() { return "1.1.1"; } //Overrides the load() method @Override public void load() { //This registers all names of objects not sure if actually works, but it shouldn't affect anything // LanguageRegistry.addName(CobbleStoneRod, "Rod of Cobble"); // LanguageRegistry.addName(StoneRod, "Rod of Stone"); // LanguageRegistry.addName(ChiseledStoneRod, "Rod of Stone Bricks"); // LanguageRegistry.addName(EnderWand, "Ender Wand"); // LanguageRegistry.addName(Orb, "Orb"); ItemStack OrbStack = new ItemStack(StoneRods.Orb); ItemStack DiamondStack = new ItemStack(Item.diamond); ItemStack GlassStack = new ItemStack(Block.glass); //This adds recipes without having the code in the client classes //GameRegistry.addShapedRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond}); //GameRegistry.addRecipe( //GameRegistry.addRecipe( GameRegistry.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', GlassStack, 'D', DiamondStack}); } } The CraftingManager class just adds the initialized items shown here to a crafting recipe. If I leave at least 1 of those recipes, the mod loads. If I dont have any listed, the mod doesnt. Mod doesnt load: //this.addRecipe(new ItemStack(StoneRods.CobbleStoneRod), new Object[] {"OBO", "LCW", "OBO", 'O', Block.obsidian, 'B', Item.blazeRod, 'L', Item.bucketLava, 'C', Block.cobblestone, 'W', Item.bucketWater}); //this.addRecipe(new ItemStack(StoneRods.StoneRod), new Object[] {"FSF", "LCL", "FSF", 'S', Block.furnaceIdle, 'L', Item.bucketLava, 'C', StoneRods.CobbleStoneRod, 'F', Block.obsidian}); //this.addRecipe(new ItemStack(StoneRods.ChiseledStoneRod), new Object[] {"SS", "SS", 'S', StoneRods.StoneRod}); //this.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond}); Mod Loads: this.addRecipe(new ItemStack(StoneRods.CobbleStoneRod), new Object[] {"OBO", "LCW", "OBO", 'O', Block.obsidian, 'B', Item.blazeRod, 'L', Item.bucketLava, 'C', Block.cobblestone, 'W', Item.bucketWater}); //this.addRecipe(new ItemStack(StoneRods.StoneRod), new Object[] {"FSF", "LCL", "FSF", 'S', Block.furnaceIdle, 'L', Item.bucketLava, 'C', StoneRods.CobbleStoneRod, 'F', Block.obsidian}); //this.addRecipe(new ItemStack(StoneRods.ChiseledStoneRod), new Object[] {"SS", "SS", 'S', StoneRods.StoneRod}); //this.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond});
  5. So when I was first creating the items in forge, I stuck in the recipes directly into the CraftingManager.java file in the correct location. I now want to remove the recipes and add them to my main class file. For some reason, when I remove the recipes from CraftingManager.java the mod refuses to load at all. This is my first time on the forums posting for help after hours of trying to figure this out. Also, how would I let people see my code on this forum? Any help or insight would be appreciated. Thanks.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.