diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 1ebf0c8ff..ca2ce4839 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -4872,7 +4872,7 @@ public class ModItems { ArmorMaterial aMatDesh = EnumHelper.addArmorMaterial("HBM_DESH", 150, new int[] { 3, 8, 6, 3 }, 0); aMatDesh.customCraftingMaterial = ModItems.ingot_desh; - steamsuit_helmet = new ArmorDesh(aMatDesh, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png").setCap(15F).setMod(0.5F) + steamsuit_helmet = new ArmorDesh(aMatDesh, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 216000, 500, 1, 50).setCap(15F).setMod(0.5F) .setFireproof(true) .setHasHardLanding(true) .addEffect(new PotionEffect(Potion.digSpeed.id, 20, 2)) @@ -4880,9 +4880,9 @@ public class ModItems { .addResistance("monoxide", 0F) .addResistance("fall", 0) .setUnlocalizedName("steamsuit_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_helmet"); - steamsuit_plate = new ArmorDesh(aMatDesh, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_plate"); - steamsuit_legs = new ArmorDesh(aMatDesh, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png").cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_legs"); - steamsuit_boots = new ArmorDesh(aMatDesh, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_boots"); + steamsuit_plate = new ArmorDesh(aMatDesh, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 216000, 500, 1, 50).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_plate"); + steamsuit_legs = new ArmorDesh(aMatDesh, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", Fluids.STEAM, 216000, 500, 1, 50).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_legs"); + steamsuit_boots = new ArmorDesh(aMatDesh, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 216000, 500, 1, 50).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_boots"); ArmorMaterial aMatAJR = EnumHelper.addArmorMaterial("HBM_T45AJR", 150, new int[] { 3, 8, 6, 3 }, 100); aMatAJR.customCraftingMaterial = ModItems.plate_armor_ajr; diff --git a/src/main/java/com/hbm/items/armor/ArmorDNT.java b/src/main/java/com/hbm/items/armor/ArmorDNT.java index 2c4a67e70..c71042018 100644 --- a/src/main/java/com/hbm/items/armor/ArmorDNT.java +++ b/src/main/java/com/hbm/items/armor/ArmorDNT.java @@ -67,7 +67,7 @@ public class ArmorDNT extends ArmorFSBPowered { HbmPlayerProps props = HbmPlayerProps.getData(player); /// SPEED /// - Multimap multimap = super.getItemAttributeModifiers(); + Multimap multimap = super.getAttributeModifiers(stack); multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "DNT SPEED", 0.25, 0)); player.getAttributeMap().removeAttributeModifiers(multimap); diff --git a/src/main/java/com/hbm/items/armor/ArmorDesh.java b/src/main/java/com/hbm/items/armor/ArmorDesh.java index ea67e0185..955997115 100644 --- a/src/main/java/com/hbm/items/armor/ArmorDesh.java +++ b/src/main/java/com/hbm/items/armor/ArmorDesh.java @@ -3,6 +3,7 @@ package com.hbm.items.armor; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.hbm.handler.ArmorModHandler; +import com.hbm.inventory.fluid.FluidType; import com.hbm.render.model.ModelArmorDesh; import cpw.mods.fml.relauncher.Side; @@ -13,10 +14,10 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; -public class ArmorDesh extends ArmorFSB { +public class ArmorDesh extends ArmorFSBFueled { - public ArmorDesh(ArmorMaterial material, int layer, int slot, String texture) { - super(material, layer, slot, texture); + public ArmorDesh(ArmorMaterial material, int layer, int slot, String texture, FluidType fuelType, int maxFuel, int fillRate, int consumption, int drain) { + super(material, layer, slot, texture, fuelType, maxFuel, fillRate, consumption, drain); } @Override diff --git a/src/main/java/com/hbm/items/armor/ArmorEuphemium.java b/src/main/java/com/hbm/items/armor/ArmorEuphemium.java index 0e51169e8..76b9f5daa 100644 --- a/src/main/java/com/hbm/items/armor/ArmorEuphemium.java +++ b/src/main/java/com/hbm/items/armor/ArmorEuphemium.java @@ -15,8 +15,6 @@ import com.hbm.util.ArmorUtil; public class ArmorEuphemium extends ItemArmor { - private String [] armourTypes = new String [] {"euphemium_helmet", "euphemium_chest", "euphemium_legs", "euphemium_boots"}; - public ArmorEuphemium(ArmorMaterial armorMaterial, int renderIndex, int armorType) { super(armorMaterial, renderIndex, armorType); this.setCreativeTab(null); @@ -52,14 +50,14 @@ public class ArmorEuphemium extends ItemArmor { } } - @Override + @Override public EnumRarity getRarity(ItemStack p_77613_1_) { - + return EnumRarity.epic; - } - - //do literally nothing lole - @Override - public void setDamage(ItemStack stack, int damage) { } + } + + //do literally nothing lole + @Override + public void setDamage(ItemStack stack, int damage) { } } diff --git a/src/main/java/com/hbm/items/armor/ArmorFSBFueled.java b/src/main/java/com/hbm/items/armor/ArmorFSBFueled.java new file mode 100644 index 000000000..d7cbfb61e --- /dev/null +++ b/src/main/java/com/hbm/items/armor/ArmorFSBFueled.java @@ -0,0 +1,80 @@ +package com.hbm.items.armor; + +import com.hbm.interfaces.IPartiallyFillable; +import com.hbm.inventory.fluid.FluidType; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class ArmorFSBFueled extends ArmorFSB implements IPartiallyFillable { + + FluidType fuelType; + public int maxFuel = 1; + public int fillRate; + public int consumption; + public int drain; + + public ArmorFSBFueled(ArmorMaterial material, int layer, int slot, String texture, FluidType fuelType, int maxFuel, int fillRate, int consumption, int drain) { + super(material, layer, slot, texture); + this.fuelType = fuelType; + this.fillRate = fillRate; + this.consumption = consumption; + this.drain = drain; + } + + @Override + public FluidType getType(ItemStack stack) { + return this.fuelType; + } + + @Override + public int getFill(ItemStack stack) { + if(stack.stackTagCompound == null) { + stack.stackTagCompound = new NBTTagCompound(); + return 0; + } + + return stack.stackTagCompound.getInteger("fuel"); + } + + @Override + public void setFill(ItemStack stack, int fill) { + if(stack.stackTagCompound == null) { + stack.stackTagCompound = new NBTTagCompound(); + } + + stack.stackTagCompound.setInteger("fuel", fill); + } + + @Override + public int getMaxFill(ItemStack stack) { + return this.maxFuel; + } + + @Override + public int getLoadSpeed(ItemStack stack) { + return this.fillRate; + } + + @Override + public int getUnloadSpeed(ItemStack stack) { + return 0; + } + + @Override + public void setDamage(ItemStack stack, int damage) { + this.setFill(stack, Math.max(this.getFill(stack) - (damage * consumption), 0)); + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { + + super.onArmorTick(world, player, stack); + + if(this.drain > 0 && ArmorFSB.hasFSBArmor(player) && !player.capabilities.isCreativeMode) { + this.setFill(stack, Math.max(this.getFill(stack) - this.drain, 0)); + } + } +} diff --git a/src/main/java/com/hbm/items/armor/ArmorFSBPowered.java b/src/main/java/com/hbm/items/armor/ArmorFSBPowered.java index 991530803..e85d2959f 100644 --- a/src/main/java/com/hbm/items/armor/ArmorFSBPowered.java +++ b/src/main/java/com/hbm/items/armor/ArmorFSBPowered.java @@ -27,14 +27,14 @@ public class ArmorFSBPowered extends ArmorFSB implements IBatteryItem { this.drain = drain; this.setMaxDamage(1); } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { - - list.add("Charge: " + BobMathUtil.getShortNumber(getCharge(stack)) + " / " + BobMathUtil.getShortNumber(maxPower)); - - super.addInformation(stack, player, list, ext); - } + + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + + list.add("Charge: " + BobMathUtil.getShortNumber(getCharge(stack)) + " / " + BobMathUtil.getShortNumber(maxPower)); + + super.addInformation(stack, player, list, ext); + } @Override public boolean isArmorEnabled(ItemStack stack) { @@ -42,80 +42,80 @@ public class ArmorFSBPowered extends ArmorFSB implements IBatteryItem { } @Override - public void chargeBattery(ItemStack stack, long i) { - if(stack.getItem() instanceof ArmorFSBPowered) { - if(stack.hasTagCompound()) { - stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") + i); - } else { - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setLong("charge", i); - } - } - } + public void chargeBattery(ItemStack stack, long i) { + if(stack.getItem() instanceof ArmorFSBPowered) { + if(stack.hasTagCompound()) { + stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") + i); + } else { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setLong("charge", i); + } + } + } @Override - public void setCharge(ItemStack stack, long i) { - if(stack.getItem() instanceof ArmorFSBPowered) { - if(stack.hasTagCompound()) { - stack.stackTagCompound.setLong("charge", i); - } else { - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setLong("charge", i); - } - } - } + public void setCharge(ItemStack stack, long i) { + if(stack.getItem() instanceof ArmorFSBPowered) { + if(stack.hasTagCompound()) { + stack.stackTagCompound.setLong("charge", i); + } else { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setLong("charge", i); + } + } + } @Override - public void dischargeBattery(ItemStack stack, long i) { - if(stack.getItem() instanceof ArmorFSBPowered) { - if(stack.hasTagCompound()) { - stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") - i); - } else { - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setLong("charge", this.maxPower - i); - } - - if(stack.stackTagCompound.getLong("charge") < 0) - stack.stackTagCompound.setLong("charge", 0); - } - } + public void dischargeBattery(ItemStack stack, long i) { + if(stack.getItem() instanceof ArmorFSBPowered) { + if(stack.hasTagCompound()) { + stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") - i); + } else { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setLong("charge", this.maxPower - i); + } + + if(stack.stackTagCompound.getLong("charge") < 0) + stack.stackTagCompound.setLong("charge", 0); + } + } @Override - public long getCharge(ItemStack stack) { - if(stack.getItem() instanceof ArmorFSBPowered) { - if(stack.hasTagCompound()) { - return stack.stackTagCompound.getLong("charge"); - } else { - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setLong("charge", ((ArmorFSBPowered)stack.getItem()).maxPower); - return stack.stackTagCompound.getLong("charge"); - } - } - - return 0; - } + public long getCharge(ItemStack stack) { + if(stack.getItem() instanceof ArmorFSBPowered) { + if(stack.hasTagCompound()) { + return stack.stackTagCompound.getLong("charge"); + } else { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setLong("charge", ((ArmorFSBPowered) stack.getItem()).maxPower); + return stack.stackTagCompound.getLong("charge"); + } + } + + return 0; + } @Override - public boolean showDurabilityBar(ItemStack stack) { - - return getCharge(stack) < maxPower; - } + public boolean showDurabilityBar(ItemStack stack) { + + return getCharge(stack) < maxPower; + } @Override - public double getDurabilityForDisplay(ItemStack stack) { - - return 1 - (double)getCharge(stack) / (double)maxPower; - } + public double getDurabilityForDisplay(ItemStack stack) { + + return 1 - (double) getCharge(stack) / (double) maxPower; + } @Override - public long getMaxCharge() { - return maxPower; - } + public long getMaxCharge() { + return maxPower; + } @Override - public long getChargeRate() { - return chargeRate; - } + public long getChargeRate() { + return chargeRate; + } @Override public long getDischargeRate() { @@ -123,17 +123,16 @@ public class ArmorFSBPowered extends ArmorFSB implements IBatteryItem { } @Override - public void setDamage(ItemStack stack, int damage) - { - this.dischargeBattery(stack, damage * consumption); - } - - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { - - super.onArmorTick(world, player, itemStack); - - if(this.drain > 0 && ArmorFSB.hasFSBArmor(player) && !player.capabilities.isCreativeMode) { - this.dischargeBattery(itemStack, drain); - } - } + public void setDamage(ItemStack stack, int damage) { + this.dischargeBattery(stack, damage * consumption); + } + + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + + super.onArmorTick(world, player, itemStack); + + if(this.drain > 0 && ArmorFSB.hasFSBArmor(player) && !player.capabilities.isCreativeMode) { + this.dischargeBattery(itemStack, drain); + } + } } diff --git a/src/main/java/com/hbm/items/armor/ArmorHEV.java b/src/main/java/com/hbm/items/armor/ArmorHEV.java index 28575587a..86b76f419 100644 --- a/src/main/java/com/hbm/items/armor/ArmorHEV.java +++ b/src/main/java/com/hbm/items/armor/ArmorHEV.java @@ -1,12 +1,8 @@ package com.hbm.items.armor; -import java.util.ArrayList; -import java.util.List; - import org.lwjgl.opengl.GL11; import com.hbm.extprop.HbmLivingProps; -import com.hbm.items.ModItems; import com.hbm.render.model.ModelArmorHEV; import cpw.mods.fml.relauncher.Side; @@ -16,14 +12,9 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; diff --git a/src/main/java/com/hbm/items/armor/ArmorHazmat.java b/src/main/java/com/hbm/items/armor/ArmorHazmat.java index feb9770e2..345223b8f 100644 --- a/src/main/java/com/hbm/items/armor/ArmorHazmat.java +++ b/src/main/java/com/hbm/items/armor/ArmorHazmat.java @@ -11,11 +11,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.util.ResourceLocation; public class ArmorHazmat extends ArmorFSB { diff --git a/src/main/java/com/hbm/items/armor/ArmorSchrabidium.java b/src/main/java/com/hbm/items/armor/ArmorSchrabidium.java index 370a6dc1e..427e44b3e 100644 --- a/src/main/java/com/hbm/items/armor/ArmorSchrabidium.java +++ b/src/main/java/com/hbm/items/armor/ArmorSchrabidium.java @@ -16,7 +16,6 @@ import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; public class ArmorSchrabidium extends ItemArmor implements ISpecialArmor { - private String [] armourTypes = new String [] {"schrabidium_helmet", "schrabidium_plate", "schrabidium_legs", "schrabidium_boots"}; public ArmorSchrabidium(ArmorMaterial armorMaterial, int renderIndex, int armorType) { super(armorMaterial, renderIndex, armorType); diff --git a/src/main/java/com/hbm/items/armor/ArmorTest.java b/src/main/java/com/hbm/items/armor/ArmorTest.java index 6b5697c6f..249e6abe4 100644 --- a/src/main/java/com/hbm/items/armor/ArmorTest.java +++ b/src/main/java/com/hbm/items/armor/ArmorTest.java @@ -8,7 +8,6 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; public class ArmorTest extends ItemArmor { - private String [] armourTypes = new String [] {"test_helmet", "test_chestplate", "test_leggings", "test_boots"}; public ArmorTest(ArmorMaterial armorMaterial, int renderIndex, int armorType) { super(armorMaterial, renderIndex, armorType); diff --git a/src/main/java/com/hbm/items/armor/ItemModAuto.java b/src/main/java/com/hbm/items/armor/ItemModAuto.java index bb771b8f8..4dd232198 100644 --- a/src/main/java/com/hbm/items/armor/ItemModAuto.java +++ b/src/main/java/com/hbm/items/armor/ItemModAuto.java @@ -1,7 +1,6 @@ package com.hbm.items.armor; import java.util.List; -import java.util.UUID; import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.ArmorModHandler; diff --git a/src/main/java/com/hbm/items/armor/ItemModHealth.java b/src/main/java/com/hbm/items/armor/ItemModHealth.java index b0d8a67ed..6e757153a 100644 --- a/src/main/java/com/hbm/items/armor/ItemModHealth.java +++ b/src/main/java/com/hbm/items/armor/ItemModHealth.java @@ -48,7 +48,7 @@ public class ItemModHealth extends ItemArmorMod { @Override public Multimap getModifiers(ItemStack armor) { - Multimap multimap = super.getItemAttributeModifiers(); + Multimap multimap = super.getAttributeModifiers(armor); multimap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(ArmorModHandler.UUIDs[((ItemArmor)armor.getItem()).armorType], "NTM Armor Mod Health", health, 0)); diff --git a/src/main/java/com/hbm/items/armor/ItemModInsert.java b/src/main/java/com/hbm/items/armor/ItemModInsert.java index c198d1fd4..a8f114c95 100644 --- a/src/main/java/com/hbm/items/armor/ItemModInsert.java +++ b/src/main/java/com/hbm/items/armor/ItemModInsert.java @@ -8,7 +8,6 @@ import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.ArmorModHandler; import com.hbm.items.ModItems; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -16,7 +15,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; public class ItemModInsert extends ItemArmorMod { @@ -120,8 +118,8 @@ public class ItemModInsert extends ItemArmorMod { if(speed == 1) return null; - - Multimap multimap = super.getItemAttributeModifiers(); + + Multimap multimap = super.getAttributeModifiers(armor); multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(ArmorModHandler.UUIDs[((ItemArmor)armor.getItem()).armorType], "NTM Armor Mod Speed", -1F + speed, 2)); diff --git a/src/main/java/com/hbm/items/armor/ItemModIron.java b/src/main/java/com/hbm/items/armor/ItemModIron.java index 84d3cce29..99b7fc753 100644 --- a/src/main/java/com/hbm/items/armor/ItemModIron.java +++ b/src/main/java/com/hbm/items/armor/ItemModIron.java @@ -32,7 +32,7 @@ public class ItemModIron extends ItemArmorMod { @Override public Multimap getModifiers(ItemStack armor) { - Multimap multimap = super.getItemAttributeModifiers(); + Multimap multimap = super.getAttributeModifiers(armor); multimap.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(ArmorModHandler.UUIDs[((ItemArmor)armor.getItem()).armorType], "NTM Armor Mod Knockback", 0.5, 0)); diff --git a/src/main/java/com/hbm/items/armor/ItemModServos.java b/src/main/java/com/hbm/items/armor/ItemModServos.java index 82a9f4509..cb07d46f3 100644 --- a/src/main/java/com/hbm/items/armor/ItemModServos.java +++ b/src/main/java/com/hbm/items/armor/ItemModServos.java @@ -91,7 +91,7 @@ public class ItemModServos extends ItemArmorMod { @Override public Multimap getModifiers(ItemStack armor) { - Multimap multimap = super.getItemAttributeModifiers(); + Multimap multimap = super.getAttributeModifiers(armor); ItemArmor item = (ItemArmor)armor.getItem(); diff --git a/src/main/java/com/hbm/items/armor/ItemModTesla.java b/src/main/java/com/hbm/items/armor/ItemModTesla.java index 6591b4d88..b09a37770 100644 --- a/src/main/java/com/hbm/items/armor/ItemModTesla.java +++ b/src/main/java/com/hbm/items/armor/ItemModTesla.java @@ -3,18 +3,12 @@ package com.hbm.items.armor; import java.util.ArrayList; import java.util.List; -import org.lwjgl.opengl.GL11; - import com.hbm.handler.ArmorModHandler; import com.hbm.render.model.ModelBackTesla; -import com.hbm.render.util.BeamPronter; -import com.hbm.render.util.BeamPronter.EnumBeamType; -import com.hbm.render.util.BeamPronter.EnumWaveType; import com.hbm.tileentity.machine.TileEntityTesla; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.entity.EntityLivingBase; @@ -22,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderPlayerEvent; public class ItemModTesla extends ItemArmorMod { diff --git a/src/main/java/com/hbm/items/armor/ItemModV1.java b/src/main/java/com/hbm/items/armor/ItemModV1.java index 738c71ccf..f6e5eb3f6 100644 --- a/src/main/java/com/hbm/items/armor/ItemModV1.java +++ b/src/main/java/com/hbm/items/armor/ItemModV1.java @@ -1,19 +1,31 @@ package com.hbm.items.armor; import java.util.List; +import java.util.UUID; +import com.google.common.collect.Multimap; import com.hbm.handler.ArmorModHandler; -import com.hbm.items.ModItems; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; public class ItemModV1 extends ItemArmorMod { + + private static final UUID speed = UUID.fromString("1d11e63e-28c4-4e14-b09f-fe0bd1be708f"); public ItemModV1() { super(ArmorModHandler.extra, false, true, false, false); } + + @Override + public Multimap getModifiers(ItemStack armor) { + Multimap multimap = super.getAttributeModifiers(armor); + multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "V1 SPEED", 0.5, 2)); + return multimap; + } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { diff --git a/src/main/java/com/hbm/items/armor/ItemModWD40.java b/src/main/java/com/hbm/items/armor/ItemModWD40.java index 496902ab6..b01f48217 100644 --- a/src/main/java/com/hbm/items/armor/ItemModWD40.java +++ b/src/main/java/com/hbm/items/armor/ItemModWD40.java @@ -50,7 +50,7 @@ public class ItemModWD40 extends ItemArmorMod { @Override public Multimap getModifiers(ItemStack armor) { - Multimap multimap = super.getItemAttributeModifiers(); + Multimap multimap = super.getAttributeModifiers(armor); multimap.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(ArmorModHandler.UUIDs[((ItemArmor)armor.getItem()).armorType], "NTM Armor Mod Health", 4, 0)); diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index d7dd5518f..95a7ff239 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -81,6 +81,7 @@ import com.hbm.tileentity.machine.rbmk.*; import com.hbm.tileentity.machine.storage.*; import com.hbm.tileentity.network.*; import com.hbm.tileentity.turret.*; +import com.hbm.util.SoundUtil; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -674,6 +675,8 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.addNewArmourRendererPrefix("7"); RenderingRegistry.addNewArmourRendererPrefix("8"); RenderingRegistry.addNewArmourRendererPrefix("9"); + + SoundUtil.addSoundCategory("ntmMachines"); } @Override diff --git a/src/main/java/com/hbm/util/SoundUtil.java b/src/main/java/com/hbm/util/SoundUtil.java new file mode 100644 index 000000000..aabb41872 --- /dev/null +++ b/src/main/java/com/hbm/util/SoundUtil.java @@ -0,0 +1,44 @@ +package com.hbm.util; + +import java.util.Map; + +import com.google.common.collect.Maps; + +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.SoundCategory; +import net.minecraft.client.settings.GameSettings; +import net.minecraftforge.common.util.EnumHelper; + +public class SoundUtil { + + public static void addSoundCategory(String name) { + + try { + SoundCategory category = EnumHelper.addEnum(SoundCategory.class, name.toUpperCase(), new Class[] { String.class, int.class }, new Object[] { name, SoundCategory.values().length }); + + Map nameMapping = (Map) ReflectionHelper.findField(SoundCategory.class, "field_147168_j").get(null); + Map idMapping = (Map) ReflectionHelper.findField(SoundCategory.class, "field_147169_k").get(null); + + Map mapSoundLevelsOrig = (Map) ReflectionHelper.findField(GameSettings.class, "mapSoundLevels" /* TODO: add obfus case */).get(Minecraft.getMinecraft().gameSettings); + Map mapSoundLevels = Maps.newEnumMap(SoundCategory.class); //(Map) ReflectionHelper.findField(GameSettings.class, "mapSoundLevels" /* TODO: add obfus case */).get(Minecraft.getMinecraft().gameSettings); + + nameMapping.put(category.getCategoryName(), category); + idMapping.put(Integer.valueOf(category.getCategoryId()), category); + + //we have to copy the new map before putting it in the settings because otherwise the EnumMap fucking dies + for(Object o : mapSoundLevelsOrig.keySet()) { + mapSoundLevels.put(o, mapSoundLevelsOrig.get(o)); + } + + mapSoundLevels.put(category, 1F); + + //ReflectionHelper.setPrivateValue(SoundCategory.class, null, nameMapping, "field_147168_j"); + //ReflectionHelper.setPrivateValue(SoundCategory.class, null, idMapping, "field_147169_k"); + ReflectionHelper.setPrivateValue(GameSettings.class, Minecraft.getMinecraft().gameSettings, mapSoundLevels, "mapSoundLevels"); + + } catch(Exception e) { + e.printStackTrace(); + } + } +}