-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathItemLanceUp.java
More file actions
78 lines (66 loc) · 2.14 KB
/
ItemLanceUp.java
File metadata and controls
78 lines (66 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package knight37x.lance;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.world.World;
public class ItemLanceUp extends Item {
private final Item switchTo;
private final String material;
public ItemLanceUp(int par1, Item switchTo, String material) {
super(par1);
setCreativeTab(CreativeTabs.tabCombat);
this.switchTo = switchTo;
this.material = material;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister reg) {
this.itemIcon = reg.registerIcon("Lance:lance" + this.material);
}
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return false;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.none;
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World par2World, EntityPlayer par3EntityPlayer) {
if(this.switchTo != null) {
ItemStack newLance = new ItemStack(this.switchTo, 1);
newLance.setItemDamage(itemstack.getItemDamage());
return newLance;
}
return itemstack;
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
return false;
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
return true;
}
@Override
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
return true;
}
}