Jump to content

[1.7.10]item wont break with right click? [SOLVED]


Recommended Posts

I made a sword item that summons in mobs while taking 1 durability. problem is when it reaches zero it doesn't break, and keeps reducing the durability. when I use the .setdamage as soon as I click the item it reduces the durability to zero and still works until I try to hit a mob, then I breaks. how should I fix this.

 

heres my code

package com.OlympiansMod.Item;

import com.OlympiansMod.entity.EntityUndead;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

public class DioceltiansSepter extends ItemSword{

public DioceltiansSepter(ToolMaterial p_i45356_1_) {
	super(p_i45356_1_);
	// TODO Auto-generated constructor stub
}

public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){
	if(!player.capabilities.isCreativeMode){

	itemstack.setItemDamage(itemstack.getItemDamage() + 1);
	player.attackEntityFrom(DamageSource.causeIndirectMagicDamage(player, player), 10);



	}	
	if(!world.isRemote){


	//for (int i = 0 ; i < 5 ; i++){
	EntityUndead undead = new EntityUndead(world);
	undead.setPosition(player.posX + 1, player.posY, player.posZ);
	world.spawnEntityInWorld(undead);

	EntityUndead undead2 = new EntityUndead(world);
	undead2.setPosition(player.posX, player.posY, player.posZ + 1);
	world.spawnEntityInWorld(undead2);

	EntityUndead undead3 = new EntityUndead(world);
	undead3.setPosition(player.posX, player.posY, player.posZ - 2);
	world.spawnEntityInWorld(undead3);

	EntityUndead undead4 = new EntityUndead(world);
	undead4.setPosition(player.posX - 2, player.posY, player.posZ);
	world.spawnEntityInWorld(undead4);

	EntityUndead undead5 = new EntityUndead(world);
	undead5.setPosition(player.posX + 1.5, player.posY, player.posZ);
	world.spawnEntityInWorld(undead5);



}



//}
	return itemstack;
}
}


Im serious don't look at it!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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