I am trying to export my mod, and I am running into a problem. Eclipse is not showing me any errors, but when i try to export my mod the assets folder is correct but nothing else will not export. I have traced it down to a couple files causing it but i cannot find the problem within the class. If anyone can help me with this it would be much appreciated.
if (!flag) {
itemstack.setItemDamage(29);
entityplayer.inventory.consumeInventoryItem(Main.MyItem_10.itemID);
}
//These next 3 lines play the gun sound
Minecraft mc = ModLoader.getMinecraftInstance();
mc.sndManager.playSoundFX("mymod:testsound.sniper", 1.0F, 1.0F);
entityplayer.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
world.spawnEntityInWorld(MyEntitySniper);
}
}
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() > 0)
{
itemstack.damageItem(-1, (EntityLivingBase)entity);;
}
}
@Override
public void addInformation(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("§9Sneak While Holding");
par3List.add("§9To Scope.");
par3List.add("\u00A74Must Be Winter Soldier To Use!");
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
}
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon(texturePath);
}
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
if (!par2World.isRemote)
{
//par3EntityPlayer.curePotionEffects(par1ItemStack);
par3EntityPlayer.setCurrentItemOrArmor(4, (new ItemStack(Main.MyHelmet_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(3, (new ItemStack(Main.MyChest_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(2, (new ItemStack(Main.MyLeggings_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(1, (new ItemStack(Main.MyBoots_3, 1)));
}
return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.glassBottle) : par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 32;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.drink;
}
/**
* 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)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
@Override
public void addInformation(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("§9Drink this to");
par3List.add("§9become the Hulk");
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
I am trying to export my mod, and I am running into a problem. Eclipse is not showing me any errors, but when i try to export my mod the assets folder is correct but nothing else will not export. I have traced it down to a couple files causing it but i cannot find the problem within the class. If anyone can help me with this it would be much appreciated.
Here are the classes
package mymod.items.sniper;
import java.util.List;
import mymod.Main;
import mymod.projectiles.sniper.MyEntitySniper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MySniper extends Item {
private String texturePath = "mymod:";
public MySniper(int ItemID, EnumToolMaterial material, String textureName)
{
super(ItemID);
this.setUnlocalizedName(textureName);
this.setMaxStackSize(1);
texturePath += textureName;
setMaxDamage(30);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon(texturePath);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world,
EntityPlayer entityplayer) {
boolean flag = entityplayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0;
if(itemstack.getItemDamage() == 0)
{
if (flag || entityplayer.inventory.hasItem(Main.MyItem_10.itemID)) {
if (!world.isRemote)
{
Vec3 look = entityplayer.getLookVec();
MyEntitySniper MyEntitySniper = new MyEntitySniper(world,entityplayer, 1, 1, 1);
MyEntitySniper.setPosition(
entityplayer.posX + look.xCoord,
entityplayer.posY + look.yCoord + 1.5,
entityplayer.posZ + look.zCoord);
MyEntitySniper.accelerationX = look.xCoord * 0.1;
MyEntitySniper.accelerationY = look.yCoord * 0.1;
MyEntitySniper.accelerationZ = look.zCoord * 0.1;
if (!flag) {
itemstack.setItemDamage(29);
entityplayer.inventory.consumeInventoryItem(Main.MyItem_10.itemID);
}
//These next 3 lines play the gun sound
Minecraft mc = ModLoader.getMinecraftInstance();
mc.sndManager.playSoundFX("mymod:testsound.sniper", 1.0F, 1.0F);
entityplayer.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
world.spawnEntityInWorld(MyEntitySniper);
}
}
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() > 0)
{
itemstack.damageItem(-1, (EntityLivingBase)entity);;
}
}
@Override
public void addInformation(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("§9Sneak While Holding");
par3List.add("§9To Scope.");
par3List.add("\u00A74Must Be Winter Soldier To Use!");
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
}
package mymod.items.hammer;
import java.util.List;
import mymod.Main;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ThorHammer extends Item {
private String texturePath = "mymod:";
public ThorHammer(int ItemID, EnumToolMaterial material, String textureName)
{
super(ItemID);
this.setUnlocalizedName(textureName);
this.setMaxStackSize(1);
texturePath += textureName;
setMaxDamage(100);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon(texturePath);
}
public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase player)
{
target.attackEntityFrom(DamageSource.generic, 30.0F);
return true;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world,
EntityPlayer entityplayer) {
if(itemstack.getItemDamage() == 0)
{
float f = 1.0F;
float f1 = entityplayer.prevRotationPitch
+ (entityplayer.rotationPitch - entityplayer.prevRotationPitch)
* f;
float f2 = entityplayer.prevRotationYaw
+ (entityplayer.rotationYaw - entityplayer.prevRotationYaw) * f;
double d = entityplayer.prevPosX
+ (entityplayer.posX - entityplayer.prevPosX) * (double) f;
double d1 = (entityplayer.prevPosY
+ (entityplayer.posY - entityplayer.prevPosY) * (double) f + 1.6200000000000001D)
- (double) entityplayer.yOffset;
double d2 = entityplayer.prevPosZ
+ (entityplayer.posZ - entityplayer.prevPosZ) * (double) f;
Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F);
float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F);
float f5 = -MathHelper.cos(-f1 * 0.01745329F);
float f6 = MathHelper.sin(-f1 * 0.01745329F);
float f7 = f4 * f5;
float f8 = f6;
float f9 = f3 * f5;
double d3 = 5000D;
Vec3 vec3d1 = vec3d.addVector((double) f7 * d3, (double) f8 * d3,
(double) f9 * d3);
MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(
vec3d, vec3d1, false, true);
if (movingobjectposition == null) {
return itemstack;
}
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
world.setSpawnLocation(i, j, k);
EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D);
entitybolt.setLocationAndAngles(i, j, k, 0, 0.0F);
{
world.spawnEntityInWorld(entitybolt);
itemstack.setItemDamage(99);
}
}
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() > 0)
{
itemstack.damageItem(-1, (EntityLivingBase)entity);;
}
}
@Override
public void addInformation(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("§9 WHOSOEVER HOLDS");
par3List.add("§9 THIS HAMMER, IF");
par3List.add("§9 HE BE WORTHY,");
par3List.add("§9SHALL POSSESS THE");
par3List.add("§9 POWER OF");
par3List.add("§9 THOR");
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
}
package mymod.items;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mymod.Main;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class MyBottle extends Item {
private String texturePath = "mymod:";
public MyBottle(int ItemID, String textureName)
{
super(ItemID);
this.setUnlocalizedName(textureName);
this.setCreativeTab(CreativeTabs.tabMaterials);
texturePath += textureName;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon(texturePath);
}
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
if (!par2World.isRemote)
{
//par3EntityPlayer.curePotionEffects(par1ItemStack);
par3EntityPlayer.setCurrentItemOrArmor(4, (new ItemStack(Main.MyHelmet_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(3, (new ItemStack(Main.MyChest_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(2, (new ItemStack(Main.MyLeggings_3, 1)));
par3EntityPlayer.setCurrentItemOrArmor(1, (new ItemStack(Main.MyBoots_3, 1)));
}
return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.glassBottle) : par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 32;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.drink;
}
/**
* 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)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
@Override
public void addInformation(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("§9Drink this to");
par3List.add("§9become the Hulk");
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
}
Here are some troubleshooting tips: (since Eclipse should tell you if you have an error)
p.s: As a mod creator, I strongly suggest you migrate to 1.10.2