diff --git a/resources/assets/resonantinduction/languages/en_US.properties b/resources/assets/resonantinduction/languages/en_US.properties index eab8e4cb..6715e36c 100755 --- a/resources/assets/resonantinduction/languages/en_US.properties +++ b/resources/assets/resonantinduction/languages/en_US.properties @@ -8,6 +8,13 @@ tile.resonantinduction\:multimeter.name=Multimeter tile.resonantinduction\:contractor.name=Electromagnetic Contractor tile.resonantinduction\:battery.name=Modular Battery +tile.resonantinduction\:wire.copper.name=Copper Wire +tile.resonantinduction\:wire.tin.name=Tin Wire +tile.resonantinduction\:wire.iron.name=Iron Wire +tile.resonantinduction\:wire.aluminum.name=Aluminum Wire +tile.resonantinduction\:wire.silver.name=Silver Wire +tile.resonantinduction\:wire.superconductor.name=Superconductor Wire + ## Items item.resonantinduction\:quantumEntangler.name=Quantum Entangler item.resonantinduction\:capacitor.name=Capacitor Cell diff --git a/resources/assets/resonantinduction/textures/items/wire.aluminum.png b/resources/assets/resonantinduction/textures/items/wire.aluminum.png new file mode 100644 index 00000000..503fdb1a Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.aluminum.png differ diff --git a/resources/assets/resonantinduction/textures/items/wire.copper.png b/resources/assets/resonantinduction/textures/items/wire.copper.png new file mode 100644 index 00000000..7e414b52 Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.copper.png differ diff --git a/resources/assets/resonantinduction/textures/items/wire.iron.png b/resources/assets/resonantinduction/textures/items/wire.iron.png new file mode 100644 index 00000000..43a7598e Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.iron.png differ diff --git a/resources/assets/resonantinduction/textures/items/wire.silver.png b/resources/assets/resonantinduction/textures/items/wire.silver.png new file mode 100644 index 00000000..43a7598e Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.silver.png differ diff --git a/resources/assets/resonantinduction/textures/items/wire.superconductor.png b/resources/assets/resonantinduction/textures/items/wire.superconductor.png new file mode 100644 index 00000000..73bf0e7f Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.superconductor.png differ diff --git a/resources/assets/resonantinduction/textures/items/wire.tin.png b/resources/assets/resonantinduction/textures/items/wire.tin.png new file mode 100644 index 00000000..654dccfc Binary files /dev/null and b/resources/assets/resonantinduction/textures/items/wire.tin.png differ diff --git a/src/resonantinduction/wire/EnumWire.java b/src/resonantinduction/wire/EnumWire.java new file mode 100644 index 00000000..7250ecb2 --- /dev/null +++ b/src/resonantinduction/wire/EnumWire.java @@ -0,0 +1,25 @@ +package resonantinduction.wire; + +/** + * An enumerator for different wire materials. + * + * @author Calclavia + * + */ + +public enum EnumWire +{ + COPPER(0.0125f, 3, 200), TIN(0.01f, 2, 30), IRON(0.005f, 1, 300), ALUMINUM(0.025f, 8, 15), + SILVER(0.005f, 1, 300), SUPERCONDUCTOR(0, 5, Integer.MAX_VALUE); + + public final float resistance; + public final int damage; + public final int maxAmps; + + EnumWire(float resistance, int electrocutionDamage, int maxAmps) + { + this.resistance = resistance; + this.damage = electrocutionDamage; + this.maxAmps = maxAmps; + } +} \ No newline at end of file diff --git a/src/resonantinduction/wire/ItemBlockWire.java b/src/resonantinduction/wire/ItemBlockWire.java new file mode 100644 index 00000000..34ca3f22 --- /dev/null +++ b/src/resonantinduction/wire/ItemBlockWire.java @@ -0,0 +1,63 @@ +package resonantinduction.wire; + +import java.util.HashMap; +import java.util.List; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import resonantinduction.ResonantInduction; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public abstract class ItemBlockWire extends ItemBlock +{ + protected HashMap icons = new HashMap(); + + public ItemBlockWire(int id) + { + super(id); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + @Override + public int getMetadata(int damage) + { + return damage; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return this.getUnlocalizedName() + "." + EnumWire.values()[itemStack.getItemDamage()].name().toLowerCase(); + } + + @Override + public void addInformation(ItemStack itemstack, EntityPlayer player, List par3List, boolean par4) + { + par3List.add("Resistance: " + ElectricityDisplay.getDisplay(EnumWire.values()[itemstack.getItemDamage()].resistance, ElectricUnit.RESISTANCE)); + par3List.add("Max Amperage: " + ElectricityDisplay.getDisplay(EnumWire.values()[itemstack.getItemDamage()].maxAmps, ElectricUnit.AMPERE)); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister par1IconRegister) + { + for (int i = 0; i < EnumWire.values().length - 1; i++) + { + this.icons.put(this.getUnlocalizedName(new ItemStack(this.itemID, 1, i)), par1IconRegister.registerIcon(this.getUnlocalizedName(new ItemStack(this.itemID, 1, i)).replaceAll("tile.", ResonantInduction.PREFIX))); + } + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getIconFromDamage(int meta) + { + return this.icons.get(this.getUnlocalizedName(new ItemStack(this.itemID, 1, meta))); + } +} \ No newline at end of file