diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:52:43 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:52:43 -0400 |
| commit | a11c98c6cad501e081837ec8fa2e323edaeb1ca3 (patch) | |
| tree | ab97a3e81bfa3eec2ff530ec55ff4a69e48f49e3 /TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java | |
Initial commitmaster
Diffstat (limited to 'TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java')
| -rwxr-xr-x | TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java b/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java new file mode 100755 index 0000000..e43b713 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java @@ -0,0 +1,66 @@ +package tf2crates.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemSpade;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemTool;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+import tlhpoeCore.util.MiscUtil;
+
+public class ItemModShovel extends ItemSpade {
+ public IIcon goldTexture;
+
+ public ItemModShovel(String name) {
+ super(ServerProxyTC.MOD_WEAPON);
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":weapon/" + name);
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ public ItemModShovel(String name, float dmg) {
+ this(name);
+
+ MiscUtil.replaceField("damageVsEntity", ItemTool.class, dmg, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ this.goldTexture =
+ register.registerIcon(ReferenceTC.ID + ":weapon/gold/"
+ + this.getUnlocalizedName().substring(5));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+}
\ No newline at end of file |
