For some reason in my main code, I keep getting an error for the sword im trying to add, saying that the other class it is referencing is undefined, when, as far as I can tell, I have defined it.
Main Class Code:
package flarespire;
//Basic importing
import flarespire.tools.Flaresword;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
* Basic needed forge stuff
*/
@Mod(modid="AdvancedWeapons",name="Advanced Weapons Mod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class ItemList {
//ToolMaterial
//Telling forge that we are creating these
//items
public static Item lightcrystal;
public static Item shadowcrystal;
public static Item firecrystal;
public static Item watercrystal;
public static Item aircrystal;
public static Item thundercrystal;
public static Item crystalvessle;
public static Item ultimacore;
public static Item ultimabase;
public static Item crystalineblade;
//tools
public static EnumToolMaterial UltimaWeapon = EnumHelper.addToolMaterial("ultimaweapon", 3, 1950, 9.0F, 3.0F, 10);
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
// define items
lightcrystal = new Flareitems(2500).setUnlocalizedName("lightcrystal");
shadowcrystal = new Flareitems(2501).setUnlocalizedName("shadowcrystal");
firecrystal = new Flareitems(2502).setUnlocalizedName("firecrystal");
watercrystal = new Flareitems(2503).setUnlocalizedName("watercrystal");
aircrystal = new Flareitems(2504).setUnlocalizedName("aircrystal");
thundercrystal = new Flareitems(2505).setUnlocalizedName("thundercrystal");
crystalvessle = new Flareitems(2506).setUnlocalizedName("crystalvessle");
ultimacore = new Flareitems(2507).setUnlocalizedName("ultimacore");
ultimabase = new Flareitems(2508).setUnlocalizedName("ultimabase");
crystalineblade = new Flareitems(2509).setUnlocalizedName("crystalineblade");
// define tools
UltimaWeapon = new Flaresword(2510, UltimaWeapon).setUnlocalizedName("ultimaweapon");
// define blocks
//adding names
//items
LanguageRegistry.addName(lightcrystal, "Light Crystal");
LanguageRegistry.addName(shadowcrystal, "Shadow Crystal");
LanguageRegistry.addName(firecrystal, "Fire Crystal");
LanguageRegistry.addName(watercrystal, "Water Crystal");
LanguageRegistry.addName(aircrystal, "Air Crystal");
LanguageRegistry.addName(thundercrystal, "Thunder Crystal");
LanguageRegistry.addName(crystalvessle, "Crystal Vessle");
LanguageRegistry.addName(ultimacore, "Ultima Core");
LanguageRegistry.addName(ultimabase, "Ultima Base");
LanguageRegistry.addName(crystalineblade, "Crystaline Blade");
//tools
LanguageRegistry.addName(UltimaWeapon, "Ultima Weapon");
//blocks
//crafting
GameRegistry.addRecipe(new ItemStack(ultimacore,1), new Object[]{
"LFS","WVT","SAL",'V',crystalvessle,'L',lightcrystal,'S',shadowcrystal,'F',firecrystal,'W',watercrystal,'A',aircrystal,'T',thundercrystal,
});
GameRegistry.addRecipe(new ItemStack(ultimabase,1), new Object[]{
"BOB","OCO","LSL",'C',ultimacore,'O',Block.obsidian,'L',Item.leather,'S',Item.stick,'B',Item.blazeRod,
});
GameRegistry.addRecipe(new ItemStack(crystalineblade,1), new Object[]{
"QQQ","QDQ","QNQ",'N',Item.netherStar,'D',Item.diamond,'Q',Item.netherQuartz,
});
}
}
Supposed undefined class's code:
package flarespire.tools;
import flarespire.ItemList;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSword;
public class Flaresword extends ItemSword {
public Flaresword(int ItemID, EnumToolMaterial ultimaweapon){
super(ItemID, ultimaweapon);
setCreativeTab(CreativeTabs.tabCombat); }//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
if (itemID == ItemList.ultimaweapon.itemID) {
this.itemIcon = reg.registerIcon("ultimaweapon"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
I hope this issue can be resolved soon as its really driving me up the wall. Also, sorry for not using spoiler tags, I wasnt sure on how to impliment it here.
This should take care of the problem. You had your Flaresword using the same variable as your EnumToolMaterial. I created a new variable for sword and moved the UltimaWeapon initialization into your load method. Not sure if that's required, but it's always done good by me.
Main Modding Class ItemList.java
package flarespire;
//Basic importing
import flarespire.tools.Flaresword;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
* Basic needed forge stuff
*/
@Mod(modid="AdvancedWeapons",name="Advanced Weapons Mod",version="v1.0")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class Itemlist {
//ToolMaterial
//Telling forge that we are creating these
//items
public static Item lightcrystal;
public static Item shadowcrystal;
public static Item firecrystal;
public static Item watercrystal;
public static Item aircrystal;
public static Item thundercrystal;
public static Item crystalvessle;
public static Item ultimacore;
public static Item ultimabase;
public static Item crystalineblade;
public static Item flaresword;
//tools
public static EnumToolMaterial UltimaWeapon;
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
// define items
lightcrystal = new Flareitems(2500).setUnlocalizedName("lightcrystal");
shadowcrystal = new Flareitems(2501).setUnlocalizedName("shadowcrystal");
firecrystal = new Flareitems(2502).setUnlocalizedName("firecrystal");
watercrystal = new Flareitems(2503).setUnlocalizedName("watercrystal");
aircrystal = new Flareitems(2504).setUnlocalizedName("aircrystal");
thundercrystal = new Flareitems(2505).setUnlocalizedName("thundercrystal");
crystalvessle = new Flareitems(2506).setUnlocalizedName("crystalvessle");
ultimacore = new Flareitems(2507).setUnlocalizedName("ultimacore");
ultimabase = new Flareitems(2508).setUnlocalizedName("ultimabase");
crystalineblade = new Flareitems(2509).setUnlocalizedName("crystalineblade");
// define tools
UltimaWeapon = EnumHelper.addToolMaterial("ultimaweaponMaterial", 3, 1950, 9.0F, 3.0F, 10);
flaresword = new Flaresword(2510, UltimaWeapon).setUnlocalizedName("FlareSword");
// define blocks
//adding names
//items
LanguageRegistry.addName(lightcrystal, "Light Crystal");
LanguageRegistry.addName(shadowcrystal, "Shadow Crystal");
LanguageRegistry.addName(firecrystal, "Fire Crystal");
LanguageRegistry.addName(watercrystal, "Water Crystal");
LanguageRegistry.addName(aircrystal, "Air Crystal");
LanguageRegistry.addName(thundercrystal, "Thunder Crystal");
LanguageRegistry.addName(crystalvessle, "Crystal Vessle");
LanguageRegistry.addName(ultimacore, "Ultima Core");
LanguageRegistry.addName(ultimabase, "Ultima Base");
LanguageRegistry.addName(crystalineblade, "Crystaline Blade");
//tools
LanguageRegistry.addName(UltimaWeapon, "Ultima Weapon");
//blocks
//crafting
GameRegistry.addRecipe(new ItemStack(ultimacore,1), new Object[]{
"LFS","WVT","SAL",'V',crystalvessle,'L',lightcrystal,'S',shadowcrystal,'F',firecrystal,'W',watercrystal,'A',aircrystal,'T',thundercrystal,
});
GameRegistry.addRecipe(new ItemStack(ultimabase,1), new Object[]{
"BOB","OCO","LSL",'C',ultimacore,'O',Block.obsidian,'L',Item.leather,'S',Item.stick,'B',Item.blazeRod,
});
GameRegistry.addRecipe(new ItemStack(crystalineblade,1), new Object[]{
"QQQ","QDQ","QNQ",'N',Item.netherStar,'D',Item.diamond,'Q',Item.netherQuartz,
});
}
}
And your Flaresword.java
package flarespire.tools;
import flarespire.Itemlist;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSword;
public class Flaresword extends ItemSword {
public Flaresword(int ItemID, EnumToolMaterial ultimaweapon){
super(ItemID, ultimaweapon);
setCreativeTab(CreativeTabs.tabCombat); }//Tells the game what creative mode tab it goes in
public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
if (itemID == Itemlist.flaresword.itemID) {
this.itemIcon = reg.registerIcon("ultimaweapon"); // You can also replace blockID and blockIcon with itemID and itemIcon
}
}
}
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
Thank you so much, I couldn't figure out what was going on and you just saved my mod from being scrapped. I had to make some minor tweaks (mainly name mismatches where some uppercase letters had become lower case) but it works perfectly now.
Glad to help! Don't hesitate to shout if you need anymore help!
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
I need it so in my mod if you're holding a item in your hand or in your inventory you get an effect.
if you can please include that in your next video!
Does anyone know how to make custom furnaces? As in, add a furnace that cooks faster and etc. If so please let me know! Thanks!
Check out ScratchForFun's channel on YouTube. He has a very comprehensive Custom Furnace tutorial which he duplicates later on and turns that one into a Macerator.
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
Check out ScratchForFun's channel on YouTube. He has a very comprehensive Custom Furnace tutorial which he duplicates later on and turns that one into a Macerator.
I have a question, Is it possible to make a bow that will fire normally on the right mouse button,but do the damage of say an iron sword when used in close combat as a melee weapon on the left mouse button?
I think that's doable. I will do a mashup of the sword class and the bow class to see what I can come up with.
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
thanks nxwhitney...You're definitely going in the credits of my mod.Interesting idea isn't it should make combat a little more interesting.Also on a relate note, does anyone know how to make an item spawn with enchantments on it, like the enchanted books for example?
So here's what I've come up with. Still having trouble with the textures when you're pulling the bow back, but other than that, it works.
Main Class: Put these wherever you have your other stuff located. Note that you can't just copy/paste it over, the different parts will need to be in the load while the declarations just need to be in the class.
public static EnumToolMaterial toolTopaz;
public static Item itemTopazBowSword;
toolTopaz = EnumHelper.addToolMaterial("topazToolMaterial", 2, 3000, 12.0F, 4.0F, 15);
itemTopazBowSword = new ItemBowSword(13208, toolTopaz).setUnlocalizedName("TopazBowSword");registerItem(itemTopazBowSword, "Topaz BowSword");
ItemBowSword Class:
package net.flemyncraft.mod.item;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.flemyncraft.mod.Flemyncraft;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class ItemBowSword extends Item
{
private float weaponDamage;
private final EnumToolMaterial toolMaterial;
public static final String[] bowPullIconNameArray = new String[] {"_bspulling_0", "_bspulling_1", "_bspulling_2"};
@SideOnly(Side.CLIENT)
private Icon[] iconArray;
public ItemBowSword(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1);
this.toolMaterial = par2EnumToolMaterial;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
this.setCreativeTab(CreativeTabs.tabCombat);
this.weaponDamage = 4.0F + par2EnumToolMaterial.getDamageVsEntity();
}
public float func_82803_g()
{
return this.toolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
int j = this.getMaxItemUseDuration(par1ItemStack) - par4;
ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return;
}
j = event.charge;
boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
{
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if ((double)f < 0.1D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 2.0F);
if (f == 1.0F)
{
entityarrow.setIsCritical(true);
}
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
if (k > 0)
{
entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
}
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
if (l > 0)
{
entityarrow.setKnockbackStrength(l);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
{
entityarrow.setFire(100);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag)
{
entityarrow.canBePickedUp = 2;
}
else
{
par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
}
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(entityarrow);
}
}
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return event.result;
}
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block.blockID == Block.web.blockID)
{
return 15.0F;
}
else
{
Material material = par2Block.blockMaterial;
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.pumpkin ? 1.0F : 1.5F;
}
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
par1ItemStack.damageItem(1, par3EntityLivingBase);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(2, par7EntityLivingBase);
}
return true;
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
/*public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}*/
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
/**
* Return the name for this tool's material.
*/
public String getToolMaterialName()
{
return this.toolMaterial.toString();
}
/**
* Return whether this item is repairable in an anvil.
*/
/**
* Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
*/
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
return multimap;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(Flemyncraft.modid + ":" + Flemyncraft.itemTopazBowSword.getUnlocalizedName().substring(5) + "_bsstandby");
//this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_bsstandby");
this.iconArray = new Icon[bowPullIconNameArray.length];
for (int i = 0; i < this.iconArray.length; ++i)
{
this.iconArray[i] = par1IconRegister.registerIcon(Flemyncraft.modid + ":" + Flemyncraft.itemTopazBowSword.getUnlocalizedName().substring(5) + bowPullIconNameArray[i]);
System.out.println(iconArray[i]);
}
}
public Icon getItemIconForUseDuration(int par1)
{
return this.iconArray[par1];
}
}
I wouldn't consider it ready for deployment yet, as I've hard-coded the textures in here, so this class will only ever show textures for the Topaz one I've created. Once I have the textures worked out I will upload the final. But this should give you an idea of how it will look. Textures included below.
Not sure about the enchanted items. I will look around in the code and see what I can find.
Got it all worked out. Credit to coolAlias for his code on the ArrowNock texture fix.
Flarespire.java
package net.flarespire.mod;
import net.minecraft.block.Block;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = Flarespire.modid, name = "Flarespire", version = "Pre-Alpha v0.01")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Flarespire {
public static final String modid = "flarespire";
public static EnumToolMaterial toolSomeName;
public static Item itemBowSword;
@EventHandler
public void load(FMLInitializationEvent e){
toolSomeName = EnumHelper.addToolMaterial("topazToolMaterial", 2, 3000, 12.0F, 4.0F, 15);
itemBowSword = new BowSword(13208, toolSomeName).setUnlocalizedName("BowSword");
GameRegistry.registerItem(itemBowSword, "BowSword");
LanguageRegistry.addName(itemBowSword, "BowSword");
GameRegistry.addRecipe(new ItemStack(itemBowSword, 1), new Object[]{"ISG", "S G", "ISG", 'I', Item.ingotIron, 'S', Item.stick, 'G', Item.silk});
}
}
BowSword.java
package net.flarespire.mod;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.flarespire.mod.Flarespire;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class BowSword extends Item
{
private float weaponDamage;
private final EnumToolMaterial toolMaterial;
public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"};
@SideOnly(Side.CLIENT)
private Icon[] iconArray;
public BowSword(int par1, EnumToolMaterial par2EnumToolMaterial)
{
super(par1);
this.toolMaterial = par2EnumToolMaterial;
this.maxStackSize = 1;
this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
this.setCreativeTab(CreativeTabs.tabCombat);
this.weaponDamage = 4.0F + par2EnumToolMaterial.getDamageVsEntity();
}
public float func_82803_g()
{
return this.toolMaterial.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
int j = this.getMaxItemUseDuration(par1ItemStack) - par4;
ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return;
}
j = event.charge;
boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
{
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if ((double)f < 0.1D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 2.0F);
if (f == 1.0F)
{
entityarrow.setIsCritical(true);
}
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
if (k > 0)
{
entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
}
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
if (l > 0)
{
entityarrow.setKnockbackStrength(l);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
{
entityarrow.setFire(100);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag)
{
entityarrow.canBePickedUp = 2;
}
else
{
par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
}
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(entityarrow);
}
}
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return event.result;
}
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block.blockID == Block.web.blockID)
{
return 15.0F;
}
else
{
Material material = par2Block.blockMaterial;
return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.pumpkin ? 1.0F : 1.5F;
}
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
par1ItemStack.damageItem(1, par3EntityLivingBase);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
{
if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
{
par1ItemStack.damageItem(2, par7EntityLivingBase);
}
return true;
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
/*public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}*/
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
/**
* Return the name for this tool's material.
*/
public String getToolMaterialName()
{
return this.toolMaterial.toString();
}
/**
* Return whether this item is repairable in an anvil.
*/
/**
* Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
*/
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
return multimap;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon((Flarespire.modid + ":" + this.getUnlocalizedName().substring(5)) + "_standby");
this.iconArray = new Icon[bowPullIconNameArray.length];
for (int i = 0; i < this.iconArray.length; ++i)
{
this.iconArray[i] = par1IconRegister.registerIcon((Flarespire.modid + ":" + this.getUnlocalizedName().substring(5)) + "_" + bowPullIconNameArray[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (usingItem == null) { return itemIcon; }
int ticksInUse = stack.getMaxItemUseDuration() - useRemaining;
if (ticksInUse > 18) {
return iconArray[2];
} else if (ticksInUse > 14) {
return iconArray[1];
} else if (ticksInUse > 0) {
return iconArray[0];
} else {
return itemIcon;
}
}
}
I based the rextures above on the original bow and pulling textures. Feel free to do whatever you want along with the textures, EnumToolMaterial, and Recipe.
Let me know if you need any help with implementation!
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
The Meaning of Life, the Universe, and Everything.
Join Date:
2/17/2012
Posts:
49
Minecraft:
Pyroglyph
Member Details
Hi, I keep getting an error when I run install in Forge.
Download of minecraft_server.1.6.4.jar failed hash check, deleting <somehash> <somehash>
Something failed verifying minecraft files, see log for details.
Decompile Exception: 1
So my questions are:
Whenever I try to run the mod on eclipse it just says this: Apr 02, 2014 5:56:19 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
Apr 02, 2014 5:56:19 PM net.minecraft.launchwrapper.LogWrapper log
SEVERE: Unable to launch
java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:102)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
Whenever I try to run the mod on eclipse it just says this: Apr 02, 2014 5:56:19 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
Apr 02, 2014 5:56:19 PM net.minecraft.launchwrapper.LogWrapper log
SEVERE: Unable to launch
java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:102)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
Can someone help me?
Can you post your code so we can see the full picture and try to diagnose for you?
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
Hi, I keep getting an error when I run install in Forge. Download of minecraft_server.1.6.4.jar failed hash check, deleting <somehash> <somehash> Something failed verifying minecraft files, see log for details. Decompile Exception: 1
This thread looks like it addresses what you're going through. There's also some very specific instuctions on gradle setup, etc.
Thanks for the reply, I have done my homework on this matter and have come across that post too. I have tried gradle (964) and it doesn't look the same as 965. I'm not sure what gradle is or what it does that's different. I'm new to modding
Also, with gradle where do I put my eclipse workspace path? I see Synasonic has net.minecraft imports. I tried doing what he said to do but instead I don't have the net.minecraft imports. Is the install.cmd (or gradlew.bat) suppoed to get them anyway?
Thanks for the reply, I have done my homework on this matter and have come across that post too. I have tried gradle (964) and it doesn't look the same as 965. I'm not sure what gradle is or what it does that's different. I'm new to modding
Also, with gradle where do I put my eclipse workspace path? I see Synasonic has net.minecraft imports. I tried doing what he said to do but instead I don't have the net.minecraft imports. Is the install.cmd (or gradlew.bat) suppoed to get them anyway?
Help
That confused me too when I first tried gradle for 1.7.2. From what I understand is that gradle is the devlivery system that they use get all of the files downloaded to you. The source files for minecraft and forge show up under Referenced Libraries. Here's a screen cap so you can see where they are now. You have expand a bit of the tree to see it.
Rollback Post to RevisionRollBack
If someone helps you out, don't hesitate to hit the green button to give them some props.
This should take care of the problem. You had your Flaresword using the same variable as your EnumToolMaterial. I created a new variable for sword and moved the UltimaWeapon initialization into your load method. Not sure if that's required, but it's always done good by me.
Main Modding Class ItemList.java
And your Flaresword.java
Glad to help! Don't hesitate to shout if you need anymore help!
I need it so in my mod if you're holding a item in your hand or in your inventory you get an effect.
if you can please include that in your next video!
Thanks Syn!:steve_joyous:
Check out ScratchForFun's channel on YouTube. He has a very comprehensive Custom Furnace tutorial which he duplicates later on and turns that one into a Macerator.
If you need something, look on other people's channels, otherwise copy code from the basics and try to edit it.
Ok, thanks!
I did try to copy the code and i wouldn't work, and also i didn't really know what i was doing lol ( as in how to change the properties i wanted too.)
I understand that. I kinda don't understand code that well either.
(Lol, my avatar is a Star Trek Borg and I don't understand programming. )
I think that's doable. I will do a mashup of the sword class and the bow class to see what I can come up with.
Main Class: Put these wherever you have your other stuff located. Note that you can't just copy/paste it over, the different parts will need to be in the load while the declarations just need to be in the class.
ItemBowSword Class:
I wouldn't consider it ready for deployment yet, as I've hard-coded the textures in here, so this class will only ever show textures for the Topaz one I've created. Once I have the textures worked out I will upload the final. But this should give you an idea of how it will look. Textures included below.
Not sure about the enchanted items. I will look around in the code and see what I can find.
Flarespire.java
BowSword.java
I based the rextures above on the original bow and pulling textures. Feel free to do whatever you want along with the textures, EnumToolMaterial, and Recipe.
Let me know if you need any help with implementation!
I had them listed under: assets.flarespire.textures.items
Where do you have them?
Show me your code and we'll see if we can get it worked. Also show me the packages that you have for your textures. Here is what mine looked like.
I think I've done them a bit differently from how Synasonic did them.
Hi, I keep getting an error when I run install in Forge.
Download of minecraft_server.1.6.4.jar failed hash check, deleting <somehash> <somehash>
Something failed verifying minecraft files, see log for details.
Decompile Exception: 1
So my questions are:
No, my computer is not too slow.
[email protected], GALAX GTX 980Ti HOF 6GB, Seagate 1TB 7200RPM HDD, Crucial MX100 256GB SSD, 2x Kingston 8GB@1866MHz, EVGA NEX750G PSU
INFO: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
Apr 02, 2014 5:56:19 PM net.minecraft.launchwrapper.LogWrapper log
SEVERE: Unable to launch
java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:102)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
Can someone help me?
Can you post your code so we can see the full picture and try to diagnose for you?
http://www.minecraftforge.net/forum/index.php?topic=17879.0
This thread looks like it addresses what you're going through. There's also some very specific instuctions on gradle setup, etc.
Thanks for the reply, I have done my homework on this matter and have come across that post too. I have tried gradle (964) and it doesn't look the same as 965. I'm not sure what gradle is or what it does that's different. I'm new to modding
Also, with gradle where do I put my eclipse workspace path? I see Synasonic has net.minecraft imports. I tried doing what he said to do but instead I don't have the net.minecraft imports. Is the install.cmd (or gradlew.bat) suppoed to get them anyway?
Help
No, my computer is not too slow.
[email protected], GALAX GTX 980Ti HOF 6GB, Seagate 1TB 7200RPM HDD, Crucial MX100 256GB SSD, 2x Kingston 8GB@1866MHz, EVGA NEX750G PSU
That confused me too when I first tried gradle for 1.7.2. From what I understand is that gradle is the devlivery system that they use get all of the files downloaded to you. The source files for minecraft and forge show up under Referenced Libraries. Here's a screen cap so you can see where they are now. You have expand a bit of the tree to see it.