diff --git a/bin/minecraft/resources/mekanism/textures/generators/items.png b/bin/minecraft/resources/mekanism/textures/generators/items.png new file mode 100644 index 000000000..bf3c1e830 Binary files /dev/null and b/bin/minecraft/resources/mekanism/textures/generators/items.png differ diff --git a/bin/minecraft/resources/mekanism/textures/generators/terrain.png b/bin/minecraft/resources/mekanism/textures/generators/terrain.png new file mode 100755 index 000000000..3bf1277cf Binary files /dev/null and b/bin/minecraft/resources/mekanism/textures/generators/terrain.png differ diff --git a/bin/minecraft/resources/mekanism/textures/tools/items.png b/bin/minecraft/resources/mekanism/textures/tools/items.png new file mode 100644 index 000000000..a94ac103e Binary files /dev/null and b/bin/minecraft/resources/mekanism/textures/tools/items.png differ diff --git a/src/common/mekanism/api/IEnergizedItem.java b/src/common/mekanism/api/IEnergizedItem.java deleted file mode 100644 index cd86298d7..000000000 --- a/src/common/mekanism/api/IEnergizedItem.java +++ /dev/null @@ -1,71 +0,0 @@ -package mekanism.api; - -import net.minecraft.src.*; - -/** - * Implement this in your item class if it can store or transfer energy. - * @author AidanBrady - * - */ -public interface IEnergizedItem -{ - /** - * Gets the amount of energy the item has from NBT storage. - * @param itemstack - * @return amount of energy - */ - public int getEnergy(ItemStack itemstack); - - /** - * Sets the energy the item has with NBT. - * @param itemstack - * @param energy - */ - public void setEnergy(ItemStack itemstack, int energy); - - /** - * Gets the maximum amount of energy this item can hold. - * @return maximum energy - */ - public int getMaxEnergy(); - - /** - * Gets the rate of transfer this item can handle. - * @return - */ - public int getRate(); - - /** - * Charges the item with the defined amount of energy. - * @param itemstack - * @param amount - * @return leftover energy - */ - public int charge(ItemStack itemstack, int amount); - - /** - * Removes the defined amount of energy from the item. - * @param itemstack - * @param amount - * @return energy discharged - */ - public int discharge(ItemStack itemstack, int amount); - - /** - * Gets the divider that gets that returns the max damage as 100. - * @return divider - */ - public int getDivider(); - - /** - * Whether or not this energized item be charged. - * @return if the item be charged - */ - public boolean canBeCharged(); - - /** - * Whether or not this energized item can charge an energy receiver. - * @return if the item can charge - */ - public boolean canBeDischarged(); -} diff --git a/src/common/mekanism/api/IEnergyAcceptor.java b/src/common/mekanism/api/IEnergyAcceptor.java deleted file mode 100644 index 0b726e49f..000000000 --- a/src/common/mekanism/api/IEnergyAcceptor.java +++ /dev/null @@ -1,25 +0,0 @@ -package mekanism.api; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Implement this if your tile entity accepts energy from a foreign, external source. - * @author AidanBrady - * - */ -public interface IEnergyAcceptor -{ - /** - * Transfer a certain amount of energy to this acceptor. - * @param amount - amount to transfer - * @return rejects - */ - public int transferToAcceptor(int amount); - - /** - * Whether or not this tile entity accepts energy from a certain side. - * @param side - side to check - * @return if tile entity accepts energy - */ - public boolean canReceive(ForgeDirection side); -} diff --git a/src/common/mekanism/common/BlockMachine.java b/src/common/mekanism/common/BlockMachine.java index fa8f51c74..4638f4fe9 100644 --- a/src/common/mekanism/common/BlockMachine.java +++ b/src/common/mekanism/common/BlockMachine.java @@ -5,7 +5,7 @@ import java.util.Random; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; -import mekanism.common.BlockGenerator.GeneratorType; +import mekanism.generators.common.BlockGenerator.GeneratorType; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; diff --git a/src/common/mekanism/common/BlockPowerUnit.java b/src/common/mekanism/common/BlockPowerUnit.java index f08c4710d..58c665444 100644 --- a/src/common/mekanism/common/BlockPowerUnit.java +++ b/src/common/mekanism/common/BlockPowerUnit.java @@ -14,6 +14,7 @@ import net.minecraftforge.common.ForgeDirection; * Block class for handling multiple ore block IDs. * 0: Power Unit * 1: Advanced Power Unit + * 2: Ultimate Power Unit * @author AidanBrady * */ diff --git a/src/common/mekanism/common/CommonProxy.java b/src/common/mekanism/common/CommonProxy.java index 4e56ca766..71eb08634 100644 --- a/src/common/mekanism/common/CommonProxy.java +++ b/src/common/mekanism/common/CommonProxy.java @@ -22,11 +22,7 @@ public class CommonProxy /** * Register tile entities that have special models. Overwritten in client to register TESRs. */ - public void registerSpecialTileEntities() - { - GameRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator"); - GameRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator"); - } + public void registerSpecialTileEntities() {} /** * Register and load client-only render information. @@ -63,10 +59,7 @@ public class CommonProxy Mekanism.oreBlockID = Mekanism.configuration.getBlock("OreBlock", 3002).getInt(); Mekanism.obsidianTNTID = Mekanism.configuration.getBlock("ObsidianTNT", 3003).getInt(); Mekanism.powerUnitID = Mekanism.configuration.getBlock("PowerUnit", 3004).getInt(); - Mekanism.generatorID = Mekanism.configuration.getBlock("Generator", 3005).getInt(); - Mekanism.advancedSolarGeneratorID = Mekanism.configuration.getBlock("AdvancedSolarGenerator", 3006).getInt(); Mekanism.nullRenderID = Mekanism.configuration.getBlock("NullRender", 3007).getInt(); - Mekanism.bioGeneratorID = Mekanism.configuration.getBlock("BioGenerator", 3008).getInt(); Mekanism.gasTankID = Mekanism.configuration.getBlock("GasTank", 3009).getInt(); Mekanism.extrasEnabled = Mekanism.configuration.get("ExtrasEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true); Mekanism.oreGenerationEnabled = Mekanism.configuration.get("OreGenerationEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true); @@ -131,17 +124,7 @@ public class CommonProxy return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 8: return new ContainerPowerUnit(player.inventory, (TileEntityPowerUnit)tileEntity); - case 9: - return new ContainerHeatGenerator(player.inventory, (TileEntityHeatGenerator)tileEntity); case 10: - return new ContainerSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity); - case 11: - return new ContainerElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity); - case 12: - return new ContainerHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity); - case 13: - return new ContainerBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); - case 15: return new ContainerGasTank(player.inventory, (TileEntityGasTank)tileEntity); } return null; diff --git a/src/common/mekanism/common/ContainerAdvancedElectricMachine.java b/src/common/mekanism/common/ContainerAdvancedElectricMachine.java index c4cb05635..c767b7589 100644 --- a/src/common/mekanism/common/ContainerAdvancedElectricMachine.java +++ b/src/common/mekanism/common/ContainerAdvancedElectricMachine.java @@ -2,7 +2,6 @@ package mekanism.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; -import mekanism.api.IEnergizedItem; import mekanism.api.ItemMachineUpgrade; import net.minecraft.src.*; @@ -67,7 +66,7 @@ public class ContainerAdvancedElectricMachine extends Container return null; } } - else if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) + else if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) { if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3) { diff --git a/src/common/mekanism/common/ContainerElectricMachine.java b/src/common/mekanism/common/ContainerElectricMachine.java index 23748c673..478f5eaee 100644 --- a/src/common/mekanism/common/ContainerElectricMachine.java +++ b/src/common/mekanism/common/ContainerElectricMachine.java @@ -2,7 +2,6 @@ package mekanism.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; -import mekanism.api.IEnergizedItem; import mekanism.api.ItemMachineUpgrade; import net.minecraft.src.*; @@ -66,7 +65,7 @@ public class ContainerElectricMachine extends Container return null; } } - else if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) + else if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) { if(slotID != 1) { diff --git a/src/common/mekanism/common/ContainerPowerUnit.java b/src/common/mekanism/common/ContainerPowerUnit.java index 169528f15..c25aca239 100644 --- a/src/common/mekanism/common/ContainerPowerUnit.java +++ b/src/common/mekanism/common/ContainerPowerUnit.java @@ -57,7 +57,7 @@ public class ContainerPowerUnit extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) + if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) { if(slotID != 0 && slotID != 1) { diff --git a/src/common/mekanism/common/CommonGuiHandler.java b/src/common/mekanism/common/CoreGuiHandler.java similarity index 92% rename from src/common/mekanism/common/CommonGuiHandler.java rename to src/common/mekanism/common/CoreGuiHandler.java index a16a0cc4b..7e3183f48 100644 --- a/src/common/mekanism/common/CommonGuiHandler.java +++ b/src/common/mekanism/common/CoreGuiHandler.java @@ -10,7 +10,7 @@ import cpw.mods.fml.common.network.IGuiHandler; * @author AidanBrady * */ -public class CommonGuiHandler implements IGuiHandler +public class CoreGuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) diff --git a/src/common/mekanism/common/ItemNuclearDisassembler.java b/src/common/mekanism/common/ItemAtomicDisassembler.java similarity index 69% rename from src/common/mekanism/common/ItemNuclearDisassembler.java rename to src/common/mekanism/common/ItemAtomicDisassembler.java index 4d9eb64e8..dae5da811 100644 --- a/src/common/mekanism/common/ItemNuclearDisassembler.java +++ b/src/common/mekanism/common/ItemAtomicDisassembler.java @@ -2,15 +2,17 @@ package mekanism.common; import java.util.List; +import universalelectricity.prefab.ItemElectric; + import net.minecraft.src.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingAttackEvent; -public class ItemNuclearDisassembler extends ItemEnergized +public class ItemAtomicDisassembler extends ItemEnergized { - public ItemNuclearDisassembler(int id) + public ItemAtomicDisassembler(int id) { - super(id, 16000, 500, 160); + super(id, 12000, 60, 120); } @Override @@ -30,10 +32,10 @@ public class ItemNuclearDisassembler extends ItemEnergized @Override public boolean hitEntity(ItemStack itemstack, EntityLiving hitEntity, EntityLiving player) { - if(getEnergy(itemstack) > 0) + if(getJoules(itemstack) > 0) { hitEntity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)player), 18); - discharge(itemstack, 40); + onUse(40, itemstack); } else { hitEntity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)player), 4); @@ -43,7 +45,7 @@ public class ItemNuclearDisassembler extends ItemEnergized public float getStrVsBlock(ItemStack itemstack, Block block) { - return getEnergy(itemstack) != 0 ? 40F : 1F; + return getJoules(itemstack) != 0 ? 40F : 1F; } @Override @@ -51,10 +53,10 @@ public class ItemNuclearDisassembler extends ItemEnergized { if ((double)Block.blocksList[id].getBlockHardness(world, x, y, z) != 0.0D) { - discharge(itemstack, 10); + onUse(10, itemstack); } else { - discharge(itemstack, 5); + onUse(5, itemstack); } return true; @@ -65,10 +67,22 @@ public class ItemNuclearDisassembler extends ItemEnergized { return true; } - - @Override - public boolean canBeDischarged() - { - return false; - } + + @Override + public boolean canProduceElectricity() + { + return false; + } + + @Override + public double getMaxJoules(Object... data) + { + return 12000; + } + + @Override + public double getVoltage() + { + return 60; + } } diff --git a/src/common/mekanism/common/ItemBlockEnergyCube.java b/src/common/mekanism/common/ItemBlockEnergyCube.java new file mode 100644 index 000000000..0dedeebb6 --- /dev/null +++ b/src/common/mekanism/common/ItemBlockEnergyCube.java @@ -0,0 +1,159 @@ +package mekanism.common; + +import java.util.List; + +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; +import universalelectricity.core.implement.IItemElectric; +import net.minecraft.src.*; + +public class ItemBlockEnergyCube extends ItemBlock implements IItemElectric +{ + /** The maximum amount of energy this item can hold. */ + public double MAX_ELECTRICITY; + + /** How fast this item can transfer energy. */ + public double VOLTAGE; + + /** The number that, when the max amount of energy is divided by, will make it equal 100. */ + public int DIVIDER; + + public ItemBlockEnergyCube(int id, double maxElectricity, double voltage, int divider) + { + super(id); + DIVIDER = divider; + MAX_ELECTRICITY = maxElectricity; + VOLTAGE = voltage; + setMaxStackSize(1); + setMaxDamage(100); + setNoRepair(); + setCreativeTab(Mekanism.tabMekanism); + } + + @Override + public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) + { + double energy = getJoules(itemstack); + + list.add("Stored Energy: " + ElectricInfo.getDisplayShort(energy, ElectricUnit.JOULES)); + } + + @Override + public void onCreated(ItemStack itemstack, World world, EntityPlayer entityplayer) + { + itemstack = getUnchargedItem(); + } + + @Override + public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) + { + ItemEnergized item = ((ItemEnergized)itemstack.getItem()); + item.setJoules(item.getJoules(itemstack), itemstack); + } + + public ItemStack getUnchargedItem() + { + ItemStack charged = new ItemStack(this); + charged.setItemDamage(100); + return charged; + } + + @Override + public void getSubItems(int i, CreativeTabs tabs, List list) + { + ItemStack discharged = new ItemStack(this); + discharged.setItemDamage(100); + list.add(discharged); + ItemStack charged = new ItemStack(this); + setJoules(((IItemElectric)charged.getItem()).getMaxJoules(), charged); + list.add(charged); + } + + @Override + public double getJoules(Object... data) + { + if (data[0] instanceof ItemStack) + { + ItemStack itemStack = (ItemStack) data[0]; + + if (itemStack.stackTagCompound == null) + { + return 0; + } + + double electricityStored = 0; + + if (itemStack.stackTagCompound.getTag("electricity") instanceof NBTTagFloat) + { + electricityStored = itemStack.stackTagCompound.getFloat("electricity"); + } + else + { + electricityStored = itemStack.stackTagCompound.getDouble("electricity"); + } + + itemStack.setItemDamage((int)(MAX_ELECTRICITY - electricityStored)/DIVIDER); + return electricityStored; + } + + return -1; + } + + @Override + public void setJoules(double wattHours, Object... data) + { + if (data[0] instanceof ItemStack) + { + ItemStack itemStack = (ItemStack) data[0]; + + if (itemStack.stackTagCompound == null) + { + itemStack.setTagCompound(new NBTTagCompound()); + } + + double electricityStored = Math.max(Math.min(wattHours, getMaxJoules()), 0); + itemStack.stackTagCompound.setDouble("electricity", electricityStored); + itemStack.setItemDamage((int)(MAX_ELECTRICITY - electricityStored)/DIVIDER); + } + } + + @Override + public double getMaxJoules(Object... data) + { + return MAX_ELECTRICITY; + } + + @Override + public double getVoltage() + { + return VOLTAGE; + } + + @Override + public double onReceive(double amps, double voltage, ItemStack itemStack) + { + double rejectedElectricity = Math.max((getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1)) - getMaxJoules(), 0); + setJoules(getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1) - rejectedElectricity, itemStack); + return rejectedElectricity; + } + + @Override + public double onUse(double joulesNeeded, ItemStack itemStack) + { + double electricityToUse = Math.min(getJoules(itemStack), joulesNeeded); + setJoules(getJoules(itemStack) - electricityToUse, itemStack); + return electricityToUse; + } + + @Override + public boolean canReceiveElectricity() + { + return true; + } + + @Override + public boolean canProduceElectricity() + { + return true; + } +} diff --git a/src/common/mekanism/common/ItemEnergizedBow.java b/src/common/mekanism/common/ItemElectricBow.java similarity index 89% rename from src/common/mekanism/common/ItemEnergizedBow.java rename to src/common/mekanism/common/ItemElectricBow.java index effd0fbc2..07b7af04a 100644 --- a/src/common/mekanism/common/ItemEnergizedBow.java +++ b/src/common/mekanism/common/ItemElectricBow.java @@ -2,13 +2,15 @@ package mekanism.common; import java.util.List; import java.util.Random; + +import universalelectricity.prefab.ItemElectric; import net.minecraft.src.*; -public class ItemEnergizedBow extends ItemEnergized +public class ItemElectricBow extends ItemEnergized { - public ItemEnergizedBow(int id) + public ItemElectricBow(int id) { - super(id, 10000, 100, 100); + super(id, 12000, 60, 120); } @Override @@ -21,7 +23,7 @@ public class ItemEnergizedBow extends ItemEnergized @Override public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer player, int itemUseCount) { - if(!player.isSneaking() && getEnergy(itemstack) > 0) + if(!player.isSneaking() && getJoules(itemstack) > 0) { boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0; @@ -50,7 +52,7 @@ public class ItemEnergizedBow extends ItemEnergized if(!player.capabilities.isCreativeMode) { - discharge(itemstack, (getFireState(itemstack) ? 100 : 10)); + onUse((getFireState(itemstack) ? 100 : 10), itemstack); } world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); @@ -147,4 +149,16 @@ public class ItemEnergizedBow extends ItemEnergized return state; } + + @Override + public double getMaxJoules(Object... data) + { + return 12000; + } + + @Override + public double getVoltage() + { + return 60; + } } diff --git a/src/common/mekanism/common/ItemEnergized.java b/src/common/mekanism/common/ItemEnergized.java index f5965b08b..5cc8de5e9 100644 --- a/src/common/mekanism/common/ItemEnergized.java +++ b/src/common/mekanism/common/ItemEnergized.java @@ -4,29 +4,29 @@ import java.util.List; import universalelectricity.core.UniversalElectricity; import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; import universalelectricity.core.implement.IItemElectric; import ic2.api.IElectricItem; -import mekanism.api.IEnergizedItem; import net.minecraft.src.*; -public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItemElectric +public class ItemEnergized extends ItemMekanism implements IItemElectric { /** The maximum amount of energy this item can hold. */ - public int MAX_ENERGY; + public double MAX_ELECTRICITY; /** How fast this item can transfer energy. */ - public int TRANSFER_RATE; + public double VOLTAGE; /** The number that, when the max amount of energy is divided by, will make it equal 100. */ public int DIVIDER; - public ItemEnergized(int id, int energy, int rate, int divide) + public ItemEnergized(int id, double maxElectricity, double voltage, int divider) { super(id); - DIVIDER = divide; - MAX_ENERGY = energy; - TRANSFER_RATE = rate; + DIVIDER = divider; + MAX_ELECTRICITY = maxElectricity; + VOLTAGE = voltage; setMaxStackSize(1); setMaxDamage(100); setNoRepair(); @@ -36,9 +36,9 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem @Override public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) { - int energy = getEnergy(itemstack); + double energy = getJoules(itemstack); - list.add("Stored Energy: " + MekanismUtils.getDisplayedEnergy(energy)); + list.add("Stored Energy: " + ElectricInfo.getDisplayShort(energy, ElectricUnit.JOULES)); } @Override @@ -51,41 +51,9 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) { ItemEnergized item = ((ItemEnergized)itemstack.getItem()); - item.setEnergy(itemstack, item.getEnergy(itemstack)); + item.setJoules(item.getJoules(itemstack), itemstack); } - @Override - public int getEnergy(ItemStack itemstack) - { - if(itemstack.stackTagCompound == null) - { - return 0; - } - - int stored = 0; - - if(itemstack.stackTagCompound.getTag("energy") != null) - { - stored = itemstack.stackTagCompound.getInteger("energy"); - } - - itemstack.setItemDamage((MAX_ENERGY - stored)/DIVIDER); - return stored; - } - - @Override - public void setEnergy(ItemStack itemstack, int energy) - { - if(itemstack.stackTagCompound == null) - { - itemstack.setTagCompound(new NBTTagCompound()); - } - - int stored = Math.max(Math.min(energy, MAX_ENERGY), 0); - itemstack.stackTagCompound.setInteger("energy", stored); - itemstack.setItemDamage((MAX_ENERGY - stored)/DIVIDER); - } - public ItemStack getUnchargedItem() { ItemStack charged = new ItemStack(this); @@ -100,86 +68,84 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem discharged.setItemDamage(100); list.add(discharged); ItemStack charged = new ItemStack(this); - setEnergy(charged, ((IEnergizedItem)charged.getItem()).getMaxEnergy()); + setJoules(((IItemElectric)charged.getItem()).getMaxJoules(), charged); list.add(charged); } - - @Override - public int getMaxEnergy() - { - return MAX_ENERGY; - } - - @Override - public int getRate() - { - return TRANSFER_RATE; - } - - @Override - public int charge(ItemStack itemstack, int amount) - { - int rejects = Math.max((getEnergy(itemstack) + amount) - MAX_ENERGY, 0); - setEnergy(itemstack, getEnergy(itemstack) + amount - rejects); - return rejects; - } - - @Override - public int discharge(ItemStack itemstack, int amount) - { - int energyToUse = Math.min(getEnergy(itemstack), amount); - setEnergy(itemstack, getEnergy(itemstack) - energyToUse); - return energyToUse; - } @Override public double getJoules(Object... data) { - if(data[0] instanceof ItemStack) + if (data[0] instanceof ItemStack) { - ItemStack itemstack = (ItemStack)data[0]; - return getEnergy(itemstack)*UniversalElectricity.IC2_RATIO; + ItemStack itemStack = (ItemStack) data[0]; + + if (itemStack.stackTagCompound == null) + { + return 0; + } + + double electricityStored = 0; + + if (itemStack.stackTagCompound.getTag("electricity") instanceof NBTTagFloat) + { + electricityStored = itemStack.stackTagCompound.getFloat("electricity"); + } + else + { + electricityStored = itemStack.stackTagCompound.getDouble("electricity"); + } + + itemStack.setItemDamage((int)(MAX_ELECTRICITY - electricityStored)/DIVIDER); + return electricityStored; } - return 0; + + return -1; } @Override - public void setJoules(double joules, Object... data) + public void setJoules(double wattHours, Object... data) { - if(data[0] instanceof ItemStack) + if (data[0] instanceof ItemStack) { - ItemStack itemstack = (ItemStack)data[0]; - - setEnergy(itemstack, (int)(joules*UniversalElectricity.TO_IC2_RATIO)); + ItemStack itemStack = (ItemStack) data[0]; + + if (itemStack.stackTagCompound == null) + { + itemStack.setTagCompound(new NBTTagCompound()); + } + + double electricityStored = Math.max(Math.min(wattHours, getMaxJoules()), 0); + itemStack.stackTagCompound.setDouble("electricity", electricityStored); + itemStack.setItemDamage((int)(MAX_ELECTRICITY - electricityStored)/DIVIDER); } } @Override public double getMaxJoules(Object... data) { - return MAX_ENERGY*UniversalElectricity.IC2_RATIO; + return MAX_ELECTRICITY; } @Override public double getVoltage() { - return 20; + return VOLTAGE; } @Override public double onReceive(double amps, double voltage, ItemStack itemStack) { - int rejects = (int)Math.max((getEnergy(itemStack) + ElectricInfo.getJoules(amps, voltage, 1)*UniversalElectricity.TO_IC2_RATIO) - getMaxEnergy(), 0); - setEnergy(itemStack, (int)(getEnergy(itemStack) + ElectricInfo.getJoules(amps, voltage, 1)*UniversalElectricity.TO_IC2_RATIO - rejects)); - return rejects*UniversalElectricity.IC2_RATIO; + double rejectedElectricity = Math.max((getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1)) - getMaxJoules(), 0); + setJoules(getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1) - rejectedElectricity, itemStack); + return rejectedElectricity; } @Override public double onUse(double joulesNeeded, ItemStack itemStack) { - int energyRequest = (int)Math.min(getEnergy(itemStack), joulesNeeded*UniversalElectricity.TO_IC2_RATIO); - setEnergy(itemStack, getEnergy(itemStack) - energyRequest); - return energyRequest*UniversalElectricity.IC2_RATIO; + double electricityToUse = Math.min(getJoules(itemStack), joulesNeeded); + setJoules(getJoules(itemStack) - electricityToUse, itemStack); + return electricityToUse; } @Override @@ -193,22 +159,4 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, IItem { return true; } - - @Override - public int getDivider() - { - return DIVIDER; - } - - @Override - public boolean canBeCharged() - { - return true; - } - - @Override - public boolean canBeDischarged() - { - return true; - } } diff --git a/src/common/mekanism/common/Mekanism.java b/src/common/mekanism/common/Mekanism.java index ff04adcc7..106a655b0 100644 --- a/src/common/mekanism/common/Mekanism.java +++ b/src/common/mekanism/common/Mekanism.java @@ -91,25 +91,6 @@ public class Mekanism /** The port used to connect to the Mekanism server */ public static int hostPort = 3073; - - //Enums: Tools - public static EnumToolMaterial toolOBSIDIAN = EnumHelper.addToolMaterial("OBSIDIAN", 3, 2500, 20F, 10, 50); - public static EnumToolMaterial toolOBSIDIAN2 = EnumHelper.addToolMaterial("OBSIDIAN2", 3, 3000, 25F, 10, 100); - public static EnumToolMaterial toolLAZULI = EnumHelper.addToolMaterial("LAZULI", 2, 200, 5.0F, 0, 22); - public static EnumToolMaterial toolLAZULI2 = EnumHelper.addToolMaterial("LAZULI2", 2, 250, 6.0F, 4, 50); - public static EnumToolMaterial toolPLATINUM = EnumHelper.addToolMaterial("PLATINUM", 2, 500, 10F, 4, 30); - public static EnumToolMaterial toolPLATINUM2 = EnumHelper.addToolMaterial("PLATINUM2", 3, 700, 12F, 5, 40); - public static EnumToolMaterial toolREDSTONE = EnumHelper.addToolMaterial("REDSTONE", 2, 250, 10F, 6, 50); - public static EnumToolMaterial toolREDSTONE2 = EnumHelper.addToolMaterial("REDSTONE2", 2, 400, 12F, 6, 60); - public static EnumToolMaterial toolGLOWSTONE = EnumHelper.addToolMaterial("GLOWSTONE", 2, 300, 14, 5, 80); - public static EnumToolMaterial toolGLOWSTONE2 = EnumHelper.addToolMaterial("GLOWSTONE2", 2, 450, 18, 5, 100); - - //Enums: Armor - public static EnumArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN", 50, new int[]{5, 12, 8, 5}, 50); - public static EnumArmorMaterial armorLAZULI = EnumHelper.addArmorMaterial("LAZULI", 13, new int[]{2, 5, 4, 2}, 50); - public static EnumArmorMaterial armorPLATINUM = EnumHelper.addArmorMaterial("PLATINUM", 30, new int[]{4, 10, 7, 4}, 50); - public static EnumArmorMaterial armorREDSTONE = EnumHelper.addArmorMaterial("REDSTONE", 16, new int[]{2, 7, 5, 3}, 50); - public static EnumArmorMaterial armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE", 18, new int[]{3, 7, 6, 3}, 50); //Block IDs public static int basicBlockID = 3000; @@ -117,91 +98,11 @@ public class Mekanism public static int oreBlockID = 3002; public static int obsidianTNTID = 3003; public static int powerUnitID = 3004; - public static int generatorID = 3005; - public static int advancedSolarGeneratorID = 3006; public static int nullRenderID = 3007; - public static int bioGeneratorID = 3008; public static int gasTankID = 3009; - //Base Items - public static Item WoodPaxel; - public static Item StonePaxel; - public static Item IronPaxel; - public static Item DiamondPaxel; - public static Item GoldPaxel; - public static Item WoodKnife; - public static Item StoneKnife; - public static Item IronKnife; - public static Item DiamondKnife; - public static Item GoldKnife; - - //Glowstone Items - public static Item GlowstonePaxel; - public static Item GlowstonePickaxe; - public static Item GlowstoneAxe; - public static Item GlowstoneSpade; - public static Item GlowstoneHoe; - public static Item GlowstoneSword; - public static Item GlowstoneHelmet; - public static Item GlowstoneBody; - public static Item GlowstoneLegs; - public static Item GlowstoneBoots; - public static Item GlowstoneKnife; - - //Redstone Items - public static Item RedstonePaxel; - public static Item RedstonePickaxe; - public static Item RedstoneAxe; - public static Item RedstoneSpade; - public static Item RedstoneHoe; - public static Item RedstoneSword; - public static Item RedstoneHelmet; - public static Item RedstoneBody; - public static Item RedstoneLegs; - public static Item RedstoneBoots; - public static Item RedstoneKnife; - - //Platinum Items - public static Item PlatinumPaxel; - public static Item PlatinumPickaxe; - public static Item PlatinumAxe; - public static Item PlatinumSpade; - public static Item PlatinumHoe; - public static Item PlatinumSword; - public static Item PlatinumHelmet; - public static Item PlatinumBody; - public static Item PlatinumLegs; - public static Item PlatinumBoots; - public static Item PlatinumKnife; - - //Obsidian Items - public static Item ObsidianHelmet; - public static Item ObsidianBody; - public static Item ObsidianLegs; - public static Item ObsidianBoots; - public static Item ObsidianPaxel; - public static Item ObsidianPickaxe; - public static Item ObsidianAxe; - public static Item ObsidianSpade; - public static Item ObsidianHoe; - public static Item ObsidianSword; - public static Item ObsidianKnife; - - //Lazuli Items - public static Item LazuliPaxel; - public static Item LazuliPickaxe; - public static Item LazuliAxe; - public static Item LazuliSpade; - public static Item LazuliHoe; - public static Item LazuliSword; - public static Item LazuliHelmet; - public static Item LazuliBody; - public static Item LazuliLegs; - public static Item LazuliBoots; - public static Item LazuliKnife; - //Extra Items - public static ItemEnergizedBow EnergizedBow; + public static ItemElectricBow ElectricBow; public static Item LightningRod; public static Item Stopwatch; public static Item WeatherOrb; @@ -212,13 +113,10 @@ public class Mekanism public static Item SpeedUpgrade; public static Item EnergyUpgrade; public static Item UltimateUpgrade; - public static ItemNuclearDisassembler NuclearDisassembler; + public static ItemAtomicDisassembler NuclearDisassembler; public static Item NuclearCore; - public static Item SolarPanel; public static ItemStorageTank HydrogenTank; public static ItemStorageTank OxygenTank; - public static Item BioFuel; - public static Item ElectrolyticCore; //Extra Blocks public static Block BasicBlock; @@ -226,15 +124,9 @@ public class Mekanism public static Block OreBlock; public static Block ObsidianTNT; public static Block PowerUnit; - public static Block Generator; - public static Block AdvancedSolarGenerator; public static BlockMulti NullRender; - public static Block BioGenerator; public static Block GasTank; - @SideOnly(Side.CLIENT) - public static int RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); - //MultiID Items public static Item Dust; public static Item Ingot; @@ -251,7 +143,6 @@ public class Mekanism public static int ticksPassed = 0; public static int ANIMATED_TEXTURE_INDEX = 240; - public static int BOW_TEXTURE_INDEX = 177; /** * Adds all in-game crafting and smelting recipes. @@ -259,248 +150,42 @@ public class Mekanism public void addRecipes() { //Crafting Recipes - //Base - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(WoodPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeWood, Character.valueOf('Y'), Item.pickaxeWood, Character.valueOf('Z'), Item.shovelWood, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(StonePaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeStone, Character.valueOf('Y'), Item.pickaxeStone, Character.valueOf('Z'), Item.shovelStone, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(IronPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeSteel, Character.valueOf('Y'), Item.pickaxeSteel, Character.valueOf('Z'), Item.shovelSteel, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(DiamondPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeDiamond, Character.valueOf('Y'), Item.pickaxeDiamond, Character.valueOf('Z'), Item.shovelDiamond, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GoldPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeGold, Character.valueOf('Y'), Item.pickaxeGold, Character.valueOf('Z'), Item.shovelGold, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(WoodKnife), new Object[] { - " ^", "I ", Character.valueOf('^'), Block.planks, Character.valueOf('I'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(StoneKnife), new Object[] { - " ^", "I ", Character.valueOf('^'), Block.cobblestone, Character.valueOf('I'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(IronKnife), new Object[] { - " ^", "I ", Character.valueOf('^'), Item.ingotIron, Character.valueOf('I'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(DiamondKnife), new Object[] { - " ^", "I ", Character.valueOf('^'), Item.diamond, Character.valueOf('I'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GoldKnife), new Object[] { - " ^", "I ", Character.valueOf('^'), Item.ingotGold, Character.valueOf('I'), Item.stick + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 3), new Object[] { + "***", "***", "***", Character.valueOf('*'), Item.coal })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Item.coal, 9), new Object[] { "*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 3) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 3), new Object[] { - "***", "***", "***", Character.valueOf('*'), Item.coal - })); - - //Obsidian CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 2), new Object[] { - "***", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 0) + "***", "***", "***", Character.valueOf('*'), "ingotObsidian" })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Ingot, 9, 0), new Object[] { "*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 2) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianHelmet, 1), new Object[] { - "***", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 0) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianBody, 1), new Object[] { - "* *", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 0) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianLegs, 1), new Object[] { - "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 0) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianBoots, 1), new Object[] { - "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 0) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), ObsidianAxe, Character.valueOf('Y'), ObsidianPickaxe, Character.valueOf('Z'), ObsidianSpade, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianPickaxe, 1), new Object[] { - "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Ingot, 1, 0), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianAxe, 1), new Object[] { - "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 0), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianSpade, 1), new Object[] { - "X", "T", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 0), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianHoe, 1), new Object[] { - "XX", " T", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 0), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianSword, 1), new Object[] { - "X", "X", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 0), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianKnife, 1), new Object[] { - " ^", "I ", Character.valueOf('^'), new ItemStack(Ingot, 1, 0), Character.valueOf('I'), Item.stick - })); - - //Glowstone CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 4), new Object[] { - "***", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 3) + "***", "***", "***", Character.valueOf('*'), "ingotGlowstone" })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Ingot, 9, 3), new Object[] { "*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 4) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstonePaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), GlowstoneAxe, Character.valueOf('Y'), GlowstonePickaxe, Character.valueOf('Z'), GlowstoneSpade, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstonePickaxe, 1), new Object[] { - "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Ingot, 1, 3), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneAxe, 1), new Object[] { - "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 3), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneSpade, 1), new Object[] { - "X", "T", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 3), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneHoe, 1), new Object[] { - "XX", " T", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 3), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneSword, 1), new Object[] { - "X", "X", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 3), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneHelmet, 1), new Object[] { - "***", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 3) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneBody, 1), new Object[] { - "* *", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 3) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneLegs, 1), new Object[] { - "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 3) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneBoots, 1), new Object[] { - "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 3) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneKnife, 1), new Object[] { - " ^", "I ", Character.valueOf('^'), new ItemStack(Ingot, 1, 3), Character.valueOf('I'), Item.stick - })); - - //Lazuli - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliHelmet, 1), new Object[] { - "***", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliBody, 1), new Object[] { - "* *", "***", "***", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliLegs, 1), new Object[] { - "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliBoots, 1), new Object[] { - "* *", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), LazuliAxe, Character.valueOf('Y'), LazuliPickaxe, Character.valueOf('Z'), LazuliSpade, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliPickaxe, 1), new Object[] { - "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliAxe, 1), new Object[] { - "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliSpade, 1), new Object[] { - "X", "T", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliHoe, 1), new Object[] { - "XX", " T", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliSword, 1), new Object[] { - "X", "X", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliKnife, 1), new Object[] { - " ^", "I ", Character.valueOf('^'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('I'), Item.stick - })); - - //Platinum CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 0), new Object[] { - "XXX", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Ingot, 1, 1) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumPaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), PlatinumAxe, Character.valueOf('Y'), PlatinumPickaxe, Character.valueOf('Z'), PlatinumSpade, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumPickaxe, 1), new Object[] { - "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Ingot, 1, 1), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumAxe, 1), new Object[] { - "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 1), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumSpade, 1), new Object[] { - "X", "T", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 1), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumHoe, 1), new Object[] { - "XX", " T", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 1), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumSword, 1), new Object[] { - "X", "X", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 1), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumHelmet, 1), new Object[] { - "***", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 1) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumBody, 1), new Object[] { - "* *", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 1) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumLegs, 1), new Object[] { - "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 1) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumBoots, 1), new Object[] { - "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 1) + "XXX", "XXX", "XXX", Character.valueOf('X'), "ingotPlatinum" })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Ingot, 9, 1), new Object[] { "*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 0) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumKnife, 1), new Object[] { - " ^", "I ", Character.valueOf('^'), new ItemStack(Ingot, 1, 1), Character.valueOf('I'), Item.stick - })); - - //Redstone CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 1), new Object[] { - "***", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 2) + "***", "***", "***", Character.valueOf('*'), "ingotRedstone" })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Ingot, 9, 2), new Object[] { "*", Character.valueOf('*'), new ItemStack(BasicBlock, 1, 1) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstonePaxel, 1), new Object[] { - "XYZ", " T ", " T ", Character.valueOf('X'), RedstoneAxe, Character.valueOf('Y'), RedstonePickaxe, Character.valueOf('Z'), RedstoneSpade, Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstonePickaxe, 1), new Object[] { - "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Ingot, 1, 2), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneAxe, 1), new Object[] { - "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 2), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneSpade, 1), new Object[] { - "X", "T", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 2), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneHoe, 1), new Object[] { - "XX", " T", " T", Character.valueOf('X'), new ItemStack(Ingot, 1, 2), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneSword, 1), new Object[] { - "X", "X", "T", Character.valueOf('X'), new ItemStack(Ingot, 1, 2), Character.valueOf('T'), Item.stick - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneHelmet, 1), new Object[] { - "***", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 2) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneBody, 1), new Object[] { - "* *", "***", "***", Character.valueOf('*'), new ItemStack(Ingot, 1, 2) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneLegs, 1), new Object[] { - "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 2) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneBoots, 1), new Object[] { - "* *", "* *", Character.valueOf('*'), new ItemStack(Ingot, 1, 2) - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneKnife, 1), new Object[] { - " ^", "I ", Character.valueOf('^'), new ItemStack(Ingot, 1, 2), Character.valueOf('I'), Item.stick - })); //Extra CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianTNT, 1), new Object[] { "***", "XXX", "***", Character.valueOf('*'), Block.obsidian, Character.valueOf('X'), Block.tnt })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(EnergizedBow.getUnchargedItem(), new Object[] { + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ElectricBow.getUnchargedItem(), new Object[] { " AB", "E B", " AB", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('B'), Item.silk, Character.valueOf('E'), EnergyCube.getUnchargedItem() })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(EnergyCube.getUnchargedItem(), new Object[] { @@ -539,9 +224,6 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(UltimateUpgrade), new Object[] { "ERA", "RDR", "ARS", Character.valueOf('E'), EnergyUpgrade, Character.valueOf('R'), Item.redstone, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('S'), SpeedUpgrade })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 0), new Object[] { - "GGG", "ECE", "IRI", Character.valueOf('G'), Item.lightStoneDust, Character.valueOf('E'), EnrichedAlloy, Character.valueOf('C'), new ItemStack(BasicBlock, 1, 3), Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone - })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(NuclearCore), new Object[] { "AOA", "PDP", "AOA", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('O'), "dustObsidian", Character.valueOf('P'), new ItemStack(Dust, 1, 2), Character.valueOf('D'), Item.diamond })); @@ -551,12 +233,6 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedAlloy), new Object[] { " R ", "RIR", " R ", Character.valueOf('R'), Item.redstone, Character.valueOf('I'), Item.ingotIron })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(SolarPanel), new Object[] { - "GGG", "RAR", "PPP", Character.valueOf('G'), Block.thinGlass, Character.valueOf('R'), Item.redstone, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('P'), "ingotPlatinum" - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 1), new Object[] { - "SSS", "AIA", "PEP", Character.valueOf('S'), SolarPanel, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('I'), Block.blockSteel, Character.valueOf('P'), "dustPlatinum", Character.valueOf('E'), EnergyTablet.getUnchargedItem() - })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 5), new Object[] { "PAP", "AIA", "PAP", Character.valueOf('P'), "ingotPlatinum", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('I'), Block.blockSteel })); @@ -566,24 +242,9 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(OxygenTank.getEmptyItem(), new Object[] { "III", "IGI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('G'), "dustGold" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ElectrolyticCore), new Object[] { - "EPE", "IEG", "EPE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('P'), "dustPlatinum", Character.valueOf('I'), "dustIron", Character.valueOf('G'), "dustGold" - })); CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(GasTank, new Object[] { "PPP", "P P", "PPP", Character.valueOf('P'), "ingotPlatinum" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(AdvancedSolarGenerator), new Object[] { - "SES", "SES", "III", Character.valueOf('S'), new ItemStack(Generator, 1, 1), Character.valueOf('E'), EnrichedAlloy, Character.valueOf('I'), Item.ingotIron - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BioGenerator), new Object[] { - "RER", "BIB", "NEN", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), EnrichedAlloy, Character.valueOf('B'), BioFuel, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5), Character.valueOf('N'), Item.ingotIron - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 2), new Object[] { - "IRI", "ECE", "IRI", Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('E'), EnrichedAlloy, Character.valueOf('C'), ElectrolyticCore - })); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 3), new Object[] { - "PEP", "ICI", "PEP", Character.valueOf('P'), "ingotPlatinum", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5), Character.valueOf('C'), ElectrolyticCore - })); if(extrasEnabled) { @@ -627,20 +288,6 @@ public class Mekanism RecipeHandler.addCrusherRecipe(new ItemStack(Ingot, 1, 0), new ItemStack(Dust, 1, 3)); RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotIron), new ItemStack(Dust, 1, 0)); RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotGold), new ItemStack(Dust, 1, 1)); - RecipeHandler.addCrusherRecipe(new ItemStack(Block.sapling), new ItemStack(BioFuel, 2)); - RecipeHandler.addCrusherRecipe(new ItemStack(Block.tallGrass), new ItemStack(BioFuel, 2)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.seeds), new ItemStack(BioFuel, 1)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.wheat), new ItemStack(BioFuel, 2)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.pumpkinSeeds), new ItemStack(BioFuel, 1)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.melonSeeds), new ItemStack(BioFuel, 1)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.appleRed), new ItemStack(BioFuel, 3)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.bread), new ItemStack(BioFuel, 3)); - RecipeHandler.addCrusherRecipe(new ItemStack(Item.potato), new ItemStack(BioFuel, 2)); - - for(int i = 0; i < BlockLeaves.LEAF_TYPES.length; i++) - { - RecipeHandler.addCrusherRecipe(new ItemStack(Block.sapling, 1, i), new ItemStack(BioFuel, 2)); - } //Theoretical Elementizer Recipes RecipeHandler.addTheoreticalElementizerRecipe(new ItemStack(EnrichedAlloy), new ItemStack(TileEntityTheoreticalElementizer.getRandomMagicItem())); @@ -651,85 +298,8 @@ public class Mekanism */ public void addNames() { - //Base - LanguageRegistry.addName(WoodPaxel, "Wood Paxel"); - LanguageRegistry.addName(StonePaxel, "Stone Paxel"); - LanguageRegistry.addName(IronPaxel, "Iron Paxel"); - LanguageRegistry.addName(DiamondPaxel, "Diamond Paxel"); - LanguageRegistry.addName(GoldPaxel, "Gold Paxel"); - LanguageRegistry.addName(WoodKnife, "Wood Knife"); - LanguageRegistry.addName(StoneKnife, "Stone Knife"); - LanguageRegistry.addName(IronKnife, "Iron Knife"); - LanguageRegistry.addName(DiamondKnife, "Diamond Knife"); - LanguageRegistry.addName(GoldKnife, "Gold Knife"); - - //Obsidian - LanguageRegistry.addName(ObsidianHelmet, "Obsidian Helmet"); - LanguageRegistry.addName(ObsidianBody, "Obsidian Chestplate"); - LanguageRegistry.addName(ObsidianLegs, "Obsidian Leggings"); - LanguageRegistry.addName(ObsidianBoots, "Obsidian Boots"); - LanguageRegistry.addName(ObsidianPaxel, "Obsidian Paxel"); - LanguageRegistry.addName(ObsidianPickaxe, "Obsidian Pickaxe"); - LanguageRegistry.addName(ObsidianAxe, "Obsidian Axe"); - LanguageRegistry.addName(ObsidianSpade, "Obsidian Shovel"); - LanguageRegistry.addName(ObsidianHoe, "Obsidian Hoe"); - LanguageRegistry.addName(ObsidianSword, "Obsidian Sword"); - LanguageRegistry.addName(ObsidianKnife, "Obsidian Knife"); - - //Lazuli - LanguageRegistry.addName(LazuliHelmet, "Lapis Lazuli Helmet"); - LanguageRegistry.addName(LazuliBody, "Lapis Lazuli Chestplate"); - LanguageRegistry.addName(LazuliLegs, "Lapis Lazuli Leggings"); - LanguageRegistry.addName(LazuliBoots, "Lapis Lazuli Boots"); - LanguageRegistry.addName(LazuliPaxel, "Lapis Lazuli Paxel"); - LanguageRegistry.addName(LazuliPickaxe, "Lapis Lazuli Pickaxe"); - LanguageRegistry.addName(LazuliAxe, "Lapis Lazuli Axe"); - LanguageRegistry.addName(LazuliSpade, "Lapis Lazuli Shovel"); - LanguageRegistry.addName(LazuliHoe, "Lapis Lazuli Hoe"); - LanguageRegistry.addName(LazuliSword, "Lapis Lazuli Sword"); - LanguageRegistry.addName(LazuliKnife, "Lazuli Knife"); - - //Platinum - LanguageRegistry.addName(PlatinumHelmet, "Platinum Helmet"); - LanguageRegistry.addName(PlatinumBody, "Platinum Chestplate"); - LanguageRegistry.addName(PlatinumLegs, "Platinum Leggings"); - LanguageRegistry.addName(PlatinumBoots, "Platinum Boots"); - LanguageRegistry.addName(PlatinumPaxel, "Platinum Paxel"); - LanguageRegistry.addName(PlatinumPickaxe, "Platinum Pickaxe"); - LanguageRegistry.addName(PlatinumAxe, "Platinum Axe"); - LanguageRegistry.addName(PlatinumSpade, "Platinum Shovel"); - LanguageRegistry.addName(PlatinumHoe, "Platinum Hoe"); - LanguageRegistry.addName(PlatinumSword, "Platinum Sword"); - LanguageRegistry.addName(PlatinumKnife, "Platinum Knife"); - - //Redstone - LanguageRegistry.addName(RedstoneHelmet, "Redstone Helmet"); - LanguageRegistry.addName(RedstoneBody, "Redstone Chestplate"); - LanguageRegistry.addName(RedstoneLegs, "Redstone Leggings"); - LanguageRegistry.addName(RedstoneBoots, "Redstone Boots"); - LanguageRegistry.addName(RedstonePaxel, "Redstone Paxel"); - LanguageRegistry.addName(RedstonePickaxe, "Redstone Pickaxe"); - LanguageRegistry.addName(RedstoneAxe, "Redstone Axe"); - LanguageRegistry.addName(RedstoneSpade, "Redstone Shovel"); - LanguageRegistry.addName(RedstoneHoe, "Redstone Hoe"); - LanguageRegistry.addName(RedstoneSword, "Redstone Sword"); - LanguageRegistry.addName(RedstoneKnife, "Redstone Knife"); - - //Glowstone - LanguageRegistry.addName(GlowstonePaxel, "Glowstone Paxel"); - LanguageRegistry.addName(GlowstonePickaxe, "Glowstone Pickaxe"); - LanguageRegistry.addName(GlowstoneAxe, "Glowstone Axe"); - LanguageRegistry.addName(GlowstoneSpade, "Glowstone Shovel"); - LanguageRegistry.addName(GlowstoneHoe, "Glowstone Hoe"); - LanguageRegistry.addName(GlowstoneSword, "Glowstone Sword"); - LanguageRegistry.addName(GlowstoneHelmet, "Glowstone Helmet"); - LanguageRegistry.addName(GlowstoneBody, "Glowstone Chestplate"); - LanguageRegistry.addName(GlowstoneLegs, "Glowstone Leggings"); - LanguageRegistry.addName(GlowstoneBoots, "Glowstone Boots"); - LanguageRegistry.addName(GlowstoneKnife, "Glowstone Knife"); - //Extras - LanguageRegistry.addName(EnergizedBow, "Energized Bow"); + LanguageRegistry.addName(ElectricBow, "Energized Bow"); LanguageRegistry.addName(ObsidianTNT, "Obsidian TNT"); if(extrasEnabled == true) @@ -748,15 +318,10 @@ public class Mekanism LanguageRegistry.addName(UltimateUpgrade, "Ultimate Upgrade"); LanguageRegistry.addName(NuclearDisassembler, "Nuclear Disassembler"); LanguageRegistry.addName(NuclearCore, "Nuclear Core"); - LanguageRegistry.addName(EnergizedBow, "Energized Bow"); - LanguageRegistry.addName(SolarPanel, "Solar Panel"); + LanguageRegistry.addName(ElectricBow, "Electric Bow"); LanguageRegistry.addName(HydrogenTank, "Hydrogen Tank"); LanguageRegistry.addName(OxygenTank, "Oxygen Tank"); - LanguageRegistry.addName(AdvancedSolarGenerator, "Advanced Solar Generator"); LanguageRegistry.addName(NullRender, "Null Render"); - LanguageRegistry.addName(BioGenerator, "Bio-Generator"); - LanguageRegistry.addName(BioFuel, "Bio Fuel"); - LanguageRegistry.addName(ElectrolyticCore, "Electrolytic Core"); LanguageRegistry.addName(GasTank, "Gas Tank"); //Localization for MultiBlock @@ -782,12 +347,6 @@ public class Mekanism LanguageRegistry.instance().addStringLocalization("tile.PowerUnit.PowerUnit.name", "Power Unit"); LanguageRegistry.instance().addStringLocalization("tile.PowerUnit.AdvancedPowerUnit.name", "Advanced Power Unit"); - //Localization for Generator - LanguageRegistry.instance().addStringLocalization("tile.Generator.HeatGenerator.name", "Heat Generator"); - LanguageRegistry.instance().addStringLocalization("tile.Generator.SolarGenerator.name", "Solar Generator"); - LanguageRegistry.instance().addStringLocalization("tile.Generator.ElectrolyticSeparator.name", "Electrolytic Separator"); - LanguageRegistry.instance().addStringLocalization("tile.Generator.HydrogenGenerator.name", "Hydrogen Generator"); - //Localization for Dust LanguageRegistry.instance().addStringLocalization("item.ironDust.name", "Iron Dust"); LanguageRegistry.instance().addStringLocalization("item.goldDust.name", "Gold Dust"); @@ -807,83 +366,6 @@ public class Mekanism */ public void addTextures() { - //Base - WoodPaxel.setIconIndex(150); - StonePaxel.setIconIndex(151); - IronPaxel.setIconIndex(152); - DiamondPaxel.setIconIndex(153); - GoldPaxel.setIconIndex(154); - WoodKnife.setIconIndex(214); - StoneKnife.setIconIndex(215); - IronKnife.setIconIndex(216); - DiamondKnife.setIconIndex(217); - GoldKnife.setIconIndex(218); - - //Glowstone - GlowstoneHelmet.setIconIndex(4); - GlowstoneBody.setIconIndex(20); - GlowstoneLegs.setIconIndex(36); - GlowstoneBoots.setIconIndex(52); - GlowstonePaxel.setIconIndex(148); - GlowstonePickaxe.setIconIndex(68); - GlowstoneAxe.setIconIndex(84); - GlowstoneSpade.setIconIndex(100); - GlowstoneHoe.setIconIndex(116); - GlowstoneSword.setIconIndex(132); - GlowstoneKnife.setIconIndex(212); - - //Redstone - RedstoneHelmet.setIconIndex(3); - RedstoneBody.setIconIndex(19); - RedstoneLegs.setIconIndex(35); - RedstoneBoots.setIconIndex(51); - RedstonePaxel.setIconIndex(147); - RedstonePickaxe.setIconIndex(67); - RedstoneAxe.setIconIndex(83); - RedstoneSpade.setIconIndex(99); - RedstoneHoe.setIconIndex(115); - RedstoneSword.setIconIndex(131); - RedstoneKnife.setIconIndex(211); - - //Platinum - PlatinumHelmet.setIconIndex(2); - PlatinumBody.setIconIndex(18); - PlatinumLegs.setIconIndex(34); - PlatinumBoots.setIconIndex(50); - PlatinumPaxel.setIconIndex(146); - PlatinumPickaxe.setIconIndex(66); - PlatinumAxe.setIconIndex(82); - PlatinumSpade.setIconIndex(98); - PlatinumHoe.setIconIndex(114); - PlatinumSword.setIconIndex(130); - PlatinumKnife.setIconIndex(210); - - //Obsidian - ObsidianHelmet.setIconIndex(1); - ObsidianBody.setIconIndex(17); - ObsidianLegs.setIconIndex(33); - ObsidianBoots.setIconIndex(49); - ObsidianPaxel.setIconIndex(145); - ObsidianPickaxe.setIconIndex(65); - ObsidianAxe.setIconIndex(81); - ObsidianSpade.setIconIndex(97); - ObsidianHoe.setIconIndex(113); - ObsidianSword.setIconIndex(129); - ObsidianKnife.setIconIndex(209); - - //Lazuli - LazuliPaxel.setIconIndex(144); - LazuliPickaxe.setIconIndex(64); - LazuliAxe.setIconIndex(80); - LazuliSpade.setIconIndex(96); - LazuliHoe.setIconIndex(112); - LazuliSword.setIconIndex(128); - LazuliHelmet.setIconIndex(0); - LazuliBody.setIconIndex(16); - LazuliLegs.setIconIndex(32); - LazuliBoots.setIconIndex(48); - LazuliKnife.setIconIndex(208); - if(extrasEnabled == true) { LightningRod.setIconIndex(225); @@ -900,12 +382,9 @@ public class Mekanism UltimateUpgrade.setIconIndex(233); NuclearDisassembler.setIconIndex(253); NuclearCore.setIconIndex(254); - EnergizedBow.setIconIndex(252); - SolarPanel.setIconIndex(255); + ElectricBow.setIconIndex(252); HydrogenTank.setIconIndex(251); OxygenTank.setIconIndex(239); - BioFuel.setIconIndex(237); - ElectrolyticCore.setIconIndex(238); } /** @@ -913,94 +392,26 @@ public class Mekanism */ public void addItems() { - RedstoneHelmet = (new ItemMekanismArmor(11235, armorREDSTONE, proxy.getArmorIndex("redstone"), 0)).setItemName("RedstoneHelmet"); - RedstoneBody = (new ItemMekanismArmor(11236, armorREDSTONE, proxy.getArmorIndex("redstone"), 1)).setItemName("RedstoneBody"); - RedstoneLegs = (new ItemMekanismArmor(11237, armorREDSTONE, proxy.getArmorIndex("redstone"), 2)).setItemName("RedstoneLegs"); - RedstoneBoots = (new ItemMekanismArmor(11238, armorREDSTONE, proxy.getArmorIndex("redstone"), 3)).setItemName("RedstoneBoots"); - RedstonePaxel = new ItemMekanismPaxel(11239, toolREDSTONE2).setItemName("RedstonePaxel"); - RedstonePickaxe = new ItemMekanismPickaxe(11240, toolREDSTONE).setItemName("RedstonePickaxe"); - RedstoneAxe = new ItemMekanismAxe(11241, toolREDSTONE).setItemName("RedstoneAxe"); - RedstoneSpade = new ItemMekanismSpade(11242, toolREDSTONE).setItemName("RedstoneSpade"); - RedstoneHoe = new ItemMekanismHoe(11243, toolREDSTONE).setItemName("RedstoneHoe"); - RedstoneSword = new ItemMekanismSword(11244, toolREDSTONE).setItemName("RedstoneSword"); - PlatinumHelmet = (new ItemMekanismArmor(11245, EnumArmorMaterial.DIAMOND, proxy.getArmorIndex("platinum"), 0)).setItemName("PlatinumHelmet"); - PlatinumBody = (new ItemMekanismArmor(11246, EnumArmorMaterial.DIAMOND, proxy.getArmorIndex("platinum"), 1)).setItemName("PlatinumBody"); - PlatinumLegs = (new ItemMekanismArmor(11247, EnumArmorMaterial.DIAMOND, proxy.getArmorIndex("platinum"), 2)).setItemName("PlatinumLegs"); - PlatinumBoots = (new ItemMekanismArmor(11248, EnumArmorMaterial.DIAMOND, proxy.getArmorIndex("platinum"), 3)).setItemName("PlatinumBoots"); - PlatinumPaxel = new ItemMekanismPaxel(11249, toolPLATINUM2).setItemName("PlatinumPaxel"); - PlatinumPickaxe = new ItemMekanismPickaxe(11250, toolPLATINUM).setItemName("PlatinumPickaxe"); - PlatinumAxe = new ItemMekanismAxe(11251, toolPLATINUM).setItemName("PlatinumAxe"); - PlatinumSpade = new ItemMekanismSpade(11252, toolPLATINUM).setItemName("PlatinumSpade"); - PlatinumHoe = new ItemMekanismHoe(11253, toolPLATINUM).setItemName("PlatinumHoe"); - PlatinumSword = new ItemMekanismSword(11254, toolPLATINUM).setItemName("PlatinumSword"); - ObsidianHelmet = (new ItemMekanismArmor(11255, armorOBSIDIAN, proxy.getArmorIndex("obsidian"), 0)).setItemName("ObsidianHelmet"); - ObsidianBody = (new ItemMekanismArmor(11256, armorOBSIDIAN, proxy.getArmorIndex("obsidian"), 1)).setItemName("ObsidianBody"); - ObsidianLegs = (new ItemMekanismArmor(11257, armorOBSIDIAN, proxy.getArmorIndex("obsidian"), 2)).setItemName("ObsidianLegs"); - ObsidianBoots = (new ItemMekanismArmor(11258, armorOBSIDIAN, proxy.getArmorIndex("obsidian"), 3)).setItemName("ObsidianBoots"); - ObsidianPaxel = new ItemMekanismPaxel(11259, toolOBSIDIAN2).setItemName("ObsidianPaxel"); - ObsidianPickaxe = new ItemMekanismPickaxe(11260, toolOBSIDIAN).setItemName("ObsidianPickaxe"); - ObsidianAxe = new ItemMekanismAxe(11261, toolOBSIDIAN).setItemName("ObsidianAxe"); - ObsidianSpade = new ItemMekanismSpade(11262, toolOBSIDIAN).setItemName("ObsidianSpade"); - ObsidianHoe = new ItemMekanismHoe(11263, toolOBSIDIAN).setItemName("ObsidianHoe"); - ObsidianSword = new ItemMekanismSword(11264, toolOBSIDIAN).setItemName("ObsidianSword"); - LazuliPaxel = new ItemMekanismPaxel(11265, toolLAZULI2).setItemName("LazuliPaxel"); - LazuliPickaxe = new ItemMekanismPickaxe(11266, toolLAZULI).setItemName("LazuliPickaxe"); - LazuliAxe = new ItemMekanismAxe(11267, toolLAZULI).setItemName("LazuliAxe"); - LazuliSpade = new ItemMekanismSpade(11268, toolLAZULI).setItemName("LazuliSpade"); - LazuliHoe = new ItemMekanismHoe(11269, toolLAZULI).setItemName("LazuliHoe"); - LazuliSword = new ItemMekanismSword(11270, toolLAZULI).setItemName("LazuliSword"); - LazuliHelmet = (new ItemMekanismArmor(11271, armorLAZULI, proxy.getArmorIndex("lazuli"), 0)).setItemName("LazuliHelmet"); - LazuliBody = (new ItemMekanismArmor(11272, armorLAZULI, proxy.getArmorIndex("lazuli"), 1)).setItemName("LazuliBody"); - LazuliLegs = (new ItemMekanismArmor(11273, armorLAZULI, proxy.getArmorIndex("lazuli"), 2)).setItemName("LazuliLegs"); - LazuliBoots = (new ItemMekanismArmor(11274, armorLAZULI, proxy.getArmorIndex("lazuli"), 3)).setItemName("LazuliBoots"); - EnergizedBow = (ItemEnergizedBow) new ItemEnergizedBow(11275).setItemName("EnergizedBow"); + ElectricBow = (ItemElectricBow) new ItemElectricBow(11275).setItemName("ElectricBow"); if(extrasEnabled == true) { LightningRod = new ItemLightningRod(11276).setItemName("LightningRod"); Stopwatch = new ItemStopwatch(11277).setItemName("Stopwatch"); WeatherOrb = new ItemWeatherOrb(11278).setItemName("WeatherOrb"); } - WoodPaxel = new ItemMekanismPaxel(11279, EnumToolMaterial.WOOD).setItemName("WoodPaxel"); - StonePaxel = new ItemMekanismPaxel(11280, EnumToolMaterial.STONE).setItemName("StonePaxel"); - IronPaxel = new ItemMekanismPaxel(11281, EnumToolMaterial.IRON).setItemName("IronPaxel"); - DiamondPaxel = new ItemMekanismPaxel(11282, EnumToolMaterial.EMERALD).setItemName("DiamondPaxel"); - GoldPaxel = new ItemMekanismPaxel(11283, EnumToolMaterial.GOLD).setItemName("GoldPaxel"); - WoodKnife = new ItemMekanismKnife(11284, EnumToolMaterial.WOOD).setItemName("WoodKnife"); - StoneKnife = new ItemMekanismKnife(11285, EnumToolMaterial.STONE).setItemName("StoneKnife"); - IronKnife = new ItemMekanismKnife(11286, EnumToolMaterial.IRON).setItemName("IronKnife"); - DiamondKnife = new ItemMekanismKnife(11287, EnumToolMaterial.EMERALD).setItemName("DiamondKnife"); - GoldKnife = new ItemMekanismKnife(11288, EnumToolMaterial.GOLD).setItemName("GoldKnife"); - ObsidianKnife = new ItemMekanismKnife(11289, toolOBSIDIAN).setItemName("ObsidianKnife"); - LazuliKnife = new ItemMekanismKnife(11290, toolLAZULI).setItemName("LazuliKnife"); - PlatinumKnife = new ItemMekanismKnife(11291, toolPLATINUM).setItemName("PlatinumKnife"); - RedstoneKnife = new ItemMekanismKnife(11292, toolREDSTONE).setItemName("RedstoneKnife"); Dust = new ItemDust(11293-256); Ingot = new ItemIngot(11294-256); - GlowstonePaxel = new ItemMekanismPaxel(11295, toolGLOWSTONE2).setItemName("GlowstonePaxel"); - GlowstonePickaxe = new ItemMekanismPickaxe(11296, toolGLOWSTONE).setItemName("GlowstonePickaxe"); - GlowstoneAxe = new ItemMekanismAxe(11297, toolGLOWSTONE).setItemName("GlowstoneAxe"); - GlowstoneSpade = new ItemMekanismSpade(11298, toolGLOWSTONE).setItemName("GlowstoneSpade"); - GlowstoneHoe = new ItemMekanismHoe(11299, toolGLOWSTONE).setItemName("GlowstoneHoe"); - GlowstoneSword = new ItemMekanismSword(11300, toolGLOWSTONE).setItemName("GlowstoneSword"); - GlowstoneHelmet = new ItemMekanismArmor(11301, armorGLOWSTONE, proxy.getArmorIndex("glowstone"), 0).setItemName("GlowstoneHelmet"); - GlowstoneBody = new ItemMekanismArmor(11302, armorGLOWSTONE, proxy.getArmorIndex("glowstone"), 1).setItemName("GlowstoneBody"); - GlowstoneLegs = new ItemMekanismArmor(11303, armorGLOWSTONE, proxy.getArmorIndex("glowstone"), 2).setItemName("GlowstoneLegs"); - GlowstoneBoots = new ItemMekanismArmor(11304, armorGLOWSTONE, proxy.getArmorIndex("glowstone"), 3).setItemName("GlowstoneBoots"); - GlowstoneKnife = new ItemMekanismKnife(11305, toolGLOWSTONE).setItemName("GlowstoneKnife"); - EnergyTablet = (ItemEnergized) new ItemEnergized(11306, 50000, 100, 500).setItemName("EnergyTablet"); - EnergyOrb = (ItemEnergized) new ItemEnergized(11307, 15000000, 1000, 150000).setItemName("EnergyOrb"); - EnergyCube = (ItemEnergized) new ItemEnergized(11308, 12000, 100, 120).setItemName("EnergyCube"); + EnergyTablet = (ItemEnergized) new ItemEnergized(11306, 2500000, 512, 25000).setItemName("EnergyTablet"); + EnergyOrb = (ItemEnergized) new ItemEnergized(11307, 5000000, 512, 50000).setItemName("EnergyOrb"); + EnergyCube = (ItemEnergized) new ItemEnergized(11308, 1000000, 512, 10000).setItemName("EnergyCube"); SpeedUpgrade = new ItemMachineUpgrade(11309, 0, 150).setItemName("SpeedUpgrade"); EnergyUpgrade = new ItemMachineUpgrade(11310, 1000, 0).setItemName("EnergyUpgrade"); UltimateUpgrade = new ItemMachineUpgrade(11311, 2500, 180).setItemName("UltimateUpgrade"); - NuclearDisassembler = (ItemNuclearDisassembler) new ItemNuclearDisassembler(11312).setItemName("NuclearDisassembler"); + NuclearDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(11312).setItemName("NuclearDisassembler"); NuclearCore = new ItemMekanism(11313).setItemName("NuclearCore"); - SolarPanel = new ItemMekanism(11314).setItemName("SolarPanel"); EnrichedAlloy = new ItemMekanism(11315).setItemName("EnrichedAlloy"); HydrogenTank = (ItemHydrogenTank) new ItemHydrogenTank(11316).setItemName("HydrogenTank"); OxygenTank = (ItemOxygenTank) new ItemOxygenTank(11317).setItemName("OxygenTank"); - BioFuel = new ItemMekanism(11318).setItemName("BioFuel"); - ElectrolyticCore = new ItemMekanism(11319).setItemName("ElectrolyticCore"); } /** @@ -1013,18 +424,13 @@ public class Mekanism MachineBlock = new BlockMachine(machineBlockID).setBlockName("MachineBlock"); OreBlock = new BlockOre(oreBlockID).setBlockName("OreBlock"); PowerUnit = new BlockPowerUnit(powerUnitID).setBlockName("PowerUnit"); - Generator = new BlockGenerator(generatorID).setBlockName("Generator"); ObsidianTNT = new BlockObsidianTNT(obsidianTNTID).setBlockName("ObsidianTNT").setCreativeTab(tabMekanism); - AdvancedSolarGenerator = new BlockAdvancedSolarGenerator(advancedSolarGeneratorID).setBlockName("AdvancedSolarGenerator"); NullRender = (BlockMulti) new BlockMulti(nullRenderID).setBlockName("NullRender"); - BioGenerator = new BlockBioGenerator(bioGeneratorID).setBlockName("BioGenerator"); GasTank = new BlockGasTank(gasTankID).setBlockName("GasTank"); //Registrations GameRegistry.registerBlock(ObsidianTNT); - GameRegistry.registerBlock(AdvancedSolarGenerator); GameRegistry.registerBlock(NullRender); - GameRegistry.registerBlock(BioGenerator); GameRegistry.registerBlock(GasTank); //Add block items into itemsList for blocks with common IDs. @@ -1032,8 +438,6 @@ public class Mekanism Item.itemsList[machineBlockID] = new ItemBlockMachine(machineBlockID - 256, MachineBlock).setItemName("MachineBlock"); Item.itemsList[oreBlockID] = new ItemBlockOre(oreBlockID - 256, OreBlock).setItemName("OreBlock"); Item.itemsList[powerUnitID] = new ItemBlockPowerUnit(powerUnitID - 256, PowerUnit).setItemName("PowerUnit"); - Item.itemsList[generatorID] = new ItemBlockGenerator(generatorID - 256, Generator).setItemName("Generator"); - } /** @@ -1082,11 +486,9 @@ public class Mekanism { //Entity IDs EntityRegistry.registerGlobalEntityID(EntityObsidianTNT.class, "ObsidianTNT", EntityRegistry.findGlobalUniqueEntityId()); - EntityRegistry.registerGlobalEntityID(EntityKnife.class, "Knife", EntityRegistry.findGlobalUniqueEntityId()); //Registrations EntityRegistry.registerModEntity(EntityObsidianTNT.class, "ObsidianTNT", 51, this, 40, 5, true); - EntityRegistry.registerModEntity(EntityKnife.class, "Knife", 52, this, 40, 5, true); //Tile entities GameRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber"); @@ -1096,10 +498,6 @@ public class Mekanism GameRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer"); GameRegistry.registerTileEntity(TileEntityPowerUnit.class, "PowerUnit"); GameRegistry.registerTileEntity(TileEntityAdvancedPowerUnit.class, "AdvancedPowerUnit"); - GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator"); - GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator"); - GameRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator"); - GameRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator"); GameRegistry.registerTileEntity(TileEntityMulti.class, "Multi"); GameRegistry.registerTileEntity(TileEntityControlPanel.class, "ControlPanel"); GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank"); @@ -1142,7 +540,7 @@ public class Mekanism //Register the mod's ore handler GameRegistry.registerWorldGenerator(new OreHandler()); //Register the mod's GUI handler - NetworkRegistry.instance().registerGuiHandler(this, new CommonGuiHandler()); + NetworkRegistry.instance().registerGuiHandler(this, new CoreGuiHandler()); //Register the MachineryManager manager = new MachineryManager(); System.out.println("[Mekanism] Version " + versionNumber + " initializing..."); @@ -1188,52 +586,4 @@ public class Mekanism //Success message logger.info("[Mekanism] Mod loaded."); } - - @ForgeSubscribe - public void onLivingSpecialSpawn(LivingSpecialSpawnEvent event) - { - Random random = new Random(); - - int chance = random.nextInt(100); - int secondChance = random.nextInt(4); - - if(chance < 5) - { - if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton) - { - if(secondChance == 0) - { - if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(Mekanism.GlowstoneSword)); - event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(Mekanism.GlowstoneHelmet)); - event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(Mekanism.GlowstoneBody)); - event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(Mekanism.GlowstoneLegs)); - event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(Mekanism.GlowstoneBoots)); - } - else if(secondChance == 1) - { - if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(Mekanism.LazuliSword)); - event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(Mekanism.LazuliHelmet)); - event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(Mekanism.LazuliBody)); - event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(Mekanism.LazuliLegs)); - event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(Mekanism.LazuliBoots)); - } - else if(secondChance == 2) - { - if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(Mekanism.RedstoneSword)); - event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(Mekanism.RedstoneHelmet)); - event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(Mekanism.RedstoneBody)); - event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(Mekanism.RedstoneLegs)); - event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(Mekanism.RedstoneBoots)); - } - else if(secondChance == 3) - { - if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(Mekanism.PlatinumSword)); - event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(Mekanism.PlatinumHelmet)); - event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(Mekanism.PlatinumBody)); - event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(Mekanism.PlatinumLegs)); - event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(Mekanism.PlatinumBoots)); - } - } - } - } } \ No newline at end of file diff --git a/src/common/mekanism/common/MekanismUtils.java b/src/common/mekanism/common/MekanismUtils.java index 504709ecf..c5b34f6f6 100644 --- a/src/common/mekanism/common/MekanismUtils.java +++ b/src/common/mekanism/common/MekanismUtils.java @@ -50,74 +50,6 @@ public class MekanismUtils } } - /** - * Converts units into a nice String for display without color. - * @param energy - * @return displayed energy - */ - public static String getDisplayedEnergyNoColor(int energy) - { - if(energy < 1000) - { - return energy + " u"; - } - else if(energy >= 1000 && energy < 10000) - { - return energy/10 + " kU"; - } - else if(energy >= 10000 && energy < 100000) - { - return energy/100 + " mU"; - } - else if(energy >= 100000 && energy < 1000000) - { - return energy/1000 + " gU"; - } - else if(energy >= 1000000) - { - return energy/100000 + " tU"; - } - else { - return null; - } - } - - /** - * Converts units into a nice String for display with color. - * @param energy - * @return displayed energy - */ - public static String getDisplayedEnergy(int energy) - { - if(energy == 0) - { - return EnumColor.DARK_RED + "" + energy + " u" + EnumColor.DARK_GREY; - } - else if(energy < 1000) - { - return energy + " u"; - } - else if(energy >= 1000 && energy < 10000) - { - return energy/10 + " kU"; - } - else if(energy >= 10000 && energy < 100000) - { - return energy/100 + " mU"; - } - else if(energy >= 100000 && energy < 1000000) - { - return energy/1000 + " gU"; - } - else if(energy >= 1000000) - { - return energy/100000 + " tU"; - } - else { - return null; - } - } - /** * Gets the latest version using getHTML and returns it as a string. * @return latest version diff --git a/src/common/mekanism/common/PacketHandler.java b/src/common/mekanism/common/PacketHandler.java index 3982a401c..78bfa0bb7 100644 --- a/src/common/mekanism/common/PacketHandler.java +++ b/src/common/mekanism/common/PacketHandler.java @@ -165,6 +165,14 @@ public class PacketHandler implements IPacketHandler { output.writeBoolean((Boolean)data); } + else if(data instanceof Double) + { + output.writeDouble((Double)data); + } + else if(data instanceof Float) + { + output.writeFloat((Float)data); + } else if(data instanceof String) { output.writeUTF((String)data); @@ -212,6 +220,14 @@ public class PacketHandler implements IPacketHandler { output.writeBoolean((Boolean)data); } + else if(data instanceof Double) + { + output.writeDouble((Double)data); + } + else if(data instanceof Float) + { + output.writeFloat((Float)data); + } else if(data instanceof String) { output.writeUTF((String)data); diff --git a/src/common/mekanism/common/SlotEnergy.java b/src/common/mekanism/common/SlotEnergy.java index b418f8b86..ceae459ee 100644 --- a/src/common/mekanism/common/SlotEnergy.java +++ b/src/common/mekanism/common/SlotEnergy.java @@ -2,7 +2,6 @@ package mekanism.common; import universalelectricity.core.implement.IItemElectric; import ic2.api.IElectricItem; -import mekanism.api.IEnergizedItem; import net.minecraft.src.*; public class SlotEnergy extends Slot @@ -15,6 +14,6 @@ public class SlotEnergy extends Slot @Override public boolean isItemValid(ItemStack itemstack) { - return itemstack.getItem() instanceof IEnergizedItem || itemstack.getItem() instanceof IElectricItem || itemstack.getItem() instanceof IItemElectric || itemstack.itemID == Item.redstone.shiftedIndex; + return itemstack.getItem() instanceof IElectricItem || itemstack.getItem() instanceof IItemElectric || itemstack.itemID == Item.redstone.shiftedIndex; } } diff --git a/src/common/mekanism/common/SlotStorageTank.java b/src/common/mekanism/common/SlotStorageTank.java index d28ff1928..b7045ad94 100644 --- a/src/common/mekanism/common/SlotStorageTank.java +++ b/src/common/mekanism/common/SlotStorageTank.java @@ -2,7 +2,6 @@ package mekanism.common; import ic2.api.IElectricItem; import mekanism.api.EnumGas; -import mekanism.api.IEnergizedItem; import mekanism.api.IStorageTank; import net.minecraft.src.*; diff --git a/src/common/mekanism/common/TileEntityAdvancedElectricMachine.java b/src/common/mekanism/common/TileEntityAdvancedElectricMachine.java index 3c3572f6d..b203414c3 100644 --- a/src/common/mekanism/common/TileEntityAdvancedElectricMachine.java +++ b/src/common/mekanism/common/TileEntityAdvancedElectricMachine.java @@ -21,7 +21,6 @@ import ic2.api.ElectricItem; import ic2.api.EnergyNet; import ic2.api.IElectricItem; import ic2.api.IWrenchable; -import mekanism.api.IEnergizedItem; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; @@ -74,36 +73,16 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM if(inventory[3] != null) { - if(energyStored < currentMaxEnergy) + if(electricityStored < currentMaxElectricity) { - if(inventory[3].getItem() instanceof IEnergizedItem) + if(inventory[3].getItem() instanceof IItemElectric) { - IEnergizedItem item = (IEnergizedItem)inventory[3].getItem(); - - if(item.canBeDischarged()) - { - int received = 0; - int energyNeeded = currentMaxEnergy - energyStored; - if(item.getRate() <= energyNeeded) - { - received = item.discharge(inventory[3], item.getRate()); - } - else if(item.getRate() > energyNeeded) - { - received = item.discharge(inventory[3], energyNeeded); - } - - setEnergy(energyStored + received); - } - } - else if(inventory[3].getItem() instanceof IItemElectric) - { - IItemElectric electricItem = (IItemElectric)inventory[3].getItem(); + IItemElectric electricItem = (IItemElectric) inventory[3].getItem(); if (electricItem.canProduceElectricity()) { double joulesReceived = electricItem.onUse(electricItem.getMaxJoules() * 0.005, inventory[3]); - setEnergy(energyStored + (int)(joulesReceived*UniversalElectricity.TO_IC2_RATIO)); + setJoules(electricityStored + joulesReceived); } } else if(inventory[3].getItem() instanceof IElectricItem) @@ -111,14 +90,14 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM IElectricItem item = (IElectricItem)inventory[3].getItem(); if(item.canProvideEnergy()) { - int gain = ElectricItem.discharge(inventory[3], currentMaxEnergy - energyStored, 3, false, false); - setEnergy(energyStored + gain); + double gain = ElectricItem.discharge(inventory[3], (int)((MAX_ELECTRICITY - electricityStored)*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored + gain); } } } - if(inventory[3].itemID == Item.redstone.shiftedIndex && energyStored <= (MAX_ENERGY-1000)) + if(inventory[3].itemID == Item.redstone.shiftedIndex && electricityStored <= (MAX_ELECTRICITY-1000)) { - setEnergy(energyStored + 1000); + setJoules(electricityStored + 1000); --inventory[3].stackSize; if (inventory[3].stackSize <= 0) @@ -156,7 +135,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM int energyToAdd = 0; int ticksToRemove = 0; - if(currentMaxEnergy == MAX_ENERGY) + if(currentMaxElectricity == MAX_ELECTRICITY) { energyToAdd = ((IMachineUpgrade)inventory[4].getItem()).getEnergyBoost(inventory[4]); } @@ -166,20 +145,20 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM ticksToRemove = ((IMachineUpgrade)inventory[4].getItem()).getTickReduction(inventory[4]); } - currentMaxEnergy += energyToAdd; + currentMaxElectricity += energyToAdd; currentTicksRequired -= ticksToRemove; } else if(inventory[4] == null) { currentTicksRequired = TICKS_REQUIRED; - currentMaxEnergy = MAX_ENERGY; + currentMaxElectricity = MAX_ELECTRICITY; } if(canOperate() && (operatingTicks+1) < currentTicksRequired && secondaryEnergyStored >= SECONDARY_ENERGY_PER_TICK) { ++operatingTicks; secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK; - energyStored -= ENERGY_PER_TICK; + electricityStored -= ENERGY_PER_TICK; } else if((operatingTicks+1) >= currentTicksRequired) { @@ -189,12 +168,12 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM } operatingTicks = 0; secondaryEnergyStored -= SECONDARY_ENERGY_PER_TICK; - energyStored -= ENERGY_PER_TICK; + electricityStored -= ENERGY_PER_TICK; } - if(energyStored < 0) + if(electricityStored < 0) { - energyStored = 0; + electricityStored = 0; } if(secondaryEnergyStored < 0) @@ -202,9 +181,9 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM secondaryEnergyStored = 0; } - if(energyStored > currentMaxEnergy) + if(electricityStored > currentMaxElectricity) { - energyStored = currentMaxEnergy; + electricityStored = currentMaxElectricity; } if(secondaryEnergyStored > MAX_SECONDARY_ENERGY) @@ -276,7 +255,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM return false; } - if(energyStored < ENERGY_PER_TICK) + if(electricityStored < ENERGY_PER_TICK) { return false; } @@ -315,9 +294,9 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM facing = dataStream.readInt(); isActive = dataStream.readBoolean(); operatingTicks = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); secondaryEnergyStored = dataStream.readInt(); - currentMaxEnergy = dataStream.readInt(); + currentMaxElectricity = dataStream.readDouble(); currentTicksRequired = dataStream.readInt(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); } catch (Exception e) @@ -330,13 +309,13 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, isActive, operatingTicks, energyStored, secondaryEnergyStored, currentMaxEnergy, currentTicksRequired); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, isActive, operatingTicks, electricityStored, secondaryEnergyStored, currentMaxElectricity, currentTicksRequired); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, isActive, operatingTicks, energyStored, secondaryEnergyStored, currentMaxEnergy, currentTicksRequired); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, isActive, operatingTicks, electricityStored, secondaryEnergyStored, currentMaxElectricity, currentTicksRequired); } @Override @@ -386,7 +365,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {secondaryEnergyStored}; case 2: @@ -398,9 +377,9 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM case 5: return new Object[] {canOperate()}; case 6: - return new Object[] {currentMaxEnergy}; + return new Object[] {currentMaxElectricity}; case 7: - return new Object[] {(currentMaxEnergy-energyStored)}; + return new Object[] {(currentMaxElectricity-electricityStored)}; default: System.err.println("[Mekanism] Attempted to call unknown method with computer ID " + computer.getID()); return new Object[] {"Unknown command."}; diff --git a/src/common/mekanism/common/TileEntityBasicMachine.java b/src/common/mekanism/common/TileEntityBasicMachine.java index edcff59e3..f4f2312cb 100644 --- a/src/common/mekanism/common/TileEntityBasicMachine.java +++ b/src/common/mekanism/common/TileEntityBasicMachine.java @@ -22,22 +22,22 @@ import ic2.api.EnergyNet; import ic2.api.IEnergySink; import ic2.api.IWrenchable; import mekanism.api.IElectricMachine; -import mekanism.api.IEnergyAcceptor; import mekanism.client.Sound; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; -public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IElectricityReceiver, IEnergyAcceptor, IPeripheral +public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IElectricityReceiver, IPeripheral { /** The Sound instance for this machine. */ + @SideOnly(Side.CLIENT) public Sound audio; /** The bundled URL of this machine's sound effect */ public String soundURL; /** How much energy this machine uses per tick. */ - public int ENERGY_PER_TICK; + public double ENERGY_PER_TICK; /** How many ticks this machine has operated for. */ public int operatingTicks = 0; @@ -49,7 +49,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp public int currentTicksRequired; /** The current energy capacity for this machine. */ - public int currentMaxEnergy; + public double currentMaxElectricity; /** Whether or not this block is in it's active state. */ public boolean isActive; @@ -75,6 +75,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp public TileEntityBasicMachine(String soundPath, String name, String path, int perTick, int ticksRequired, int maxEnergy) { super(name, maxEnergy); + currentMaxElectricity = MAX_ELECTRICITY; ENERGY_PER_TICK = perTick; TICKS_REQUIRED = currentTicksRequired = ticksRequired; soundURL = soundPath; @@ -128,6 +129,8 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp operatingTicks = nbtTags.getInteger("operatingTicks"); isActive = nbtTags.getBoolean("isActive"); + currentTicksRequired = nbtTags.getInteger("currentTicksRequired"); + currentMaxElectricity = nbtTags.getDouble("currentMaxElectricity"); } @Override @@ -137,6 +140,8 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("currentTicksRequired", currentTicksRequired); + nbtTags.setDouble("currentMaxElectricity", currentMaxElectricity); } @Override @@ -158,25 +163,25 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp @Override public boolean demandsEnergy() { - return energyStored < currentMaxEnergy; + return electricityStored < currentMaxElectricity; } @Override public int injectEnergy(Direction direction, int i) { - int rejects = 0; - int neededEnergy = currentMaxEnergy-energyStored; + double rejects = 0; + double neededEnergy = MAX_ELECTRICITY-electricityStored; if(i <= neededEnergy) { - energyStored += i; + electricityStored += i; } else if(i > neededEnergy) { - energyStored += neededEnergy; + electricityStored += neededEnergy; rejects = i-neededEnergy; } - return rejects; + return (int)(rejects*UniversalElectricity.TO_IC2_RATIO); } @Override @@ -192,7 +197,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp */ public int getScaledEnergyLevel(int i) { - return energyStored*i / currentMaxEnergy; + return (int)(electricityStored*i / currentMaxElectricity); } /** @@ -208,19 +213,19 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp @Override public double getMaxJoules(Object... data) { - return currentMaxEnergy*UniversalElectricity.IC2_RATIO; + return currentMaxElectricity*UniversalElectricity.IC2_RATIO; } @Override public double getJoules(Object... data) { - return energyStored*UniversalElectricity.IC2_RATIO; + return electricityStored*UniversalElectricity.IC2_RATIO; } @Override - public void setJoules(double joules, Object... data) + public void setJoules(double joules, Object... data) { - setEnergy((int)(joules*UniversalElectricity.TO_IC2_RATIO)); + electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0); } @Override @@ -244,34 +249,25 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp @Override public double wattRequest() { - return isActive ? ElectricInfo.getWatts((ENERGY_PER_TICK*4)*UniversalElectricity.IC2_RATIO) : 0; + return currentMaxElectricity - electricityStored; } @Override public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side) { - int energyToReceive = (int)(ElectricInfo.getJoules(amps, voltage)*UniversalElectricity.TO_IC2_RATIO); - int energyNeeded = currentMaxEnergy - energyStored; - int energyToStore = 0; + double electricityToReceive = ElectricInfo.getJoules(amps, voltage); + double electricityNeeded = MAX_ELECTRICITY - electricityStored; + double electricityToStore = 0; - if(energyToReceive <= energyNeeded) + if(electricityToReceive <= electricityNeeded) { - energyToStore = energyToReceive; + electricityToStore = electricityToReceive; } - else if(energyToReceive > energyNeeded) + else if(electricityToReceive > electricityNeeded) { - energyToStore = energyNeeded; + electricityToStore = electricityNeeded; } - setEnergy(energyStored + energyToStore); - } - - /** - * Sets the energy to a new amount. - * @param energy - amount to store - */ - public void setEnergy(int energy) - { - energyStored = Math.max(Math.min(energy, currentMaxEnergy), 0); + setJoules(electricityStored + electricityToStore); } @Override @@ -304,28 +300,4 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp @Override public void detach(IComputerAccess computer) {} - - @Override - public int transferToAcceptor(int amount) - { - int rejects = 0; - int neededEnergy = currentMaxEnergy-energyStored; - if(amount <= neededEnergy) - { - energyStored += amount; - } - else if(amount > neededEnergy) - { - energyStored += neededEnergy; - rejects = amount-neededEnergy; - } - - return rejects; - } - - @Override - public boolean canReceive(ForgeDirection side) - { - return true; - } } diff --git a/src/common/mekanism/common/TileEntityElectricBlock.java b/src/common/mekanism/common/TileEntityElectricBlock.java index 3e9d098ff..4b6478659 100644 --- a/src/common/mekanism/common/TileEntityElectricBlock.java +++ b/src/common/mekanism/common/TileEntityElectricBlock.java @@ -15,10 +15,10 @@ import net.minecraftforge.common.ISidedInventory; public abstract class TileEntityElectricBlock extends TileEntityContainerBlock implements IWrenchable, ISidedInventory, IInventory, ITileNetwork, IPowerReceptor { /** How much energy is stored in this block. */ - public int energyStored; + public double electricityStored; /** Maximum amount of energy this machine can hold. */ - public int MAX_ENERGY; + public double MAX_ELECTRICITY; /** BuildCraft power provider. */ public IPowerProvider powerProvider; @@ -32,7 +32,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i public TileEntityElectricBlock(String name, int maxEnergy) { super(name); - MAX_ENERGY = maxEnergy; + MAX_ELECTRICITY = maxEnergy; if(PowerFramework.currentFramework != null) { powerProvider = PowerFramework.currentFramework.createPowerProvider(); @@ -50,7 +50,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i PowerFramework.currentFramework.loadPowerProvider(this, nbtTags); } - energyStored = nbtTags.getInteger("energyStored"); + electricityStored = nbtTags.getDouble("electricityStored"); } @Override @@ -63,7 +63,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i PowerFramework.currentFramework.savePowerProvider(this, nbtTags); } - nbtTags.setInteger("energyStored", energyStored); + nbtTags.setDouble("electricityStored", electricityStored); } public boolean isAddedToEnergyNet() diff --git a/src/common/mekanism/common/TileEntityElectricMachine.java b/src/common/mekanism/common/TileEntityElectricMachine.java index 5f50dbac8..49b7b2325 100644 --- a/src/common/mekanism/common/TileEntityElectricMachine.java +++ b/src/common/mekanism/common/TileEntityElectricMachine.java @@ -20,7 +20,6 @@ import ic2.api.ElectricItem; import ic2.api.EnergyNet; import ic2.api.IElectricItem; import ic2.api.IWrenchable; -import mekanism.api.IEnergizedItem; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; @@ -52,36 +51,16 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine if(inventory[1] != null) { - if(energyStored < currentMaxEnergy) + if(electricityStored < currentMaxElectricity) { - if(inventory[1].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[1].getItem(); - - if(item.canBeDischarged()) - { - int received = 0; - int energyNeeded = currentMaxEnergy - energyStored; - if(item.getRate() <= energyNeeded) - { - received = item.discharge(inventory[1], item.getRate()); - } - else if(item.getRate() > energyNeeded) - { - received = item.discharge(inventory[1], energyNeeded); - } - - setEnergy(energyStored + received); - } - } - else if(inventory[1].getItem() instanceof IItemElectric) + if(inventory[1].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[1].getItem(); if (electricItem.canProduceElectricity()) { double joulesReceived = electricItem.onUse(electricItem.getMaxJoules() * 0.005, inventory[1]); - setEnergy(energyStored + (int)(joulesReceived*UniversalElectricity.TO_IC2_RATIO)); + setJoules(electricityStored + joulesReceived); } } else if(inventory[1].getItem() instanceof IElectricItem) @@ -89,14 +68,14 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine IElectricItem item = (IElectricItem)inventory[1].getItem(); if(item.canProvideEnergy()) { - int gain = ElectricItem.discharge(inventory[1], currentMaxEnergy - energyStored, 3, false, false); - setEnergy(energyStored + gain); + double gain = ElectricItem.discharge(inventory[1], (int)((MAX_ELECTRICITY - electricityStored)*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored + gain); } } } - if(inventory[1].itemID == Item.redstone.shiftedIndex && energyStored <= (currentMaxEnergy-1000)) + if(inventory[1].itemID == Item.redstone.shiftedIndex && electricityStored <= (currentMaxElectricity-1000)) { - setEnergy(energyStored + 1000); + setJoules(electricityStored + 1000); --inventory[1].stackSize; if (inventory[1].stackSize <= 0) @@ -120,7 +99,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine } else if(inventory[3].isItemEqual(new ItemStack(Mekanism.EnergyUpgrade))) { - if(currentMaxEnergy == MAX_ENERGY) + if(currentMaxElectricity == MAX_ELECTRICITY) { energyToAdd = 600; } @@ -131,25 +110,25 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine { ticksToRemove = 150; } - if(currentMaxEnergy == MAX_ENERGY) + if(currentMaxElectricity == MAX_ELECTRICITY) { energyToAdd = 600; } } - currentMaxEnergy += energyToAdd; + currentMaxElectricity += energyToAdd; currentTicksRequired -= ticksToRemove; } else if(inventory[3] == null) { currentTicksRequired = TICKS_REQUIRED; - currentMaxEnergy = MAX_ENERGY; + currentMaxElectricity = MAX_ELECTRICITY; } if(canOperate() && (operatingTicks+1) < currentTicksRequired) { ++operatingTicks; - energyStored -= ENERGY_PER_TICK; + electricityStored -= ENERGY_PER_TICK; } else if(canOperate() && (operatingTicks+1) >= currentTicksRequired) { @@ -158,17 +137,17 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine operate(); } operatingTicks = 0; - energyStored -= ENERGY_PER_TICK; + electricityStored -= ENERGY_PER_TICK; } - if(energyStored < 0) + if(electricityStored < 0) { - energyStored = 0; + electricityStored = 0; } - if(energyStored > currentMaxEnergy) + if(electricityStored > currentMaxElectricity) { - energyStored = currentMaxEnergy; + electricityStored = currentMaxElectricity; } if(!canOperate()) @@ -235,7 +214,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine return false; } - if(energyStored < ENERGY_PER_TICK) + if(electricityStored < ENERGY_PER_TICK) { return false; } @@ -269,8 +248,8 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine facing = dataStream.readInt(); isActive = dataStream.readBoolean(); operatingTicks = dataStream.readInt(); - energyStored = dataStream.readInt(); - currentMaxEnergy = dataStream.readInt(); + electricityStored = dataStream.readDouble(); + currentMaxElectricity = dataStream.readDouble(); currentTicksRequired = dataStream.readInt(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); } catch (Exception e) @@ -283,13 +262,13 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, isActive, operatingTicks, energyStored, currentMaxEnergy, currentTicksRequired); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, isActive, operatingTicks, electricityStored, currentMaxElectricity, currentTicksRequired); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, isActive, operatingTicks, energyStored, currentMaxEnergy, currentTicksRequired); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, isActive, operatingTicks, electricityStored, currentMaxElectricity, currentTicksRequired); } @Override @@ -304,7 +283,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {operatingTicks}; case 2: @@ -314,9 +293,9 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine case 4: return new Object[] {canOperate()}; case 5: - return new Object[] {currentMaxEnergy}; + return new Object[] {currentMaxElectricity}; case 6: - return new Object[] {(currentMaxEnergy-energyStored)}; + return new Object[] {(currentMaxElectricity-electricityStored)}; default: System.err.println("[Mekanism] Attempted to call unknown method with computer ID " + computer.getID()); return new Object[] {"Unknown command."}; diff --git a/src/common/mekanism/common/TileEntityPowerUnit.java b/src/common/mekanism/common/TileEntityPowerUnit.java index 4f6d79d11..3241e427c 100644 --- a/src/common/mekanism/common/TileEntityPowerUnit.java +++ b/src/common/mekanism/common/TileEntityPowerUnit.java @@ -32,14 +32,12 @@ import ic2.api.IEnergySource; import ic2.api.IEnergyStorage; import ic2.api.IWrenchable; import ic2.api.IElectricItem; -import mekanism.api.IEnergizedItem; -import mekanism.api.IEnergyAcceptor; import mekanism.api.ITileNetwork; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; -public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEnergySink, IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IElectricityReceiver, IEnergyAcceptor, IPeripheral +public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEnergySink, IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IElectricityReceiver, IPeripheral { /** Output per tick this machine can transfer. */ public int output; @@ -68,7 +66,7 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne if(PowerFramework.currentFramework != null) { powerProvider = PowerFramework.currentFramework.createPowerProvider(); - powerProvider.configure(0, 2, 2000, 1, MAX_ENERGY/10); + powerProvider.configure(0, 2, 2000, 1, (int)(MAX_ELECTRICITY*UniversalElectricity.TO_BC_RATIO)); } } @@ -78,76 +76,35 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne if(powerProvider != null) { int received = (int)(powerProvider.useEnergy(25, 25, true)*10); - setEnergy(energyStored + received); + setJoules(electricityStored + received); } - if(inventory[0] != null && energyStored > 0) + if(inventory[0] != null && electricityStored > 0) { - if(inventory[0].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[0].getItem(); - - if(item.canBeCharged()) - { - int sendingEnergy = 0; - - if(item.getRate() <= energyStored) - { - sendingEnergy = item.getRate(); - } - else if(item.getRate() > energyStored) - { - sendingEnergy = energyStored; - } - - int rejects = item.charge(inventory[0], sendingEnergy); - setEnergy(energyStored - (sendingEnergy - rejects)); - } - } - else if(inventory[0].getItem() instanceof IItemElectric) + if(inventory[0].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[0].getItem(); - double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), (energyStored*UniversalElectricity.IC2_RATIO)); + double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), electricityStored); double joules = electricItem.onReceive(ampsToGive, getVoltage(), inventory[0]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); + setJoules(electricityStored - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); } else if(inventory[0].getItem() instanceof IElectricItem) { - int sent = ElectricItem.charge(inventory[0], energyStored, 3, false, false); - setEnergy(energyStored - sent); + double sent = ElectricItem.charge(inventory[0], (int)(electricityStored*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored - sent); } } - if(inventory[1] != null && energyStored < MAX_ENERGY) + if(inventory[1] != null && electricityStored < MAX_ELECTRICITY) { - if(inventory[1].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[1].getItem(); - - if(item.canBeDischarged()) - { - int received = 0; - int energyNeeded = MAX_ENERGY - energyStored; - if(item.getRate() <= energyNeeded) - { - received = item.discharge(inventory[1], item.getRate()); - } - else if(item.getRate() > energyNeeded) - { - received = item.discharge(inventory[1], energyNeeded); - } - - setEnergy(energyStored + received); - } - } - else if(inventory[1].getItem() instanceof IItemElectric) + if(inventory[1].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[1].getItem(); if (electricItem.canProduceElectricity()) { double joulesReceived = electricItem.onUse(electricItem.getMaxJoules() * 0.005, inventory[1]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) + joulesReceived); + setJoules(electricityStored + joulesReceived); } } else if(inventory[1].getItem() instanceof IElectricItem) @@ -155,13 +112,13 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne IElectricItem item = (IElectricItem)inventory[1].getItem(); if(item.canProvideEnergy()) { - int gain = ElectricItem.discharge(inventory[1], MAX_ENERGY - energyStored, 3, false, false); - setEnergy(energyStored + gain); + double gain = ElectricItem.discharge(inventory[1], (int)((MAX_ELECTRICITY - electricityStored)*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored + gain); } } else if(inventory[1].itemID == Item.redstone.shiftedIndex) { - setEnergy(energyStored + 1000); + setJoules(electricityStored + 1000); --inventory[1].stackSize; if (inventory[1].stackSize <= 0) @@ -171,15 +128,15 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne } } - if(energyStored > 0) + if(electricityStored > 0) { TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), ForgeDirection.getOrientation(facing)); if(Mekanism.hooks.IC2Loaded) { - if(energyStored >= output) + if(electricityStored >= output) { - setEnergy(energyStored - (output - EnergyNet.getForWorld(worldObj).emitEnergyFrom(this, output))); + setJoules(electricityStored - (output - EnergyNet.getForWorld(worldObj).emitEnergyFrom(this, output))*UniversalElectricity.IC2_RATIO); } } @@ -188,52 +145,24 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne if(isPowerReceptor(tileEntity)) { IPowerReceptor receptor = (IPowerReceptor)tileEntity; - int energyNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*10; - float transferEnergy = Math.max(Math.min(Math.min(energyNeeded, energyStored), 54000), 0); - receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), ForgeDirection.getOrientation(facing).getOpposite()); - setEnergy(energyStored - (int)transferEnergy); + double electricityNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*UniversalElectricity.BC3_RATIO; + float transferEnergy = (float)Math.max(Math.min(Math.min(electricityNeeded, electricityStored), 80000), 0); + receptor.getPowerProvider().receiveEnergy((float)(transferEnergy*UniversalElectricity.TO_BC_RATIO), ForgeDirection.getOrientation(facing).getOpposite()); + setJoules(electricityStored - (int)transferEnergy); } else if(tileEntity instanceof TileEntityConductor) { double joulesNeeded = ElectricityManager.instance.getElectricityRequired(((IConductor) tileEntity).getNetwork()); - double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(energyStored*UniversalElectricity.IC2_RATIO, getVoltage())), 80), 0); + double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored*UniversalElectricity.IC2_RATIO, getVoltage())), 80), 0); if (!worldObj.isRemote) { ElectricityManager.instance.produceElectricity(this, (IConductor)tileEntity, transferAmps, getVoltage()); } - setEnergy(energyStored - (int)(ElectricInfo.getJoules(transferAmps, getVoltage())*UniversalElectricity.TO_IC2_RATIO)); - } - else if(tileEntity instanceof IEnergyAcceptor) - { - if(((IEnergyAcceptor)tileEntity).canReceive(ForgeDirection.getOrientation(facing).getOpposite())) - { - int sendingEnergy = 0; - if(energyStored >= output) - { - sendingEnergy = output; - } - else if(energyStored < output) - { - sendingEnergy = energyStored; - } - - int rejects = ((IEnergyAcceptor)tileEntity).transferToAcceptor(sendingEnergy); - - setEnergy(energyStored - (sendingEnergy - rejects)); - } + setJoules(electricityStored - (int)(ElectricInfo.getJoules(transferAmps, getVoltage())*UniversalElectricity.TO_IC2_RATIO)); } } } } - - /** - * Set this block's energy to a new amount. - * @param energy - new amount of energy - */ - public void setEnergy(int energy) - { - energyStored = Math.max(Math.min(energy, MAX_ENERGY), 0); - } @Override public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction) @@ -244,13 +173,13 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public int getStored() { - return energyStored; + return (int)(electricityStored*UniversalElectricity.IC2_RATIO); } @Override public int getCapacity() { - return MAX_ENERGY; + return (int)(MAX_ELECTRICITY*UniversalElectricity.IC2_RATIO); } @Override @@ -262,25 +191,25 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public boolean demandsEnergy() { - return energyStored < MAX_ENERGY; + return electricityStored < MAX_ELECTRICITY; } @Override public int injectEnergy(Direction direction, int i) { - int rejects = 0; - int neededEnergy = MAX_ENERGY-energyStored; + double rejects = 0; + double neededEnergy = MAX_ELECTRICITY-electricityStored; if(i <= neededEnergy) { - energyStored += i; + electricityStored += i; } else if(i > neededEnergy) { - energyStored += neededEnergy; + electricityStored += neededEnergy; rejects = i-neededEnergy; } - return rejects; + return (int)(rejects*UniversalElectricity.TO_IC2_RATIO); } @Override @@ -298,19 +227,19 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public double getJoules(Object... data) { - return energyStored*UniversalElectricity.IC2_RATIO; + return electricityStored*UniversalElectricity.IC2_RATIO; } @Override - public void setJoules(double joules, Object... data) + public void setJoules(double joules, Object... data) { - setEnergy((int)(joules*UniversalElectricity.TO_IC2_RATIO)); + electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0); } @Override public double getMaxJoules(Object... data) { - return MAX_ENERGY*UniversalElectricity.IC2_RATIO; + return MAX_ELECTRICITY*UniversalElectricity.IC2_RATIO; } @Override @@ -365,25 +294,25 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side) { - int energyToReceive = (int)(ElectricInfo.getJoules(amps, voltage)*UniversalElectricity.TO_IC2_RATIO); - int energyNeeded = MAX_ENERGY - energyStored; - int energyToStore = 0; + double electricityToReceive = ElectricInfo.getJoules(amps, voltage); + double electricityNeeded = MAX_ELECTRICITY - electricityStored; + double electricityToStore = 0; - if(energyToReceive <= energyNeeded) + if(electricityToReceive <= electricityNeeded) { - energyToStore = energyToReceive; + electricityToStore = electricityToReceive; } - else if(energyToReceive > energyNeeded) + else if(electricityToReceive > electricityNeeded) { - energyToStore = energyNeeded; + electricityToStore = electricityNeeded; } - setEnergy(energyStored + energyToStore); + setJoules(electricityStored + electricityToStore); } @Override public double wattRequest() { - return ElectricInfo.getWatts(MAX_ENERGY*UniversalElectricity.IC2_RATIO) - ElectricInfo.getWatts(energyStored*UniversalElectricity.IC2_RATIO); + return ElectricInfo.getWatts(MAX_ELECTRICITY) - ElectricInfo.getWatts(electricityStored); } @Override @@ -410,13 +339,13 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; default: System.err.println("[Mekanism] Attempted to call unknown method with computer ID " + computer.getID()); return null; @@ -434,37 +363,13 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public void detach(IComputerAccess computer) {} - - @Override - public int transferToAcceptor(int amount) - { - int rejects = 0; - int neededEnergy = MAX_ENERGY-energyStored; - if(amount <= neededEnergy) - { - energyStored += amount; - } - else if(amount > neededEnergy) - { - energyStored += neededEnergy; - rejects = amount-neededEnergy; - } - - return rejects; - } - - @Override - public boolean canReceive(ForgeDirection side) - { - return side != ForgeDirection.getOrientation(facing); - } @Override public void handlePacketData(INetworkManager network, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); } catch (Exception e) { @@ -476,12 +381,12 @@ public class TileEntityPowerUnit extends TileEntityElectricBlock implements IEne @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored); } } diff --git a/src/common/mekanism/common/BlockAdvancedSolarGenerator.java b/src/common/mekanism/generators/common/BlockAdvancedSolarGenerator.java similarity index 93% rename from src/common/mekanism/common/BlockAdvancedSolarGenerator.java rename to src/common/mekanism/generators/common/BlockAdvancedSolarGenerator.java index 15337aca1..cf55679c5 100644 --- a/src/common/mekanism/common/BlockAdvancedSolarGenerator.java +++ b/src/common/mekanism/generators/common/BlockAdvancedSolarGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import java.util.List; import java.util.Random; @@ -8,7 +8,11 @@ import universalelectricity.prefab.multiblock.IMultiBlock; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; +import mekanism.common.Mekanism; +import mekanism.common.TileEntityBasicBlock; +import mekanism.common.TileEntityElectricBlock; import mekanism.common.BlockMachine.MachineType; +import mekanism.generators.client.GeneratorsClientProxy; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; @@ -116,7 +120,7 @@ public class BlockAdvancedSolarGenerator extends BlockContainer { if(!entityplayer.isSneaking()) { - entityplayer.openGui(Mekanism.instance, 10, world, x, y, z); + entityplayer.openGui(MekanismGenerators.instance, 1, world, x, y, z); return true; } } @@ -175,8 +179,9 @@ public class BlockAdvancedSolarGenerator extends BlockContainer } @Override + @SideOnly(Side.CLIENT) public int getRenderType() { - return Mekanism.RENDER_ID; + return GeneratorsClientProxy.RENDER_ID; } } diff --git a/src/common/mekanism/common/BlockBioGenerator.java b/src/common/mekanism/generators/common/BlockBioGenerator.java similarity index 92% rename from src/common/mekanism/common/BlockBioGenerator.java rename to src/common/mekanism/generators/common/BlockBioGenerator.java index abd36ab46..ac1682d29 100644 --- a/src/common/mekanism/common/BlockBioGenerator.java +++ b/src/common/mekanism/generators/common/BlockBioGenerator.java @@ -1,11 +1,15 @@ -package mekanism.common; +package mekanism.generators.common; import java.util.List; import java.util.Random; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; +import mekanism.common.Mekanism; +import mekanism.common.TileEntityBasicBlock; +import mekanism.common.TileEntityElectricBlock; import mekanism.common.BlockMachine.MachineType; +import mekanism.generators.client.GeneratorsClientProxy; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; @@ -103,7 +107,7 @@ public class BlockBioGenerator extends BlockContainer { if(!entityplayer.isSneaking()) { - entityplayer.openGui(Mekanism.instance, 13, world, x, y, z); + entityplayer.openGui(MekanismGenerators.instance, 4, world, x, y, z); return true; } } @@ -142,8 +146,9 @@ public class BlockBioGenerator extends BlockContainer } @Override + @SideOnly(Side.CLIENT) public int getRenderType() { - return Mekanism.RENDER_ID; + return GeneratorsClientProxy.RENDER_ID; } } diff --git a/src/common/mekanism/common/BlockGenerator.java b/src/common/mekanism/generators/common/BlockGenerator.java similarity index 89% rename from src/common/mekanism/common/BlockGenerator.java rename to src/common/mekanism/generators/common/BlockGenerator.java index f03b5b5c6..a38feb4b8 100644 --- a/src/common/mekanism/common/BlockGenerator.java +++ b/src/common/mekanism/generators/common/BlockGenerator.java @@ -1,10 +1,13 @@ -package mekanism.common; +package mekanism.generators.common; import java.util.List; import java.util.Random; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; +import mekanism.common.Mekanism; +import mekanism.common.TileEntityBasicBlock; +import mekanism.common.TileEntityElectricBlock; import mekanism.common.BlockMachine.MachineType; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; @@ -48,7 +51,7 @@ public class BlockGenerator extends BlockContainer int zPos = z + direction.offsetZ; //If this orientation faces a hydrogen reactor. - if(world.getBlockId(xPos, yPos, zPos) == Mekanism.generatorID && world.getBlockMetadata(xPos, yPos, zPos) == 3) + if(world.getBlockId(xPos, yPos, zPos) == MekanismGenerators.generatorID && world.getBlockMetadata(xPos, yPos, zPos) == 3) { hasReactor = true; //Set the separator's facing towards the reactor. @@ -96,48 +99,48 @@ public class BlockGenerator extends BlockContainer { if(side == 3) { - return 27; + return 2; } else if(side != 0 && side != 1) { - return 25; + return 0; } else { - return 26; + return 1; } } else if(meta == 1) { if(side == 3) { - return 30; + return 5; } else if(side == 1) { - return 28; + return 3; } else { - return 29; + return 4; } } else if(meta == 2) { if(side == 3) { - return 34; + return 8; } else { - return 35; + return 9; } } else if(meta == 3) { if(side == 3) { - return 33; + return 7; } else { - return 32; + return 6; } } else { @@ -156,38 +159,38 @@ public class BlockGenerator extends BlockContainer { if(side == tileEntity.facing) { - return 27; + return 2; } else if(side != 0 && side != 1) { - return 25; + return 0; } else { - return 26; + return 1; } } else if(metadata == 1) { if(side == tileEntity.facing) { - return 30; + return 5; } else if(side == 1) { - return 28; + return 3; } else { - return 29; + return 4; } } else if(metadata == 2) { if(side == tileEntity.facing) { - return 34; + return 8; } else { - return 35; + return 9; } } else if(metadata == 3) @@ -195,10 +198,10 @@ public class BlockGenerator extends BlockContainer TileEntityHydrogenGenerator generator = (TileEntityHydrogenGenerator)world.getBlockTileEntity(x, y, z); if(side == tileEntity.facing) { - return generator.isActive ? Mekanism.ANIMATED_TEXTURE_INDEX+5 : 33; + return generator.isActive ? Mekanism.ANIMATED_TEXTURE_INDEX+5 : 7; } else { - return generator.isActive ? Mekanism.ANIMATED_TEXTURE_INDEX+6 : 32; + return generator.isActive ? Mekanism.ANIMATED_TEXTURE_INDEX+6 : 6; } } else { @@ -281,7 +284,7 @@ public class BlockGenerator extends BlockContainer return true; } - if(metadata == 3 && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().isItemEqual(new ItemStack(Mekanism.Generator, 1, 2))) + if(metadata == 3 && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().isItemEqual(new ItemStack(MekanismGenerators.Generator, 1, 2))) { if(((TileEntityBasicBlock)world.getBlockTileEntity(x, y, z)).facing != facing) { @@ -295,7 +298,7 @@ public class BlockGenerator extends BlockContainer { if(!entityplayer.isSneaking()) { - entityplayer.openGui(Mekanism.instance, GeneratorType.getGuiID(metadata), world, x, y, z); + entityplayer.openGui(MekanismGenerators.instance, GeneratorType.getGuiID(metadata), world, x, y, z); return true; } } @@ -305,7 +308,7 @@ public class BlockGenerator extends BlockContainer @Override public String getTextureFile() { - return "/resources/mekanism/textures/terrain.png"; + return "/resources/mekanism/textures/generators/terrain.png"; } @Override @@ -341,10 +344,10 @@ public class BlockGenerator extends BlockContainer public static enum GeneratorType { - HEAT_GENERATOR(0, 9), - SOLAR_GENERATOR(1, 10), - ELECTROLYTIC_SEPARATOR(2, 11), - HYDROGEN_GENERATOR(3, 12); + HEAT_GENERATOR(0, 0), + SOLAR_GENERATOR(1, 1), + ELECTROLYTIC_SEPARATOR(2, 2), + HYDROGEN_GENERATOR(3, 3); private int meta; private int guiId; diff --git a/src/common/mekanism/common/ContainerBioGenerator.java b/src/common/mekanism/generators/common/ContainerBioGenerator.java similarity index 92% rename from src/common/mekanism/common/ContainerBioGenerator.java rename to src/common/mekanism/generators/common/ContainerBioGenerator.java index 778e5f1ce..2242e40cc 100644 --- a/src/common/mekanism/common/ContainerBioGenerator.java +++ b/src/common/mekanism/generators/common/ContainerBioGenerator.java @@ -1,8 +1,9 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; -import mekanism.api.IEnergizedItem; +import mekanism.common.Mekanism; +import mekanism.common.SlotEnergy; import net.minecraft.src.*; public class ContainerBioGenerator extends Container @@ -56,7 +57,7 @@ public class ContainerBioGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) + if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) { if(slotID != 1) { diff --git a/src/common/mekanism/common/ContainerElectrolyticSeparator.java b/src/common/mekanism/generators/common/ContainerElectrolyticSeparator.java similarity index 94% rename from src/common/mekanism/common/ContainerElectrolyticSeparator.java rename to src/common/mekanism/generators/common/ContainerElectrolyticSeparator.java index 71f40c61d..1eb9fa419 100644 --- a/src/common/mekanism/common/ContainerElectrolyticSeparator.java +++ b/src/common/mekanism/generators/common/ContainerElectrolyticSeparator.java @@ -1,10 +1,11 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; import mekanism.api.EnumGas; -import mekanism.api.IEnergizedItem; import mekanism.api.IStorageTank; +import mekanism.common.SlotEnergy; +import mekanism.common.SlotStorageTank; import net.minecraft.src.*; public class ContainerElectrolyticSeparator extends Container @@ -86,7 +87,7 @@ public class ContainerElectrolyticSeparator extends Container } } } - else if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) + else if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) { if(!mergeItemStack(slotStack, 3, 4, false)) { diff --git a/src/common/mekanism/common/ContainerHeatGenerator.java b/src/common/mekanism/generators/common/ContainerHeatGenerator.java similarity index 92% rename from src/common/mekanism/common/ContainerHeatGenerator.java rename to src/common/mekanism/generators/common/ContainerHeatGenerator.java index 7c3a8fbbc..dd651afb8 100644 --- a/src/common/mekanism/common/ContainerHeatGenerator.java +++ b/src/common/mekanism/generators/common/ContainerHeatGenerator.java @@ -1,8 +1,9 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; -import mekanism.api.IEnergizedItem; +import mekanism.common.Mekanism; +import mekanism.common.SlotEnergy; import net.minecraft.src.*; public class ContainerHeatGenerator extends Container @@ -56,7 +57,7 @@ public class ContainerHeatGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) + if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) { if(slotID != 1) { diff --git a/src/common/mekanism/common/ContainerHydrogenGenerator.java b/src/common/mekanism/generators/common/ContainerHydrogenGenerator.java similarity index 93% rename from src/common/mekanism/common/ContainerHydrogenGenerator.java rename to src/common/mekanism/generators/common/ContainerHydrogenGenerator.java index 488ddf59b..48373ae8e 100644 --- a/src/common/mekanism/common/ContainerHydrogenGenerator.java +++ b/src/common/mekanism/generators/common/ContainerHydrogenGenerator.java @@ -1,10 +1,10 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; import mekanism.api.EnumGas; -import mekanism.api.IEnergizedItem; import mekanism.api.IStorageTank; +import mekanism.common.SlotEnergy; import net.minecraft.src.*; public class ContainerHydrogenGenerator extends Container @@ -58,7 +58,7 @@ public class ContainerHydrogenGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) + if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem) { if(slotID != 1) { diff --git a/src/common/mekanism/common/ContainerSolarGenerator.java b/src/common/mekanism/generators/common/ContainerSolarGenerator.java similarity index 90% rename from src/common/mekanism/common/ContainerSolarGenerator.java rename to src/common/mekanism/generators/common/ContainerSolarGenerator.java index f825589cd..34fb0a6e7 100644 --- a/src/common/mekanism/common/ContainerSolarGenerator.java +++ b/src/common/mekanism/generators/common/ContainerSolarGenerator.java @@ -1,8 +1,8 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.IElectricItem; import universalelectricity.core.implement.IItemElectric; -import mekanism.api.IEnergizedItem; +import mekanism.common.SlotEnergy; import net.minecraft.src.*; public class ContainerSolarGenerator extends Container @@ -55,7 +55,7 @@ public class ContainerSolarGenerator extends Container ItemStack slotStack = currentSlot.getStack(); stack = slotStack.copy(); - if(slotStack.getItem() instanceof IEnergizedItem || slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) + if(slotStack.getItem() instanceof IItemElectric || slotStack.getItem() instanceof IElectricItem || slotStack.itemID == Item.redstone.shiftedIndex) { if(slotID != 0) { diff --git a/src/common/mekanism/generators/common/GeneratorsCommonProxy.java b/src/common/mekanism/generators/common/GeneratorsCommonProxy.java new file mode 100644 index 000000000..19ad54f81 --- /dev/null +++ b/src/common/mekanism/generators/common/GeneratorsCommonProxy.java @@ -0,0 +1,92 @@ +package mekanism.generators.common; + +import cpw.mods.fml.common.registry.GameRegistry; +import mekanism.common.ContainerAdvancedElectricMachine; +import mekanism.common.ContainerElectricMachine; +import mekanism.common.ContainerGasTank; +import mekanism.common.ContainerPowerUnit; +import mekanism.common.Mekanism; +import mekanism.common.TileEntityAdvancedElectricMachine; +import mekanism.common.TileEntityElectricMachine; +import mekanism.common.TileEntityGasTank; +import mekanism.common.TileEntityPowerUnit; +import net.minecraft.src.*; + +/** + * Common proxy for the Mekanism Generators module. + * @author AidanBrady + * + */ +public class GeneratorsCommonProxy +{ + /** + * Register tile entities that have special models. Overwritten in client to register TESRs. + */ + public void registerSpecialTileEntities() + { + GameRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator"); + GameRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator"); + } + + /** + * Register and load client-only render information. + */ + public void registerRenderInformation() {} + + /** + * Set and load the mod's common configuration properties. + */ + public void loadConfiguration() + { + Mekanism.configuration.load(); + MekanismGenerators.generatorID = Mekanism.configuration.getBlock("Generator", 3005).getInt(); + MekanismGenerators.advancedSolarGeneratorID = Mekanism.configuration.getBlock("AdvancedSolarGenerator", 3006).getInt(); + MekanismGenerators.bioGeneratorID = Mekanism.configuration.getBlock("BioGenerator", 3008).getInt(); + Mekanism.configuration.save(); + } + + /** + * Get the actual interface for a GUI. Client-only. + * @param ID - gui ID + * @param player - player that opened the GUI + * @param world - world the GUI was opened in + * @param x - gui's x position + * @param y - gui's y position + * @param z - gui's z position + * @return the GuiScreen of the GUI + */ + public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z) + { + return null; + } + + /** + * Get the container for a GUI. Common. + * @param ID - gui ID + * @param player - player that opened the GUI + * @param world - world the GUI was opened in + * @param x - gui's x position + * @param y - gui's y position + * @param z - gui's z position + * @return the Container of the GUI + */ + public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + switch(ID) + { + case 0: + return new ContainerHeatGenerator(player.inventory, (TileEntityHeatGenerator)tileEntity); + case 1: + return new ContainerSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity); + case 2: + return new ContainerElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity); + case 3: + return new ContainerHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity); + case 4: + return new ContainerBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); + } + return null; + } +} diff --git a/src/common/mekanism/generators/common/GeneratorsGuiHandler.java b/src/common/mekanism/generators/common/GeneratorsGuiHandler.java new file mode 100644 index 000000000..3d03db170 --- /dev/null +++ b/src/common/mekanism/generators/common/GeneratorsGuiHandler.java @@ -0,0 +1,26 @@ +package mekanism.generators.common; + +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.World; +import cpw.mods.fml.common.network.IGuiHandler; + +/** + * Client and server GUI hander for Mekanism. + * Uses CommonProxy to get the server GUI and ClientProxy for the client GUI. + * @author AidanBrady + * + */ +public class GeneratorsGuiHandler implements IGuiHandler +{ + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + return MekanismGenerators.proxy.getServerGui(ID, player, world, x, y, z); + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + return MekanismGenerators.proxy.getClientGui(ID, player, world, x, y, z); + } +} diff --git a/src/common/mekanism/common/ItemBlockGenerator.java b/src/common/mekanism/generators/common/ItemBlockGenerator.java similarity index 96% rename from src/common/mekanism/common/ItemBlockGenerator.java rename to src/common/mekanism/generators/common/ItemBlockGenerator.java index e653ed0bd..1a41e01aa 100644 --- a/src/common/mekanism/common/ItemBlockGenerator.java +++ b/src/common/mekanism/generators/common/ItemBlockGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import net.minecraft.src.*; diff --git a/src/common/mekanism/generators/common/ItemMekanismGenerators.java b/src/common/mekanism/generators/common/ItemMekanismGenerators.java new file mode 100644 index 000000000..519cb5d06 --- /dev/null +++ b/src/common/mekanism/generators/common/ItemMekanismGenerators.java @@ -0,0 +1,18 @@ +package mekanism.generators.common; + +import mekanism.common.ItemMekanism; +import net.minecraft.src.*; + +public class ItemMekanismGenerators extends ItemMekanism +{ + public ItemMekanismGenerators(int id) + { + super(id); + } + + @Override + public String getTextureFile() + { + return "/resources/mekanism/textures/generators/items.png"; + } +} diff --git a/src/common/mekanism/generators/common/MekanismGenerators.java b/src/common/mekanism/generators/common/MekanismGenerators.java new file mode 100644 index 000000000..cb50072a1 --- /dev/null +++ b/src/common/mekanism/generators/common/MekanismGenerators.java @@ -0,0 +1,169 @@ +package mekanism.generators.common; + +import java.util.Random; + +import net.minecraft.src.*; +import net.minecraftforge.common.EnumHelper; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent; +import net.minecraftforge.oredict.ShapedOreRecipe; +import mekanism.common.CommonProxy; +import mekanism.common.ItemMekanism; +import mekanism.common.Mekanism; +import mekanism.common.RecipeHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.Side; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.Mod.Init; +import cpw.mods.fml.common.asm.SideOnly; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.network.NetworkMod; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; + +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.0.0", dependencies = "required-after:Mekanism") +@NetworkMod(clientSideRequired = true, serverSideRequired = false) +public class MekanismGenerators +{ + @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") + public static GeneratorsCommonProxy proxy; + + @Instance("MekanismGenerators") + public static MekanismGenerators instance; + + //Items + public static Item BioFuel; + public static Item ElectrolyticCore; + public static Item SolarPanel; + + //Blocks + public static Block BioGenerator; + public static Block Generator; + public static Block AdvancedSolarGenerator; + + //Block IDs + public static int generatorID = 3005; + public static int advancedSolarGeneratorID = 3006; + public static int bioGeneratorID = 3008; + + @Init + public void init(FMLInitializationEvent event) + { + //Set up the GUI handler + NetworkRegistry.instance().registerGuiHandler(this, new GeneratorsGuiHandler()); + + //Load the proxy + proxy.registerSpecialTileEntities(); + proxy.registerRenderInformation(); + + //Load this module + addBlocks(); + addItems(); + addTextures(); + addNames(); + addRecipes(); + addEntities(); + + //Finalization + Mekanism.logger.info("[MekanismGenerators] Loaded module."); + } + + public void addRecipes() + { + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 0), new Object[] { + "GGG", "ECE", "IRI", Character.valueOf('G'), Item.lightStoneDust, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('C'), new ItemStack(Mekanism.BasicBlock, 1, 3), Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 1), new Object[] { + "SSS", "AIA", "PEP", Character.valueOf('S'), SolarPanel, Character.valueOf('A'), Mekanism.EnrichedAlloy, Character.valueOf('I'), Block.blockSteel, Character.valueOf('P'), "dustPlatinum", Character.valueOf('E'), Mekanism.EnergyTablet.getUnchargedItem() + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(AdvancedSolarGenerator), new Object[] { + "SES", "SES", "III", Character.valueOf('S'), new ItemStack(Generator, 1, 1), Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('I'), Item.ingotIron + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BioGenerator), new Object[] { + "RER", "BIB", "NEN", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('B'), BioFuel, Character.valueOf('I'), new ItemStack(Mekanism.BasicBlock, 1, 5), Character.valueOf('N'), Item.ingotIron + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 2), new Object[] { + "IRI", "ECE", "IRI", Character.valueOf('I'), Item.ingotIron, Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('C'), ElectrolyticCore + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 3), new Object[] { + "PEP", "ICI", "PEP", Character.valueOf('P'), "ingotPlatinum", Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('I'), new ItemStack(Mekanism.BasicBlock, 1, 5), Character.valueOf('C'), ElectrolyticCore + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ElectrolyticCore), new Object[] { + "EPE", "IEG", "EPE", Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('P'), "dustPlatinum", Character.valueOf('I'), "dustIron", Character.valueOf('G'), "dustGold" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(SolarPanel), new Object[] { + "GGG", "RAR", "PPP", Character.valueOf('G'), Block.thinGlass, Character.valueOf('R'), Item.redstone, Character.valueOf('A'), Mekanism.EnrichedAlloy, Character.valueOf('P'), "ingotPlatinum" + })); + + //BioFuel Crusher Recipes + RecipeHandler.addCrusherRecipe(new ItemStack(Block.sapling), new ItemStack(BioFuel, 2)); + RecipeHandler.addCrusherRecipe(new ItemStack(Block.tallGrass), new ItemStack(BioFuel, 2)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.seeds), new ItemStack(BioFuel, 1)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.wheat), new ItemStack(BioFuel, 2)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.pumpkinSeeds), new ItemStack(BioFuel, 1)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.melonSeeds), new ItemStack(BioFuel, 1)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.appleRed), new ItemStack(BioFuel, 3)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.bread), new ItemStack(BioFuel, 3)); + RecipeHandler.addCrusherRecipe(new ItemStack(Item.potato), new ItemStack(BioFuel, 2)); + + for(int i = 0; i < BlockLeaves.LEAF_TYPES.length; i++) + { + RecipeHandler.addCrusherRecipe(new ItemStack(Block.sapling, 1, i), new ItemStack(BioFuel, 2)); + } + } + + public void addNames() + { + LanguageRegistry.addName(BioGenerator, "Bio-Generator"); + LanguageRegistry.addName(BioFuel, "Bio Fuel"); + LanguageRegistry.addName(ElectrolyticCore, "Electrolytic Core"); + LanguageRegistry.addName(AdvancedSolarGenerator, "Advanced Solar Generator"); + LanguageRegistry.addName(SolarPanel, "Solar Panel"); + + //Localization for Generator + LanguageRegistry.instance().addStringLocalization("tile.Generator.HeatGenerator.name", "Heat Generator"); + LanguageRegistry.instance().addStringLocalization("tile.Generator.SolarGenerator.name", "Solar Generator"); + LanguageRegistry.instance().addStringLocalization("tile.Generator.ElectrolyticSeparator.name", "Electrolytic Separator"); + LanguageRegistry.instance().addStringLocalization("tile.Generator.HydrogenGenerator.name", "Hydrogen Generator"); + } + + public void addTextures() + { + SolarPanel.setIconIndex(2); + BioFuel.setIconIndex(0); + ElectrolyticCore.setIconIndex(1); + } + + public void addEntities() + { + GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator"); + GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator"); + GameRegistry.registerTileEntity(TileEntityElectrolyticSeparator.class, "ElectrolyticSeparator"); + GameRegistry.registerTileEntity(TileEntityHydrogenGenerator.class, "HydrogenGenerator"); + } + + public void addBlocks() + { + Generator = new BlockGenerator(generatorID).setBlockName("Generator"); + AdvancedSolarGenerator = new BlockAdvancedSolarGenerator(advancedSolarGeneratorID).setBlockName("AdvancedSolarGenerator"); + BioGenerator = new BlockBioGenerator(bioGeneratorID).setBlockName("BioGenerator"); + + //Registrations + GameRegistry.registerBlock(AdvancedSolarGenerator); + GameRegistry.registerBlock(BioGenerator); + + Item.itemsList[generatorID] = new ItemBlockGenerator(generatorID - 256, Generator).setItemName("Generator"); + } + + public void addItems() + { + SolarPanel = new ItemMekanismGenerators(11314).setItemName("SolarPanel"); + BioFuel = new ItemMekanismGenerators(11318).setItemName("BioFuel"); + ElectrolyticCore = new ItemMekanismGenerators(11319).setItemName("ElectrolyticCore"); + } +} diff --git a/src/common/mekanism/common/TileEntityAdvancedSolarGenerator.java b/src/common/mekanism/generators/common/TileEntityAdvancedSolarGenerator.java similarity index 79% rename from src/common/mekanism/common/TileEntityAdvancedSolarGenerator.java rename to src/common/mekanism/generators/common/TileEntityAdvancedSolarGenerator.java index 8c929b61d..9a5db42bc 100644 --- a/src/common/mekanism/common/TileEntityAdvancedSolarGenerator.java +++ b/src/common/mekanism/generators/common/TileEntityAdvancedSolarGenerator.java @@ -1,15 +1,16 @@ -package mekanism.common; +package mekanism.generators.common; import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.multiblock.*; -import mekanism.common.BlockGenerator.GeneratorType; +import mekanism.common.Mekanism; +import mekanism.generators.common.BlockGenerator.GeneratorType; import net.minecraft.src.*; public class TileEntityAdvancedSolarGenerator extends TileEntitySolarGenerator implements IMultiBlock { public TileEntityAdvancedSolarGenerator() { - super("Advanced Solar Generator", 96000, 128, 128); + super("Advanced Solar Generator", 96000, 32, 32); } @Override @@ -48,7 +49,7 @@ public class TileEntityAdvancedSolarGenerator extends TileEntitySolarGenerator i { if(!entityplayer.isSneaking()) { - entityplayer.openGui(Mekanism.instance, 10, worldObj, xCoord, yCoord, zCoord); + entityplayer.openGui(MekanismGenerators.instance, 1, worldObj, xCoord, yCoord, zCoord); return true; } return false; diff --git a/src/common/mekanism/common/TileEntityBioGenerator.java b/src/common/mekanism/generators/common/TileEntityBioGenerator.java similarity index 79% rename from src/common/mekanism/common/TileEntityBioGenerator.java rename to src/common/mekanism/generators/common/TileEntityBioGenerator.java index 7f80e57dc..b1c07394d 100644 --- a/src/common/mekanism/common/TileEntityBioGenerator.java +++ b/src/common/mekanism/generators/common/TileEntityBioGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.ElectricItem; import ic2.api.IElectricItem; @@ -9,7 +9,9 @@ import universalelectricity.core.implement.IItemElectric; import com.google.common.io.ByteArrayDataInput; import dan200.computer.api.IComputerAccess; -import mekanism.api.IEnergizedItem; +import mekanism.common.LiquidSlot; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.liquids.ILiquidTank; @@ -33,36 +35,19 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank { super.onUpdate(); - if(inventory[1] != null && energyStored > 0) + if(inventory[1] != null && electricityStored > 0) { - if(inventory[1].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[1].getItem(); - int sendingEnergy = 0; - - if(item.getRate() <= energyStored) - { - sendingEnergy = item.getRate(); - } - else if(item.getRate() > energyStored) - { - sendingEnergy = energyStored; - } - - int rejects = item.charge(inventory[1], sendingEnergy); - setEnergy(energyStored - (sendingEnergy - rejects)); - } - else if(inventory[1].getItem() instanceof IItemElectric) + if(inventory[1].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[1].getItem(); - double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), (energyStored*UniversalElectricity.IC2_RATIO)); + double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), electricityStored); double joules = electricItem.onReceive(ampsToGive, getVoltage(), inventory[1]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); + setJoules(electricityStored - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); } else if(inventory[1].getItem() instanceof IElectricItem) { - int sent = ElectricItem.charge(inventory[1], energyStored, 3, false, false); - setEnergy(energyStored - sent); + double sent = ElectricItem.charge(inventory[1], (int)(electricityStored*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored - sent); } } @@ -94,7 +79,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank } } - if(energyStored < MAX_ENERGY) + if(electricityStored < MAX_ELECTRICITY) { if(canOperate()) { @@ -103,7 +88,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank setActive(true); } bioFuelSlot.setLiquid(bioFuelSlot.liquidStored - 10); - setEnergy(energyStored + 16); + setJoules(electricityStored + 16); } else { if(!worldObj.isRemote) @@ -117,7 +102,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank @Override public boolean canOperate() { - return energyStored < MAX_ENERGY && bioFuelSlot.liquidStored > 0; + return electricityStored < MAX_ELECTRICITY && bioFuelSlot.liquidStored > 0; } @Override @@ -144,7 +129,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank public int getFuel(ItemStack itemstack) { - return itemstack.itemID == Mekanism.BioFuel.shiftedIndex ? 100 : 0; + return itemstack.itemID == MekanismGenerators.BioFuel.shiftedIndex ? 100 : 0; } /** @@ -162,7 +147,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank { try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); isActive = dataStream.readBoolean(); bioFuelSlot.liquidStored = dataStream.readInt(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); @@ -176,13 +161,13 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored, isActive, bioFuelSlot.liquidStored); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, isActive, bioFuelSlot.liquidStored); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored, isActive, bioFuelSlot.liquidStored); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, isActive, bioFuelSlot.liquidStored); } @Override @@ -197,13 +182,13 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; case 4: return new Object[] {bioFuelSlot.liquidStored}; case 5: diff --git a/src/common/mekanism/common/TileEntityElectrolyticSeparator.java b/src/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java similarity index 81% rename from src/common/mekanism/common/TileEntityElectrolyticSeparator.java rename to src/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java index dae538707..0e1f76345 100644 --- a/src/common/mekanism/common/TileEntityElectrolyticSeparator.java +++ b/src/common/mekanism/generators/common/TileEntityElectrolyticSeparator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.Direction; import ic2.api.ElectricItem; @@ -7,6 +7,7 @@ import ic2.api.IEnergySink; import universalelectricity.core.UniversalElectricity; import universalelectricity.core.electricity.ElectricInfo; import universalelectricity.core.implement.IElectricityReceiver; +import universalelectricity.core.implement.IItemElectric; import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.vector.Vector3; @@ -15,12 +16,13 @@ import com.google.common.io.ByteArrayDataInput; import dan200.computer.api.IComputerAccess; import dan200.computer.api.IPeripheral; import mekanism.api.EnumGas; -import mekanism.api.IEnergizedItem; -import mekanism.api.IEnergyAcceptor; import mekanism.api.IGasAcceptor; import mekanism.api.IGasStorage; import mekanism.api.IStorageTank; import mekanism.api.ITileNetwork; +import mekanism.common.LiquidSlot; +import mekanism.common.PacketHandler; +import mekanism.common.TileEntityElectricBlock; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.liquids.ILiquidTank; @@ -28,7 +30,7 @@ import net.minecraftforge.liquids.ITankContainer; import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidTank; -public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IGasStorage, IEnergySink, IJouleStorage, IElectricityReceiver, IEnergyAcceptor, ITankContainer, IPeripheral +public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IGasStorage, IEnergySink, IJouleStorage, IElectricityReceiver, ITankContainer, IPeripheral { public LiquidSlot waterSlot = new LiquidSlot(24000, 9); @@ -67,26 +69,16 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp oxygenStored = MAX_GAS; } - if(inventory[3] != null && energyStored < MAX_ENERGY) + if(inventory[3] != null && electricityStored < MAX_ELECTRICITY) { - if(inventory[3].getItem() instanceof IEnergizedItem) + if(inventory[3].getItem() instanceof IItemElectric) { - IEnergizedItem item = (IEnergizedItem)inventory[3].getItem(); - - if(item.canBeDischarged()) + IItemElectric electricItem = (IItemElectric) inventory[3].getItem(); + + if (electricItem.canProduceElectricity()) { - int received = 0; - int energyNeeded = MAX_ENERGY - energyStored; - if(item.getRate() <= energyNeeded) - { - received = item.discharge(inventory[3], item.getRate()); - } - else if(item.getRate() > energyNeeded) - { - received = item.discharge(inventory[3], energyNeeded); - } - - setEnergy(energyStored + received); + double joulesReceived = electricItem.onUse(electricItem.getMaxJoules() * 0.005, inventory[3]); + setJoules(electricityStored + joulesReceived); } } else if(inventory[3].getItem() instanceof IElectricItem) @@ -94,8 +86,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp IElectricItem item = (IElectricItem)inventory[3].getItem(); if(item.canProvideEnergy()) { - int gain = ElectricItem.discharge(inventory[3], MAX_ENERGY - energyStored, 3, false, false); - setEnergy(energyStored + gain); + double gain = ElectricItem.discharge(inventory[3], (int)((MAX_ELECTRICITY - electricityStored)*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored + gain); } } } @@ -168,10 +160,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp } } - if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterSlot.liquidStored-2 >= 0 && energyStored-4 > 0) + if(oxygenStored < MAX_GAS && hydrogenStored < MAX_GAS && waterSlot.liquidStored-2 >= 0 && electricityStored-4 > 0) { waterSlot.setLiquid(waterSlot.liquidStored - 10); - setEnergy(energyStored - 4); + setJoules(electricityStored - 4); setGas(EnumGas.OXYGEN, oxygenStored + 1); setGas(EnumGas.HYDROGEN, hydrogenStored + 1); } @@ -239,7 +231,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp */ public int getScaledEnergyLevel(int i) { - return energyStored*i / MAX_ENERGY; + return (int)(electricityStored*i / MAX_ELECTRICITY); } @Override @@ -259,7 +251,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); waterSlot.liquidStored = dataStream.readInt(); oxygenStored = dataStream.readInt(); hydrogenStored = dataStream.readInt(); @@ -275,13 +267,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored, waterSlot.liquidStored, oxygenStored, hydrogenStored, outputType.name); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, waterSlot.liquidStored, oxygenStored, hydrogenStored, outputType.name); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored, waterSlot.liquidStored, oxygenStored, hydrogenStored, outputType.name); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, waterSlot.liquidStored, oxygenStored, hydrogenStored, outputType.name); } /** @@ -290,7 +282,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp */ public void setEnergy(int energy) { - energyStored = Math.max(Math.min(energy, MAX_ENERGY), 0); + electricityStored = Math.max(Math.min(energy, MAX_ELECTRICITY), 0); } @Override @@ -321,40 +313,16 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp return 0; } - @Override - public int transferToAcceptor(int amount) - { - int rejects = 0; - int neededEnergy = MAX_ENERGY-energyStored; - if(amount <= neededEnergy) - { - energyStored += amount; - } - else if(amount > neededEnergy) - { - energyStored += neededEnergy; - rejects = amount-neededEnergy; - } - - return rejects; - } - - @Override - public boolean canReceive(ForgeDirection side) - { - return true; - } - @Override public double getMaxJoules(Object... data) { - return MAX_ENERGY*UniversalElectricity.IC2_RATIO; + return MAX_ELECTRICITY*UniversalElectricity.IC2_RATIO; } @Override public double getJoules(Object... data) { - return energyStored*UniversalElectricity.IC2_RATIO; + return electricityStored*UniversalElectricity.IC2_RATIO; } @Override @@ -384,49 +352,49 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp @Override public double wattRequest() { - return energyStored < MAX_ENERGY ? ElectricInfo.getWatts((16)*UniversalElectricity.IC2_RATIO) : 0; + return electricityStored < MAX_ELECTRICITY ? ElectricInfo.getWatts((16)*UniversalElectricity.IC2_RATIO) : 0; } @Override public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side) { - int energyToReceive = (int)(ElectricInfo.getJoules(amps, voltage)*UniversalElectricity.TO_IC2_RATIO); - int energyNeeded = MAX_ENERGY - energyStored; - int energyToStore = 0; + double electricityToReceive = ElectricInfo.getJoules(amps, voltage); + double electricityNeeded = MAX_ELECTRICITY - electricityStored; + double electricityToStore = 0; - if(energyToReceive <= energyNeeded) + if(electricityToReceive <= electricityNeeded) { - energyToStore = energyToReceive; + electricityToStore = electricityToReceive; } - else if(energyToReceive > energyNeeded) + else if(electricityToReceive > electricityNeeded) { - energyToStore = energyNeeded; + electricityToStore = electricityNeeded; } - setEnergy(energyStored + energyToStore); + setJoules(electricityStored + electricityToStore); } @Override public boolean demandsEnergy() { - return energyStored < MAX_ENERGY; + return electricityStored < MAX_ELECTRICITY; } @Override public int injectEnergy(Direction direction, int i) { - int rejects = 0; - int neededEnergy = MAX_ENERGY-energyStored; + double rejects = 0; + double neededEnergy = MAX_ELECTRICITY-electricityStored; if(i <= neededEnergy) { - energyStored += i; + electricityStored += i; } else if(i > neededEnergy) { - energyStored += neededEnergy; + electricityStored += neededEnergy; rejects = i-neededEnergy; } - return rejects; + return (int)(rejects*UniversalElectricity.TO_IC2_RATIO); } @Override @@ -536,13 +504,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; case 4: return new Object[] {waterSlot.liquidStored}; case 5: diff --git a/src/common/mekanism/common/TileEntityGenerator.java b/src/common/mekanism/generators/common/TileEntityGenerator.java similarity index 75% rename from src/common/mekanism/common/TileEntityGenerator.java rename to src/common/mekanism/generators/common/TileEntityGenerator.java index efa1af688..c51b33cd1 100644 --- a/src/common/mekanism/common/TileEntityGenerator.java +++ b/src/common/mekanism/generators/common/TileEntityGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import buildcraft.api.power.IPowerProvider; import buildcraft.api.power.IPowerReceptor; @@ -24,8 +24,8 @@ import universalelectricity.core.implement.IElectricityReceiver; import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.tile.TileEntityConductor; -import mekanism.api.IEnergizedItem; -import mekanism.api.IEnergyAcceptor; +import mekanism.common.Mekanism; +import mekanism.common.TileEntityElectricBlock; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; @@ -59,22 +59,22 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem if(PowerFramework.currentFramework != null) { powerProvider = PowerFramework.currentFramework.createPowerProvider(); - powerProvider.configure(0, 2, 2000, 1, MAX_ENERGY/10); + powerProvider.configure(0, 2, 2000, 1, (int)(MAX_ELECTRICITY*UniversalElectricity.TO_BC_RATIO)); } } @Override public void onUpdate() { - if(energyStored > 0) + if(electricityStored > 0) { TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), ForgeDirection.getOrientation(facing)); if(Mekanism.hooks.IC2Loaded) { - if(energyStored >= output) + if(electricityStored >= output) { - setEnergy(energyStored - (output - EnergyNet.getForWorld(worldObj).emitEnergyFrom(this, output))); + setJoules(electricityStored - (output - EnergyNet.getForWorld(worldObj).emitEnergyFrom(this, output))*UniversalElectricity.IC2_RATIO); } } @@ -83,39 +83,20 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem if(isPowerReceptor(tileEntity)) { IPowerReceptor receptor = (IPowerReceptor)tileEntity; - int energyNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*10; - float transferEnergy = Math.max(Math.min(Math.min(energyNeeded, energyStored), 54000), 0); - receptor.getPowerProvider().receiveEnergy((float)(transferEnergy/10), ForgeDirection.getOrientation(facing).getOpposite()); - setEnergy(energyStored - (int)transferEnergy); + double electricityNeeded = Math.min(receptor.getPowerProvider().getMinEnergyReceived(), receptor.getPowerProvider().getMaxEnergyReceived())*UniversalElectricity.BC3_RATIO; + float transferEnergy = (float)Math.max(Math.min(Math.min(electricityNeeded, electricityStored), 80000), 0); + receptor.getPowerProvider().receiveEnergy((float)(transferEnergy*UniversalElectricity.TO_BC_RATIO), ForgeDirection.getOrientation(facing).getOpposite()); + setJoules(electricityStored - (int)transferEnergy); } else if(tileEntity instanceof TileEntityConductor) { double joulesNeeded = ElectricityManager.instance.getElectricityRequired(((IConductor) tileEntity).getNetwork()); - double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(energyStored*UniversalElectricity.IC2_RATIO, getVoltage())), 80), 0); + double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored*UniversalElectricity.IC2_RATIO, getVoltage())), 80), 0); if (!worldObj.isRemote) { ElectricityManager.instance.produceElectricity(this, (IConductor)tileEntity, transferAmps, getVoltage()); } - setEnergy(energyStored - (int)(ElectricInfo.getJoules(transferAmps, getVoltage())*UniversalElectricity.TO_IC2_RATIO)); - } - else if(tileEntity instanceof IEnergyAcceptor) - { - if(((IEnergyAcceptor)tileEntity).canReceive(ForgeDirection.getOrientation(facing).getOpposite())) - { - int sendingEnergy = 0; - if(energyStored >= output) - { - sendingEnergy = output; - } - else if(energyStored < output) - { - sendingEnergy = energyStored; - } - - int rejects = ((IEnergyAcceptor)tileEntity).transferToAcceptor(sendingEnergy); - - setEnergy(energyStored - (sendingEnergy - rejects)); - } + setJoules(electricityStored - (int)(ElectricInfo.getJoules(transferAmps, getVoltage())*UniversalElectricity.TO_IC2_RATIO)); } } } @@ -156,16 +137,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem */ public int getScaledEnergyLevel(int i) { - return energyStored*i / MAX_ENERGY; - } - - /** - * Set this block's energy to a new amount. - * @param energy - new amount of energy - */ - public void setEnergy(int energy) - { - energyStored = Math.max(Math.min(energy, MAX_ENERGY), 0); + return (int)(electricityStored*i / MAX_ELECTRICITY); } /** @@ -191,9 +163,9 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem } @Override - public void setJoules(double joules, Object... data) + public void setJoules(double joules, Object... data) { - setEnergy((int)(joules*UniversalElectricity.TO_IC2_RATIO)); + electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0); } @Override @@ -238,13 +210,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem @Override public double getMaxJoules(Object... data) { - return MAX_ENERGY*UniversalElectricity.IC2_RATIO; + return MAX_ELECTRICITY*UniversalElectricity.IC2_RATIO; } @Override public double getJoules(Object... data) { - return energyStored*UniversalElectricity.IC2_RATIO; + return electricityStored*UniversalElectricity.IC2_RATIO; } @Override @@ -262,13 +234,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem @Override public int getStored() { - return energyStored; + return (int)(electricityStored*UniversalElectricity.IC2_RATIO); } @Override public int getCapacity() { - return MAX_ENERGY; + return (int)(MAX_ELECTRICITY*UniversalElectricity.IC2_RATIO); } @Override diff --git a/src/common/mekanism/common/TileEntityHeatGenerator.java b/src/common/mekanism/generators/common/TileEntityHeatGenerator.java similarity index 80% rename from src/common/mekanism/common/TileEntityHeatGenerator.java rename to src/common/mekanism/generators/common/TileEntityHeatGenerator.java index 2d4d40709..9a96f7343 100644 --- a/src/common/mekanism/common/TileEntityHeatGenerator.java +++ b/src/common/mekanism/generators/common/TileEntityHeatGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import java.io.DataOutputStream; @@ -13,7 +13,9 @@ import com.google.common.io.ByteArrayDataInput; import dan200.computer.api.IComputerAccess; -import mekanism.api.IEnergizedItem; +import mekanism.common.LiquidSlot; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.liquids.ILiquidTank; @@ -28,7 +30,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan public TileEntityHeatGenerator() { - super("Heat Generator", 16000, 64); + super("Heat Generator", 16000, 32); inventory = new ItemStack[2]; } @@ -37,36 +39,19 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan { super.onUpdate(); - if(inventory[1] != null && energyStored > 0) + if(inventory[1] != null && electricityStored > 0) { - if(inventory[1].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[1].getItem(); - int sendingEnergy = 0; - - if(item.getRate() <= energyStored) - { - sendingEnergy = item.getRate(); - } - else if(item.getRate() > energyStored) - { - sendingEnergy = energyStored; - } - - int rejects = item.charge(inventory[1], sendingEnergy); - setEnergy(energyStored - (sendingEnergy - rejects)); - } - else if(inventory[1].getItem() instanceof IItemElectric) + if(inventory[1].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[1].getItem(); - double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), (energyStored*UniversalElectricity.IC2_RATIO)); + double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), electricityStored); double joules = electricItem.onReceive(ampsToGive, getVoltage(), inventory[1]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); + setJoules(electricityStored - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); } else if(inventory[1].getItem() instanceof IElectricItem) { - int sent = ElectricItem.charge(inventory[1], energyStored, 3, false, false); - setEnergy(energyStored - sent); + double sent = ElectricItem.charge(inventory[1], (int)(electricityStored*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored - sent); } } @@ -98,9 +83,9 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan } } - if(energyStored < MAX_ENERGY) + if(electricityStored < MAX_ELECTRICITY) { - setEnergy(energyStored + getEnvironmentBoost()); + setJoules(electricityStored + getEnvironmentBoost()); if(canOperate()) { @@ -109,7 +94,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan setActive(true); } fuelSlot.setLiquid(fuelSlot.liquidStored - 10); - setEnergy(energyStored + 16); + setJoules(electricityStored + 8); } else { if(!worldObj.isRemote) @@ -123,7 +108,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan @Override public boolean canOperate() { - return energyStored < MAX_ENERGY && fuelSlot.liquidStored > 0; + return electricityStored < MAX_ELECTRICITY && fuelSlot.liquidStored > 0; } @Override @@ -148,17 +133,17 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan int boost = 0; if(worldObj.getBlockId(xCoord+1, yCoord, zCoord) == 10 || worldObj.getBlockId(xCoord+1, yCoord, zCoord) == 11) - boost+=8; + boost+=4; if(worldObj.getBlockId(xCoord-1, yCoord, zCoord) == 10 || worldObj.getBlockId(xCoord-1, yCoord, zCoord) == 11) - boost+=8; + boost+=4; if(worldObj.getBlockId(xCoord, yCoord+1, zCoord) == 10 || worldObj.getBlockId(xCoord, yCoord+1, zCoord) == 11) - boost+=8; + boost+=4; if(worldObj.getBlockId(xCoord, yCoord-1, zCoord) == 10 || worldObj.getBlockId(xCoord, yCoord-1, zCoord) == 11) - boost+=8; + boost+=4; if(worldObj.getBlockId(xCoord, yCoord, zCoord+1) == 10 || worldObj.getBlockId(xCoord, yCoord, zCoord+1) == 11) - boost+=8; + boost+=4; if(worldObj.getBlockId(xCoord, yCoord, zCoord-1) == 10 || worldObj.getBlockId(xCoord, yCoord, zCoord-1) == 11) - boost+=8; + boost+=4; return boost; } @@ -183,7 +168,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan { try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); isActive = dataStream.readBoolean(); fuelSlot.liquidStored = dataStream.readInt(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); @@ -197,13 +182,13 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored, isActive, fuelSlot.liquidStored); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, isActive, fuelSlot.liquidStored); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored, isActive, fuelSlot.liquidStored); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, isActive, fuelSlot.liquidStored); } @Override @@ -218,13 +203,13 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; case 4: return new Object[] {fuelSlot.liquidStored}; case 5: diff --git a/src/common/mekanism/common/TileEntityHydrogenGenerator.java b/src/common/mekanism/generators/common/TileEntityHydrogenGenerator.java similarity index 80% rename from src/common/mekanism/common/TileEntityHydrogenGenerator.java rename to src/common/mekanism/generators/common/TileEntityHydrogenGenerator.java index b46843cd6..1cb29bfde 100644 --- a/src/common/mekanism/common/TileEntityHydrogenGenerator.java +++ b/src/common/mekanism/generators/common/TileEntityHydrogenGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.ElectricItem; import ic2.api.IElectricItem; @@ -10,10 +10,10 @@ import com.google.common.io.ByteArrayDataInput; import dan200.computer.api.IComputerAccess; import mekanism.api.EnumGas; -import mekanism.api.IEnergizedItem; import mekanism.api.IGasAcceptor; import mekanism.api.IGasStorage; import mekanism.api.IStorageTank; +import mekanism.common.PacketHandler; import net.minecraft.src.*; import net.minecraftforge.common.ForgeDirection; @@ -35,36 +35,19 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements { super.onUpdate(); - if(inventory[1] != null && energyStored > 0) + if(inventory[1] != null && electricityStored > 0) { - if(inventory[1].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[1].getItem(); - int sendingEnergy = 0; - - if(item.getRate() <= energyStored) - { - sendingEnergy = item.getRate(); - } - else if(item.getRate() > energyStored) - { - sendingEnergy = energyStored; - } - - int rejects = item.charge(inventory[1], sendingEnergy); - setEnergy(energyStored - (sendingEnergy - rejects)); - } - else if(inventory[1].getItem() instanceof IItemElectric) + if(inventory[1].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[1].getItem(); - double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), (energyStored*UniversalElectricity.IC2_RATIO)); + double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), electricityStored); double joules = electricItem.onReceive(ampsToGive, getVoltage(), inventory[1]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); + setJoules(electricityStored - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); } else if(inventory[1].getItem() instanceof IElectricItem) { - int sent = ElectricItem.charge(inventory[1], energyStored, 3, false, false); - setEnergy(energyStored - sent); + double sent = ElectricItem.charge(inventory[1], (int)(electricityStored*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored - sent); } } @@ -105,7 +88,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements } hydrogenStored--; - setEnergy(energyStored + 128*getEnvironmentBoost()); + setJoules(electricityStored + 128*getEnvironmentBoost()); } else { if(!worldObj.isRemote) @@ -138,7 +121,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements @Override public boolean canOperate() { - return energyStored < MAX_ENERGY && hydrogenStored > 0; + return electricityStored < MAX_ELECTRICITY && hydrogenStored > 0; } /** @@ -163,13 +146,13 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; case 4: return new Object[] {hydrogenStored}; case 5: @@ -185,7 +168,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements { try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); hydrogenStored = dataStream.readInt(); isActive = dataStream.readBoolean(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); @@ -199,13 +182,13 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored, hydrogenStored, isActive); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, hydrogenStored, isActive); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored, hydrogenStored, isActive); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, hydrogenStored, isActive); } @Override diff --git a/src/common/mekanism/common/TileEntitySolarGenerator.java b/src/common/mekanism/generators/common/TileEntitySolarGenerator.java similarity index 68% rename from src/common/mekanism/common/TileEntitySolarGenerator.java rename to src/common/mekanism/generators/common/TileEntitySolarGenerator.java index 6be7bcef9..a1a233026 100644 --- a/src/common/mekanism/common/TileEntitySolarGenerator.java +++ b/src/common/mekanism/generators/common/TileEntitySolarGenerator.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.generators.common; import ic2.api.ElectricItem; import ic2.api.IElectricItem; @@ -9,7 +9,7 @@ import universalelectricity.core.implement.IItemElectric; import com.google.common.io.ByteArrayDataInput; import dan200.computer.api.IComputerAccess; -import mekanism.api.IEnergizedItem; +import mekanism.common.PacketHandler; import net.minecraft.src.*; public class TileEntitySolarGenerator extends TileEntityGenerator @@ -22,8 +22,8 @@ public class TileEntitySolarGenerator extends TileEntityGenerator public TileEntitySolarGenerator() { - super("Solar Generator", 16000, 32); - GENERATION_RATE = 32; + super("Solar Generator", 16000, 8); + GENERATION_RATE = 8; inventory = new ItemStack[1]; } @@ -39,36 +39,19 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { super.onUpdate(); - if(inventory[0] != null && energyStored > 0) + if(inventory[0] != null && electricityStored > 0) { - if(inventory[0].getItem() instanceof IEnergizedItem) - { - IEnergizedItem item = (IEnergizedItem)inventory[0].getItem(); - int sendingEnergy = 0; - - if(item.getRate() <= energyStored) - { - sendingEnergy = item.getRate(); - } - else if(item.getRate() > energyStored) - { - sendingEnergy = energyStored; - } - - int rejects = item.charge(inventory[0], sendingEnergy); - setEnergy(energyStored - (sendingEnergy - rejects)); - } - else if(inventory[0].getItem() instanceof IItemElectric) + if(inventory[0].getItem() instanceof IItemElectric) { IItemElectric electricItem = (IItemElectric) inventory[0].getItem(); - double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), (energyStored*UniversalElectricity.IC2_RATIO)); + double ampsToGive = Math.min(ElectricInfo.getAmps(electricItem.getMaxJoules() * 0.005, getVoltage()), electricityStored); double joules = electricItem.onReceive(ampsToGive, getVoltage(), inventory[0]); - setJoules((energyStored*UniversalElectricity.IC2_RATIO) - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); + setJoules(electricityStored - (ElectricInfo.getJoules(ampsToGive, getVoltage(), 1) - joules)); } else if(inventory[0].getItem() instanceof IElectricItem) { - int sent = ElectricItem.charge(inventory[0], energyStored, 3, false, false); - setEnergy(energyStored - sent); + double sent = ElectricItem.charge(inventory[0], (int)(electricityStored*UniversalElectricity.TO_IC2_RATIO), 3, false, false)*UniversalElectricity.IC2_RATIO; + setJoules(electricityStored - sent); } } @@ -85,14 +68,14 @@ public class TileEntitySolarGenerator extends TileEntityGenerator if(canOperate()) { - setEnergy(energyStored + getEnvironmentBoost()); + setJoules(electricityStored + getEnvironmentBoost()); } } @Override public boolean canOperate() { - return energyStored < MAX_ENERGY && seesSun; + return electricityStored < MAX_ELECTRICITY && seesSun; } @Override @@ -113,13 +96,13 @@ public class TileEntitySolarGenerator extends TileEntityGenerator switch(method) { case 0: - return new Object[] {energyStored}; + return new Object[] {electricityStored}; case 1: return new Object[] {output}; case 2: - return new Object[] {MAX_ENERGY}; + return new Object[] {MAX_ELECTRICITY}; case 3: - return new Object[] {(MAX_ENERGY-energyStored)}; + return new Object[] {(MAX_ELECTRICITY-electricityStored)}; case 4: return new Object[] {seesSun}; default: @@ -133,7 +116,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { try { facing = dataStream.readInt(); - energyStored = dataStream.readInt(); + electricityStored = dataStream.readDouble(); isActive = dataStream.readBoolean(); seesSun = dataStream.readBoolean(); worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); @@ -147,12 +130,12 @@ public class TileEntitySolarGenerator extends TileEntityGenerator @Override public void sendPacket() { - PacketHandler.sendTileEntityPacketToClients(this, 0, facing, energyStored, isActive, seesSun); + PacketHandler.sendTileEntityPacketToClients(this, 0, facing, electricityStored, isActive, seesSun); } @Override public void sendPacketWithRange() { - PacketHandler.sendTileEntityPacketToClients(this, 50, facing, energyStored, isActive, seesSun); + PacketHandler.sendTileEntityPacketToClients(this, 50, facing, electricityStored, isActive, seesSun); } } diff --git a/src/common/mekanism/common/EntityKnife.java b/src/common/mekanism/tools/common/EntityKnife.java similarity index 97% rename from src/common/mekanism/common/EntityKnife.java rename to src/common/mekanism/tools/common/EntityKnife.java index dbde2d176..9addb3f25 100644 --- a/src/common/mekanism/common/EntityKnife.java +++ b/src/common/mekanism/tools/common/EntityKnife.java @@ -1,6 +1,9 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.Random; + +import mekanism.common.DamageSourceMekanism; +import mekanism.common.EntityProjectile; import net.minecraft.src.*; public class EntityKnife extends EntityProjectile diff --git a/src/common/mekanism/common/ItemMekanismArmor.java b/src/common/mekanism/tools/common/ItemMekanismArmor.java similarity index 82% rename from src/common/mekanism/common/ItemMekanismArmor.java rename to src/common/mekanism/tools/common/ItemMekanismArmor.java index ce84a2a24..8b232cc0f 100644 --- a/src/common/mekanism/common/ItemMekanismArmor.java +++ b/src/common/mekanism/tools/common/ItemMekanismArmor.java @@ -1,7 +1,8 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.List; +import mekanism.common.Mekanism; import net.minecraft.src.*; public class ItemMekanismArmor extends ItemArmor @@ -21,6 +22,6 @@ public class ItemMekanismArmor extends ItemArmor @Override public String getTextureFile() { - return "/resources/mekanism/textures/items.png"; + return "/resources/mekanism/textures/tools/items.png"; } } diff --git a/src/common/mekanism/common/ItemMekanismAxe.java b/src/common/mekanism/tools/common/ItemMekanismAxe.java similarity index 97% rename from src/common/mekanism/common/ItemMekanismAxe.java rename to src/common/mekanism/tools/common/ItemMekanismAxe.java index a9fef8a80..54813b168 100644 --- a/src/common/mekanism/common/ItemMekanismAxe.java +++ b/src/common/mekanism/tools/common/ItemMekanismAxe.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.tools.common; import net.minecraft.src.Block; import net.minecraft.src.EnumToolMaterial; diff --git a/src/common/mekanism/common/ItemMekanismHoe.java b/src/common/mekanism/tools/common/ItemMekanismHoe.java similarity index 86% rename from src/common/mekanism/common/ItemMekanismHoe.java rename to src/common/mekanism/tools/common/ItemMekanismHoe.java index 0cffb55e3..0d037f678 100644 --- a/src/common/mekanism/common/ItemMekanismHoe.java +++ b/src/common/mekanism/tools/common/ItemMekanismHoe.java @@ -1,10 +1,11 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.List; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; +import mekanism.common.ItemMekanism; import net.minecraft.src.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; @@ -23,10 +24,7 @@ public class ItemMekanismHoe extends ItemMekanism setCreativeTab(CreativeTabs.tabTools); } - /** - * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ + @Override public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) @@ -74,17 +72,15 @@ public class ItemMekanismHoe extends ItemMekanism } @SideOnly(Side.CLIENT) - - /** - * Returns True is the item is renderer in full 3D when hold. - */ + @Override public boolean isFull3D() { return true; } - - public String func_77842_f() + + @Override + public String getTextureFile() { - return theToolMaterial.toString(); + return "/resources/mekanism/textures/tools/items.png"; } } diff --git a/src/common/mekanism/common/ItemMekanismKnife.java b/src/common/mekanism/tools/common/ItemMekanismKnife.java similarity index 92% rename from src/common/mekanism/common/ItemMekanismKnife.java rename to src/common/mekanism/tools/common/ItemMekanismKnife.java index 3896d6c2d..3154a30f2 100644 --- a/src/common/mekanism/common/ItemMekanismKnife.java +++ b/src/common/mekanism/tools/common/ItemMekanismKnife.java @@ -1,6 +1,9 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.Random; + +import mekanism.common.ItemMekanism; +import mekanism.common.Mekanism; import net.minecraft.src.*; public class ItemMekanismKnife extends ItemMekanism @@ -103,4 +106,9 @@ public class ItemMekanismKnife extends ItemMekanism itemstack.damageItem(entityDamage, entityliving1); return true; } + + public String getTextureFile() + { + return "/resources/mekanism/textures/tools/items.png"; + } } diff --git a/src/common/mekanism/common/ItemMekanismPaxel.java b/src/common/mekanism/tools/common/ItemMekanismPaxel.java similarity index 98% rename from src/common/mekanism/common/ItemMekanismPaxel.java rename to src/common/mekanism/tools/common/ItemMekanismPaxel.java index f57c824d3..670554cc1 100644 --- a/src/common/mekanism/common/ItemMekanismPaxel.java +++ b/src/common/mekanism/tools/common/ItemMekanismPaxel.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.tools.common; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; diff --git a/src/common/mekanism/common/ItemMekanismPickaxe.java b/src/common/mekanism/tools/common/ItemMekanismPickaxe.java similarity index 98% rename from src/common/mekanism/common/ItemMekanismPickaxe.java rename to src/common/mekanism/tools/common/ItemMekanismPickaxe.java index 6da452768..2fec34713 100644 --- a/src/common/mekanism/common/ItemMekanismPickaxe.java +++ b/src/common/mekanism/tools/common/ItemMekanismPickaxe.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.tools.common; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; diff --git a/src/common/mekanism/common/ItemMekanismSpade.java b/src/common/mekanism/tools/common/ItemMekanismSpade.java similarity index 96% rename from src/common/mekanism/common/ItemMekanismSpade.java rename to src/common/mekanism/tools/common/ItemMekanismSpade.java index 16948e2c1..34e44ce3c 100644 --- a/src/common/mekanism/common/ItemMekanismSpade.java +++ b/src/common/mekanism/tools/common/ItemMekanismSpade.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.tools.common; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; diff --git a/src/common/mekanism/common/ItemMekanismSword.java b/src/common/mekanism/tools/common/ItemMekanismSword.java similarity index 85% rename from src/common/mekanism/common/ItemMekanismSword.java rename to src/common/mekanism/tools/common/ItemMekanismSword.java index c1a02c853..b3bbf6a80 100644 --- a/src/common/mekanism/common/ItemMekanismSword.java +++ b/src/common/mekanism/tools/common/ItemMekanismSword.java @@ -1,7 +1,8 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.List; +import mekanism.common.ItemMekanism; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Entity; @@ -59,46 +60,46 @@ public class ItemMekanismSword extends ItemMekanism return weaponDamage; } - /** - * Returns True is the item is renderer in full 3D when hold. - */ + @Override public boolean isFull3D() { return true; } + @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } + @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 0x11940; } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ + + @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); return par1ItemStack; } - /** - * Returns if the item (tool) can harvest results from the block type. - */ + @Override public boolean canHarvestBlock(Block par1Block) { return par1Block.blockID == Block.web.blockID; } - /** - * Return the enchantability factor of the item, most of the time is based on material. - */ + @Override public int getItemEnchantability() { return toolMaterial.getEnchantability(); } + + @Override + public String getTextureFile() + { + return "/resources/mekanism/textures/tools/items.png"; + } } diff --git a/src/common/mekanism/common/ItemMekanismTool.java b/src/common/mekanism/tools/common/ItemMekanismTool.java similarity index 87% rename from src/common/mekanism/common/ItemMekanismTool.java rename to src/common/mekanism/tools/common/ItemMekanismTool.java index db0861b57..8f0887bba 100644 --- a/src/common/mekanism/common/ItemMekanismTool.java +++ b/src/common/mekanism/tools/common/ItemMekanismTool.java @@ -1,7 +1,8 @@ -package mekanism.common; +package mekanism.tools.common; import java.util.List; +import mekanism.common.Mekanism; import net.minecraft.src.Block; import net.minecraft.src.Entity; import net.minecraft.src.EntityLiving; @@ -28,6 +29,6 @@ public class ItemMekanismTool extends ItemTool @Override public String getTextureFile() { - return "/resources/mekanism/textures/items.png"; + return "/resources/mekanism/textures/tools/items.png"; } } diff --git a/src/common/mekanism/tools/common/MekanismTools.java b/src/common/mekanism/tools/common/MekanismTools.java new file mode 100644 index 000000000..2504cb39f --- /dev/null +++ b/src/common/mekanism/tools/common/MekanismTools.java @@ -0,0 +1,653 @@ +package mekanism.tools.common; + +import java.util.Random; + +import net.minecraft.src.*; +import net.minecraftforge.common.EnumHelper; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent; +import net.minecraftforge.oredict.ShapedOreRecipe; +import mekanism.common.Mekanism; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.Mod.Init; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.network.NetworkMod; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; + +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.0.0", dependencies = "required-after:Mekanism") +@NetworkMod(clientSideRequired = true, serverSideRequired = false) +public class MekanismTools +{ + @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") + public static ToolsCommonProxy proxy; + + @Instance("MekanismTools") + public static MekanismTools instance; + + //Enums: Tools + public static EnumToolMaterial toolOBSIDIAN = EnumHelper.addToolMaterial("OBSIDIAN", 3, 2500, 20F, 10, 50); + public static EnumToolMaterial toolOBSIDIAN2 = EnumHelper.addToolMaterial("OBSIDIAN2", 3, 3000, 25F, 10, 100); + public static EnumToolMaterial toolLAZULI = EnumHelper.addToolMaterial("LAZULI", 2, 200, 5.0F, 0, 22); + public static EnumToolMaterial toolLAZULI2 = EnumHelper.addToolMaterial("LAZULI2", 2, 250, 6.0F, 4, 50); + public static EnumToolMaterial toolPLATINUM = EnumHelper.addToolMaterial("PLATINUM", 2, 500, 10F, 4, 30); + public static EnumToolMaterial toolPLATINUM2 = EnumHelper.addToolMaterial("PLATINUM2", 3, 700, 12F, 5, 40); + public static EnumToolMaterial toolREDSTONE = EnumHelper.addToolMaterial("REDSTONE", 2, 250, 10F, 6, 50); + public static EnumToolMaterial toolREDSTONE2 = EnumHelper.addToolMaterial("REDSTONE2", 2, 400, 12F, 6, 60); + public static EnumToolMaterial toolGLOWSTONE = EnumHelper.addToolMaterial("GLOWSTONE", 2, 300, 14, 5, 80); + public static EnumToolMaterial toolGLOWSTONE2 = EnumHelper.addToolMaterial("GLOWSTONE2", 2, 450, 18, 5, 100); + + //Enums: Armor + public static EnumArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN", 50, new int[]{5, 12, 8, 5}, 50); + public static EnumArmorMaterial armorLAZULI = EnumHelper.addArmorMaterial("LAZULI", 13, new int[]{2, 5, 4, 2}, 50); + public static EnumArmorMaterial armorPLATINUM = EnumHelper.addArmorMaterial("PLATINUM", 30, new int[]{4, 10, 7, 4}, 50); + public static EnumArmorMaterial armorREDSTONE = EnumHelper.addArmorMaterial("REDSTONE", 16, new int[]{2, 7, 5, 3}, 50); + public static EnumArmorMaterial armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE", 18, new int[]{3, 7, 6, 3}, 50); + + //Base Items + public static Item WoodPaxel; + public static Item StonePaxel; + public static Item IronPaxel; + public static Item DiamondPaxel; + public static Item GoldPaxel; + public static Item WoodKnife; + public static Item StoneKnife; + public static Item IronKnife; + public static Item DiamondKnife; + public static Item GoldKnife; + + //Glowstone Items + public static Item GlowstonePaxel; + public static Item GlowstonePickaxe; + public static Item GlowstoneAxe; + public static Item GlowstoneSpade; + public static Item GlowstoneHoe; + public static Item GlowstoneSword; + public static Item GlowstoneHelmet; + public static Item GlowstoneBody; + public static Item GlowstoneLegs; + public static Item GlowstoneBoots; + public static Item GlowstoneKnife; + + //Redstone Items + public static Item RedstonePaxel; + public static Item RedstonePickaxe; + public static Item RedstoneAxe; + public static Item RedstoneSpade; + public static Item RedstoneHoe; + public static Item RedstoneSword; + public static Item RedstoneHelmet; + public static Item RedstoneBody; + public static Item RedstoneLegs; + public static Item RedstoneBoots; + public static Item RedstoneKnife; + + //Platinum Items + public static Item PlatinumPaxel; + public static Item PlatinumPickaxe; + public static Item PlatinumAxe; + public static Item PlatinumSpade; + public static Item PlatinumHoe; + public static Item PlatinumSword; + public static Item PlatinumHelmet; + public static Item PlatinumBody; + public static Item PlatinumLegs; + public static Item PlatinumBoots; + public static Item PlatinumKnife; + + //Obsidian Items + public static Item ObsidianHelmet; + public static Item ObsidianBody; + public static Item ObsidianLegs; + public static Item ObsidianBoots; + public static Item ObsidianPaxel; + public static Item ObsidianPickaxe; + public static Item ObsidianAxe; + public static Item ObsidianSpade; + public static Item ObsidianHoe; + public static Item ObsidianSword; + public static Item ObsidianKnife; + + //Lazuli Items + public static Item LazuliPaxel; + public static Item LazuliPickaxe; + public static Item LazuliAxe; + public static Item LazuliSpade; + public static Item LazuliHoe; + public static Item LazuliSword; + public static Item LazuliHelmet; + public static Item LazuliBody; + public static Item LazuliLegs; + public static Item LazuliBoots; + public static Item LazuliKnife; + + @Init + public void init(FMLInitializationEvent event) + { + //Register this class to the event bus for special mob spawning (mobs with Mekanism armor/tools) + MinecraftForge.EVENT_BUS.register(this); + + //Load the proxy + proxy.registerRenderInformation(); + + //Load this module + addItems(); + addTextures(); + addNames(); + addRecipes(); + addEntities(); + + //Finalization + Mekanism.logger.info("[MekanismTools] Loaded module."); + } + + public void addRecipes() + { + //Crafting Recipes + //Base + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(WoodPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeWood, Character.valueOf('Y'), Item.pickaxeWood, Character.valueOf('Z'), Item.shovelWood, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(StonePaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeStone, Character.valueOf('Y'), Item.pickaxeStone, Character.valueOf('Z'), Item.shovelStone, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(IronPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeSteel, Character.valueOf('Y'), Item.pickaxeSteel, Character.valueOf('Z'), Item.shovelSteel, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(DiamondPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeDiamond, Character.valueOf('Y'), Item.pickaxeDiamond, Character.valueOf('Z'), Item.shovelDiamond, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GoldPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), Item.axeGold, Character.valueOf('Y'), Item.pickaxeGold, Character.valueOf('Z'), Item.shovelGold, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(WoodKnife), new Object[] { + " ^", "I ", Character.valueOf('^'), Block.planks, Character.valueOf('I'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(StoneKnife), new Object[] { + " ^", "I ", Character.valueOf('^'), Block.cobblestone, Character.valueOf('I'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(IronKnife), new Object[] { + " ^", "I ", Character.valueOf('^'), Item.ingotIron, Character.valueOf('I'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(DiamondKnife), new Object[] { + " ^", "I ", Character.valueOf('^'), Item.diamond, Character.valueOf('I'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GoldKnife), new Object[] { + " ^", "I ", Character.valueOf('^'), Item.ingotGold, Character.valueOf('I'), Item.stick + })); + + //Obsidian + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianHelmet, 1), new Object[] { + "***", "* *", Character.valueOf('*'), "ingotObsidian" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianBody, 1), new Object[] { + "* *", "***", "***", Character.valueOf('*'), "ingotObsidian" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianLegs, 1), new Object[] { + "***", "* *", "* *", Character.valueOf('*'), "ingotObsidian" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianBoots, 1), new Object[] { + "* *", "* *", Character.valueOf('*'), "ingotObsidian" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), ObsidianAxe, Character.valueOf('Y'), ObsidianPickaxe, Character.valueOf('Z'), ObsidianSpade, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianPickaxe, 1), new Object[] { + "XXX", " T ", " T ", Character.valueOf('X'), "ingotObsidian", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianAxe, 1), new Object[] { + "XX", "XT", " T", Character.valueOf('X'), "ingotObsidian", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianSpade, 1), new Object[] { + "X", "T", "T", Character.valueOf('X'), "ingotObsidian", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianHoe, 1), new Object[] { + "XX", " T", " T", Character.valueOf('X'), "ingotObsidian", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianSword, 1), new Object[] { + "X", "X", "T", Character.valueOf('X'), "ingotObsidian", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ObsidianKnife, 1), new Object[] { + " ^", "I ", Character.valueOf('^'), "ingotObsidian", Character.valueOf('I'), Item.stick + })); + + //Glowstone + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstonePaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), GlowstoneAxe, Character.valueOf('Y'), GlowstonePickaxe, Character.valueOf('Z'), GlowstoneSpade, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstonePickaxe, 1), new Object[] { + "XXX", " T ", " T ", Character.valueOf('X'), "ingotGlowstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneAxe, 1), new Object[] { + "XX", "XT", " T", Character.valueOf('X'), "ingotGlowstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneSpade, 1), new Object[] { + "X", "T", "T", Character.valueOf('X'), "ingotGlowstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneHoe, 1), new Object[] { + "XX", " T", " T", Character.valueOf('X'), "ingotGlowstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneSword, 1), new Object[] { + "X", "X", "T", Character.valueOf('X'), "ingotGlowstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneHelmet, 1), new Object[] { + "***", "* *", Character.valueOf('*'), "ingotGlowstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneBody, 1), new Object[] { + "* *", "***", "***", Character.valueOf('*'), "ingotGlowstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneLegs, 1), new Object[] { + "***", "* *", "* *", Character.valueOf('*'), "ingotGlowstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneBoots, 1), new Object[] { + "* *", "* *", Character.valueOf('*'), "ingotGlowstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(GlowstoneKnife, 1), new Object[] { + " ^", "I ", Character.valueOf('^'), "ingotGlowstone", Character.valueOf('I'), Item.stick + })); + + //Lazuli + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliHelmet, 1), new Object[] { + "***", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliBody, 1), new Object[] { + "* *", "***", "***", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliLegs, 1), new Object[] { + "***", "* *", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliBoots, 1), new Object[] { + "* *", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4) + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), LazuliAxe, Character.valueOf('Y'), LazuliPickaxe, Character.valueOf('Z'), LazuliSpade, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliPickaxe, 1), new Object[] { + "XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliAxe, 1), new Object[] { + "XX", "XT", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliSpade, 1), new Object[] { + "X", "T", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliHoe, 1), new Object[] { + "XX", " T", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliSword, 1), new Object[] { + "X", "X", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(LazuliKnife, 1), new Object[] { + " ^", "I ", Character.valueOf('^'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('I'), Item.stick + })); + + //Platinum + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumPaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), PlatinumAxe, Character.valueOf('Y'), PlatinumPickaxe, Character.valueOf('Z'), PlatinumSpade, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumPickaxe, 1), new Object[] { + "XXX", " T ", " T ", Character.valueOf('X'), "ingotPlatinum", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumAxe, 1), new Object[] { + "XX", "XT", " T", Character.valueOf('X'), "ingotPlatinum", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumSpade, 1), new Object[] { + "X", "T", "T", Character.valueOf('X'), "ingotPlatinum", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumHoe, 1), new Object[] { + "XX", " T", " T", Character.valueOf('X'), "ingotPlatinum", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumSword, 1), new Object[] { + "X", "X", "T", Character.valueOf('X'), "ingotPlatinum", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumHelmet, 1), new Object[] { + "***", "* *", Character.valueOf('*'), "ingotPlatinum" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumBody, 1), new Object[] { + "* *", "***", "***", Character.valueOf('*'), "ingotPlatinum" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumLegs, 1), new Object[] { + "***", "* *", "* *", Character.valueOf('*'), "ingotPlatinum" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumBoots, 1), new Object[] { + "* *", "* *", Character.valueOf('*'), "ingotPlatinum" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(PlatinumKnife, 1), new Object[] { + " ^", "I ", Character.valueOf('^'), "ingotPlatinum", Character.valueOf('I'), Item.stick + })); + + //Redstone + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstonePaxel, 1), new Object[] { + "XYZ", " T ", " T ", Character.valueOf('X'), RedstoneAxe, Character.valueOf('Y'), RedstonePickaxe, Character.valueOf('Z'), RedstoneSpade, Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstonePickaxe, 1), new Object[] { + "XXX", " T ", " T ", Character.valueOf('X'), "ingotRedstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneAxe, 1), new Object[] { + "XX", "XT", " T", Character.valueOf('X'), "ingotRedstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneSpade, 1), new Object[] { + "X", "T", "T", Character.valueOf('X'), "ingotRedstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneHoe, 1), new Object[] { + "XX", " T", " T", Character.valueOf('X'), "ingotRedstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneSword, 1), new Object[] { + "X", "X", "T", Character.valueOf('X'), "ingotRedstone", Character.valueOf('T'), Item.stick + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneHelmet, 1), new Object[] { + "***", "* *", Character.valueOf('*'), "ingotRedstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneBody, 1), new Object[] { + "* *", "***", "***", Character.valueOf('*'), "ingotRedstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneLegs, 1), new Object[] { + "***", "* *", "* *", Character.valueOf('*'), "ingotRedstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneBoots, 1), new Object[] { + "* *", "* *", Character.valueOf('*'), "ingotRedstone" + })); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(RedstoneKnife, 1), new Object[] { + " ^", "I ", Character.valueOf('^'), "ingotRedstone", Character.valueOf('I'), Item.stick + })); + } + + public void addNames() + { + //Base + LanguageRegistry.addName(WoodPaxel, "Wood Paxel"); + LanguageRegistry.addName(StonePaxel, "Stone Paxel"); + LanguageRegistry.addName(IronPaxel, "Iron Paxel"); + LanguageRegistry.addName(DiamondPaxel, "Diamond Paxel"); + LanguageRegistry.addName(GoldPaxel, "Gold Paxel"); + LanguageRegistry.addName(WoodKnife, "Wood Knife"); + LanguageRegistry.addName(StoneKnife, "Stone Knife"); + LanguageRegistry.addName(IronKnife, "Iron Knife"); + LanguageRegistry.addName(DiamondKnife, "Diamond Knife"); + LanguageRegistry.addName(GoldKnife, "Gold Knife"); + + //Obsidian + LanguageRegistry.addName(ObsidianHelmet, "Obsidian Helmet"); + LanguageRegistry.addName(ObsidianBody, "Obsidian Chestplate"); + LanguageRegistry.addName(ObsidianLegs, "Obsidian Leggings"); + LanguageRegistry.addName(ObsidianBoots, "Obsidian Boots"); + LanguageRegistry.addName(ObsidianPaxel, "Obsidian Paxel"); + LanguageRegistry.addName(ObsidianPickaxe, "Obsidian Pickaxe"); + LanguageRegistry.addName(ObsidianAxe, "Obsidian Axe"); + LanguageRegistry.addName(ObsidianSpade, "Obsidian Shovel"); + LanguageRegistry.addName(ObsidianHoe, "Obsidian Hoe"); + LanguageRegistry.addName(ObsidianSword, "Obsidian Sword"); + LanguageRegistry.addName(ObsidianKnife, "Obsidian Knife"); + + //Lazuli + LanguageRegistry.addName(LazuliHelmet, "Lapis Lazuli Helmet"); + LanguageRegistry.addName(LazuliBody, "Lapis Lazuli Chestplate"); + LanguageRegistry.addName(LazuliLegs, "Lapis Lazuli Leggings"); + LanguageRegistry.addName(LazuliBoots, "Lapis Lazuli Boots"); + LanguageRegistry.addName(LazuliPaxel, "Lapis Lazuli Paxel"); + LanguageRegistry.addName(LazuliPickaxe, "Lapis Lazuli Pickaxe"); + LanguageRegistry.addName(LazuliAxe, "Lapis Lazuli Axe"); + LanguageRegistry.addName(LazuliSpade, "Lapis Lazuli Shovel"); + LanguageRegistry.addName(LazuliHoe, "Lapis Lazuli Hoe"); + LanguageRegistry.addName(LazuliSword, "Lapis Lazuli Sword"); + LanguageRegistry.addName(LazuliKnife, "Lazuli Knife"); + + //Platinum + LanguageRegistry.addName(PlatinumHelmet, "Platinum Helmet"); + LanguageRegistry.addName(PlatinumBody, "Platinum Chestplate"); + LanguageRegistry.addName(PlatinumLegs, "Platinum Leggings"); + LanguageRegistry.addName(PlatinumBoots, "Platinum Boots"); + LanguageRegistry.addName(PlatinumPaxel, "Platinum Paxel"); + LanguageRegistry.addName(PlatinumPickaxe, "Platinum Pickaxe"); + LanguageRegistry.addName(PlatinumAxe, "Platinum Axe"); + LanguageRegistry.addName(PlatinumSpade, "Platinum Shovel"); + LanguageRegistry.addName(PlatinumHoe, "Platinum Hoe"); + LanguageRegistry.addName(PlatinumSword, "Platinum Sword"); + LanguageRegistry.addName(PlatinumKnife, "Platinum Knife"); + + //Redstone + LanguageRegistry.addName(RedstoneHelmet, "Redstone Helmet"); + LanguageRegistry.addName(RedstoneBody, "Redstone Chestplate"); + LanguageRegistry.addName(RedstoneLegs, "Redstone Leggings"); + LanguageRegistry.addName(RedstoneBoots, "Redstone Boots"); + LanguageRegistry.addName(RedstonePaxel, "Redstone Paxel"); + LanguageRegistry.addName(RedstonePickaxe, "Redstone Pickaxe"); + LanguageRegistry.addName(RedstoneAxe, "Redstone Axe"); + LanguageRegistry.addName(RedstoneSpade, "Redstone Shovel"); + LanguageRegistry.addName(RedstoneHoe, "Redstone Hoe"); + LanguageRegistry.addName(RedstoneSword, "Redstone Sword"); + LanguageRegistry.addName(RedstoneKnife, "Redstone Knife"); + + //Glowstone + LanguageRegistry.addName(GlowstonePaxel, "Glowstone Paxel"); + LanguageRegistry.addName(GlowstonePickaxe, "Glowstone Pickaxe"); + LanguageRegistry.addName(GlowstoneAxe, "Glowstone Axe"); + LanguageRegistry.addName(GlowstoneSpade, "Glowstone Shovel"); + LanguageRegistry.addName(GlowstoneHoe, "Glowstone Hoe"); + LanguageRegistry.addName(GlowstoneSword, "Glowstone Sword"); + LanguageRegistry.addName(GlowstoneHelmet, "Glowstone Helmet"); + LanguageRegistry.addName(GlowstoneBody, "Glowstone Chestplate"); + LanguageRegistry.addName(GlowstoneLegs, "Glowstone Leggings"); + LanguageRegistry.addName(GlowstoneBoots, "Glowstone Boots"); + LanguageRegistry.addName(GlowstoneKnife, "Glowstone Knife"); + } + + public void addTextures() + { + //Base + WoodPaxel.setIconIndex(150); + StonePaxel.setIconIndex(151); + IronPaxel.setIconIndex(152); + DiamondPaxel.setIconIndex(153); + GoldPaxel.setIconIndex(154); + WoodKnife.setIconIndex(214); + StoneKnife.setIconIndex(215); + IronKnife.setIconIndex(216); + DiamondKnife.setIconIndex(217); + GoldKnife.setIconIndex(218); + + //Glowstone + GlowstoneHelmet.setIconIndex(4); + GlowstoneBody.setIconIndex(20); + GlowstoneLegs.setIconIndex(36); + GlowstoneBoots.setIconIndex(52); + GlowstonePaxel.setIconIndex(148); + GlowstonePickaxe.setIconIndex(68); + GlowstoneAxe.setIconIndex(84); + GlowstoneSpade.setIconIndex(100); + GlowstoneHoe.setIconIndex(116); + GlowstoneSword.setIconIndex(132); + GlowstoneKnife.setIconIndex(212); + + //Redstone + RedstoneHelmet.setIconIndex(3); + RedstoneBody.setIconIndex(19); + RedstoneLegs.setIconIndex(35); + RedstoneBoots.setIconIndex(51); + RedstonePaxel.setIconIndex(147); + RedstonePickaxe.setIconIndex(67); + RedstoneAxe.setIconIndex(83); + RedstoneSpade.setIconIndex(99); + RedstoneHoe.setIconIndex(115); + RedstoneSword.setIconIndex(131); + RedstoneKnife.setIconIndex(211); + + //Platinum + PlatinumHelmet.setIconIndex(2); + PlatinumBody.setIconIndex(18); + PlatinumLegs.setIconIndex(34); + PlatinumBoots.setIconIndex(50); + PlatinumPaxel.setIconIndex(146); + PlatinumPickaxe.setIconIndex(66); + PlatinumAxe.setIconIndex(82); + PlatinumSpade.setIconIndex(98); + PlatinumHoe.setIconIndex(114); + PlatinumSword.setIconIndex(130); + PlatinumKnife.setIconIndex(210); + + //Obsidian + ObsidianHelmet.setIconIndex(1); + ObsidianBody.setIconIndex(17); + ObsidianLegs.setIconIndex(33); + ObsidianBoots.setIconIndex(49); + ObsidianPaxel.setIconIndex(145); + ObsidianPickaxe.setIconIndex(65); + ObsidianAxe.setIconIndex(81); + ObsidianSpade.setIconIndex(97); + ObsidianHoe.setIconIndex(113); + ObsidianSword.setIconIndex(129); + ObsidianKnife.setIconIndex(209); + + //Lazuli + LazuliPaxel.setIconIndex(144); + LazuliPickaxe.setIconIndex(64); + LazuliAxe.setIconIndex(80); + LazuliSpade.setIconIndex(96); + LazuliHoe.setIconIndex(112); + LazuliSword.setIconIndex(128); + LazuliHelmet.setIconIndex(0); + LazuliBody.setIconIndex(16); + LazuliLegs.setIconIndex(32); + LazuliBoots.setIconIndex(48); + LazuliKnife.setIconIndex(208); + } + + public void addItems() + { + //Redstone + RedstoneHelmet = (new ItemMekanismArmor(11235, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 0)).setItemName("RedstoneHelmet"); + RedstoneBody = (new ItemMekanismArmor(11236, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 1)).setItemName("RedstoneBody"); + RedstoneLegs = (new ItemMekanismArmor(11237, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 2)).setItemName("RedstoneLegs"); + RedstoneBoots = (new ItemMekanismArmor(11238, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 3)).setItemName("RedstoneBoots"); + RedstonePaxel = new ItemMekanismPaxel(11239, toolREDSTONE2).setItemName("RedstonePaxel"); + RedstonePickaxe = new ItemMekanismPickaxe(11240, toolREDSTONE).setItemName("RedstonePickaxe"); + RedstoneAxe = new ItemMekanismAxe(11241, toolREDSTONE).setItemName("RedstoneAxe"); + RedstoneSpade = new ItemMekanismSpade(11242, toolREDSTONE).setItemName("RedstoneSpade"); + RedstoneHoe = new ItemMekanismHoe(11243, toolREDSTONE).setItemName("RedstoneHoe"); + RedstoneSword = new ItemMekanismSword(11244, toolREDSTONE).setItemName("RedstoneSword"); + + //Platinum + PlatinumHelmet = (new ItemMekanismArmor(11245, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 0)).setItemName("PlatinumHelmet"); + PlatinumBody = (new ItemMekanismArmor(11246, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 1)).setItemName("PlatinumBody"); + PlatinumLegs = (new ItemMekanismArmor(11247, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 2)).setItemName("PlatinumLegs"); + PlatinumBoots = (new ItemMekanismArmor(11248, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 3)).setItemName("PlatinumBoots"); + PlatinumPaxel = new ItemMekanismPaxel(11249, toolPLATINUM2).setItemName("PlatinumPaxel"); + PlatinumPickaxe = new ItemMekanismPickaxe(11250, toolPLATINUM).setItemName("PlatinumPickaxe"); + PlatinumAxe = new ItemMekanismAxe(11251, toolPLATINUM).setItemName("PlatinumAxe"); + PlatinumSpade = new ItemMekanismSpade(11252, toolPLATINUM).setItemName("PlatinumSpade"); + PlatinumHoe = new ItemMekanismHoe(11253, toolPLATINUM).setItemName("PlatinumHoe"); + PlatinumSword = new ItemMekanismSword(11254, toolPLATINUM).setItemName("PlatinumSword"); + + //Obsidian + ObsidianHelmet = (new ItemMekanismArmor(11255, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 0)).setItemName("ObsidianHelmet"); + ObsidianBody = (new ItemMekanismArmor(11256, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 1)).setItemName("ObsidianBody"); + ObsidianLegs = (new ItemMekanismArmor(11257, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 2)).setItemName("ObsidianLegs"); + ObsidianBoots = (new ItemMekanismArmor(11258, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 3)).setItemName("ObsidianBoots"); + ObsidianPaxel = new ItemMekanismPaxel(11259, toolOBSIDIAN2).setItemName("ObsidianPaxel"); + ObsidianPickaxe = new ItemMekanismPickaxe(11260, toolOBSIDIAN).setItemName("ObsidianPickaxe"); + ObsidianAxe = new ItemMekanismAxe(11261, toolOBSIDIAN).setItemName("ObsidianAxe"); + ObsidianSpade = new ItemMekanismSpade(11262, toolOBSIDIAN).setItemName("ObsidianSpade"); + ObsidianHoe = new ItemMekanismHoe(11263, toolOBSIDIAN).setItemName("ObsidianHoe"); + ObsidianSword = new ItemMekanismSword(11264, toolOBSIDIAN).setItemName("ObsidianSword"); + + //Lazuli + LazuliPaxel = new ItemMekanismPaxel(11265, toolLAZULI2).setItemName("LazuliPaxel"); + LazuliPickaxe = new ItemMekanismPickaxe(11266, toolLAZULI).setItemName("LazuliPickaxe"); + LazuliAxe = new ItemMekanismAxe(11267, toolLAZULI).setItemName("LazuliAxe"); + LazuliSpade = new ItemMekanismSpade(11268, toolLAZULI).setItemName("LazuliSpade"); + LazuliHoe = new ItemMekanismHoe(11269, toolLAZULI).setItemName("LazuliHoe"); + LazuliSword = new ItemMekanismSword(11270, toolLAZULI).setItemName("LazuliSword"); + LazuliHelmet = (new ItemMekanismArmor(11271, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 0)).setItemName("LazuliHelmet"); + LazuliBody = (new ItemMekanismArmor(11272, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 1)).setItemName("LazuliBody"); + LazuliLegs = (new ItemMekanismArmor(11273, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 2)).setItemName("LazuliLegs"); + LazuliBoots = (new ItemMekanismArmor(11274, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 3)).setItemName("LazuliBoots"); + + //Glowstone + GlowstonePaxel = new ItemMekanismPaxel(11295, toolGLOWSTONE2).setItemName("GlowstonePaxel"); + GlowstonePickaxe = new ItemMekanismPickaxe(11296, toolGLOWSTONE).setItemName("GlowstonePickaxe"); + GlowstoneAxe = new ItemMekanismAxe(11297, toolGLOWSTONE).setItemName("GlowstoneAxe"); + GlowstoneSpade = new ItemMekanismSpade(11298, toolGLOWSTONE).setItemName("GlowstoneSpade"); + GlowstoneHoe = new ItemMekanismHoe(11299, toolGLOWSTONE).setItemName("GlowstoneHoe"); + GlowstoneSword = new ItemMekanismSword(11300, toolGLOWSTONE).setItemName("GlowstoneSword"); + GlowstoneHelmet = new ItemMekanismArmor(11301, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 0).setItemName("GlowstoneHelmet"); + GlowstoneBody = new ItemMekanismArmor(11302, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 1).setItemName("GlowstoneBody"); + GlowstoneLegs = new ItemMekanismArmor(11303, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 2).setItemName("GlowstoneLegs"); + GlowstoneBoots = new ItemMekanismArmor(11304, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 3).setItemName("GlowstoneBoots"); + + //Base Paxels + WoodPaxel = new ItemMekanismPaxel(11279, EnumToolMaterial.WOOD).setItemName("WoodPaxel"); + StonePaxel = new ItemMekanismPaxel(11280, EnumToolMaterial.STONE).setItemName("StonePaxel"); + IronPaxel = new ItemMekanismPaxel(11281, EnumToolMaterial.IRON).setItemName("IronPaxel"); + DiamondPaxel = new ItemMekanismPaxel(11282, EnumToolMaterial.EMERALD).setItemName("DiamondPaxel"); + GoldPaxel = new ItemMekanismPaxel(11283, EnumToolMaterial.GOLD).setItemName("GoldPaxel"); + + //Knives + WoodKnife = new ItemMekanismKnife(11284, EnumToolMaterial.WOOD).setItemName("WoodKnife"); + StoneKnife = new ItemMekanismKnife(11285, EnumToolMaterial.STONE).setItemName("StoneKnife"); + IronKnife = new ItemMekanismKnife(11286, EnumToolMaterial.IRON).setItemName("IronKnife"); + DiamondKnife = new ItemMekanismKnife(11287, EnumToolMaterial.EMERALD).setItemName("DiamondKnife"); + GoldKnife = new ItemMekanismKnife(11288, EnumToolMaterial.GOLD).setItemName("GoldKnife"); + ObsidianKnife = new ItemMekanismKnife(11289, toolOBSIDIAN).setItemName("ObsidianKnife"); + LazuliKnife = new ItemMekanismKnife(11290, toolLAZULI).setItemName("LazuliKnife"); + PlatinumKnife = new ItemMekanismKnife(11291, toolPLATINUM).setItemName("PlatinumKnife"); + RedstoneKnife = new ItemMekanismKnife(11292, toolREDSTONE).setItemName("RedstoneKnife"); + GlowstoneKnife = new ItemMekanismKnife(11305, toolGLOWSTONE).setItemName("GlowstoneKnife"); + } + + public void addEntities() + { + EntityRegistry.registerModEntity(EntityKnife.class, "Knife", 52, this, 40, 5, true); + EntityRegistry.registerGlobalEntityID(EntityKnife.class, "Knife", EntityRegistry.findGlobalUniqueEntityId()); + } + + @ForgeSubscribe + public void onLivingSpecialSpawn(LivingSpecialSpawnEvent event) + { + Random random = new Random(); + + int chance = random.nextInt(100); + int secondChance = random.nextInt(4); + + if(chance < 5) + { + if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton) + { + if(secondChance == 0) + { + if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(GlowstoneSword)); + event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(GlowstoneHelmet)); + event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(GlowstoneBody)); + event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(GlowstoneLegs)); + event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(GlowstoneBoots)); + } + else if(secondChance == 1) + { + if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(LazuliSword)); + event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(LazuliHelmet)); + event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(LazuliBody)); + event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(LazuliLegs)); + event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(LazuliBoots)); + } + else if(secondChance == 2) + { + if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(RedstoneSword)); + event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(RedstoneHelmet)); + event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(RedstoneBody)); + event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(RedstoneLegs)); + event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(RedstoneBoots)); + } + else if(secondChance == 3) + { + if(event.entityLiving instanceof EntityZombie) event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(PlatinumSword)); + event.entityLiving.setCurrentItemOrArmor(1, new ItemStack(PlatinumHelmet)); + event.entityLiving.setCurrentItemOrArmor(2, new ItemStack(PlatinumBody)); + event.entityLiving.setCurrentItemOrArmor(3, new ItemStack(PlatinumLegs)); + event.entityLiving.setCurrentItemOrArmor(4, new ItemStack(PlatinumBoots)); + } + } + } + } +} diff --git a/src/common/mekanism/tools/common/ToolsCommonProxy.java b/src/common/mekanism/tools/common/ToolsCommonProxy.java new file mode 100644 index 000000000..321614286 --- /dev/null +++ b/src/common/mekanism/tools/common/ToolsCommonProxy.java @@ -0,0 +1,31 @@ +package mekanism.tools.common; + +import net.minecraft.src.*; + +/** + * Common proxy for the Mekanism Tools module. + * @author AidanBrady + * + */ +public class ToolsCommonProxy +{ + /** + * Register and load client-only render information. + */ + public void registerRenderInformation() {} + + /** + * Gets the armor index number from ClientProxy. + * @param armor indicator + * @return armor index number + */ + public int getArmorIndex(String string) + { + return 0; + } + + /** + * Set and load the mod's common configuration properties. + */ + public void loadConfiguration() {} +} diff --git a/src/minecraft/mekanism/client/ClientProxy.java b/src/minecraft/mekanism/client/ClientProxy.java index e0bcd4bc6..dab566afd 100644 --- a/src/minecraft/mekanism/client/ClientProxy.java +++ b/src/minecraft/mekanism/client/ClientProxy.java @@ -15,26 +15,18 @@ import cpw.mods.fml.common.Side; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.registry.TickRegistry; import mekanism.common.CommonProxy; -import mekanism.common.EntityKnife; import mekanism.common.EntityObsidianTNT; import mekanism.common.Mekanism; import mekanism.common.MekanismUtils; import mekanism.common.TileEntityAdvancedElectricMachine; -import mekanism.common.TileEntityAdvancedSolarGenerator; -import mekanism.common.TileEntityBioGenerator; import mekanism.common.TileEntityCombiner; import mekanism.common.TileEntityControlPanel; import mekanism.common.TileEntityCrusher; import mekanism.common.TileEntityElectricMachine; -import mekanism.common.TileEntityElectrolyticSeparator; import mekanism.common.TileEntityEnrichmentChamber; import mekanism.common.TileEntityGasTank; -import mekanism.common.TileEntityGenerator; -import mekanism.common.TileEntityHeatGenerator; -import mekanism.common.TileEntityHydrogenGenerator; import mekanism.common.TileEntityPlatinumCompressor; import mekanism.common.TileEntityPowerUnit; -import mekanism.common.TileEntitySolarGenerator; import mekanism.common.TileEntityTheoreticalElementizer; import net.minecraft.client.Minecraft; import net.minecraft.src.*; @@ -53,13 +45,6 @@ public class ClientProxy extends CommonProxy return RenderingRegistry.addNewArmourRendererPrefix(string); } - @Override - public void registerSpecialTileEntities() - { - ClientRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator", new RenderAdvancedSolarGenerator(new ModelAdvancedSolarGenerator())); - ClientRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator", new RenderBioGenerator()); - } - @Override public void registerRenderInformation() { @@ -75,8 +60,6 @@ public class ClientProxy extends CommonProxy MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerFront.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerBack.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerSide.png"); - MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/HydrogenFront.png"); - MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/HydrogenSide.png"); //Register animated TextureFX try { @@ -85,18 +68,12 @@ public class ClientProxy extends CommonProxy TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+2)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerBack.png", Mekanism.ANIMATED_TEXTURE_INDEX+3)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+4)); - TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+5)); - TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+6)); } catch (IOException e) { System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage()); } //Register entity rendering handlers RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT()); - RenderingRegistry.registerEntityRenderingHandler(EntityKnife.class, new RenderKnife()); - - //Register block handler - RenderingRegistry.registerBlockHandler(new RenderHandler()); System.out.println("[Mekanism] Render initiative complete."); } @@ -141,18 +118,8 @@ public class ClientProxy extends CommonProxy case 8: return new GuiPowerUnit(player.inventory, (TileEntityPowerUnit)tileEntity); case 9: - return new GuiHeatGenerator(player.inventory, (TileEntityHeatGenerator)tileEntity); - case 10: - return new GuiSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity); - case 11: - return new GuiElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity); - case 12: - return new GuiHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity); - case 13: - return new GuiBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); - case 14: return new GuiControlPanel((TileEntityControlPanel)tileEntity, player, world); - case 15: + case 10: return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity); } return null; diff --git a/src/minecraft/mekanism/client/GuiPowerUnit.java b/src/minecraft/mekanism/client/GuiPowerUnit.java index aa65ba68a..f517564f9 100644 --- a/src/minecraft/mekanism/client/GuiPowerUnit.java +++ b/src/minecraft/mekanism/client/GuiPowerUnit.java @@ -2,6 +2,9 @@ package mekanism.client; import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; + import mekanism.common.ContainerPowerUnit; import mekanism.common.MekanismUtils; import mekanism.common.TileEntityPowerUnit; @@ -23,8 +26,8 @@ public class GuiPowerUnit extends GuiContainer @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - String capacityInfo = MekanismUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY); - String outputInfo = "Out: " + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.output) + "/t"; + String capacityInfo = ElectricInfo.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricInfo.getDisplayShort(tileEntity.MAX_ELECTRICITY, ElectricUnit.JOULES); + String outputInfo = "Out: " + tileEntity.output + "w"; fontRenderer.drawString(tileEntity.getInvName(), 43, 6, 0x404040); fontRenderer.drawString(capacityInfo, 45, 40, 0x404040); fontRenderer.drawString(outputInfo, 45, 49, 0x404040); @@ -41,7 +44,7 @@ public class GuiPowerUnit extends GuiContainer guiWidth = (width - xSize) / 2; guiHeight = (height - ySize) / 2; drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); - int scale = (int)(((double)tileEntity.energyStored / tileEntity.MAX_ENERGY) * 72); + int scale = (int)(((double)tileEntity.electricityStored / tileEntity.MAX_ELECTRICITY) * 72); drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 20); } } diff --git a/src/minecraft/mekanism/generators/client/GeneratorsClientProxy.java b/src/minecraft/mekanism/generators/client/GeneratorsClientProxy.java new file mode 100644 index 000000000..83afeb60d --- /dev/null +++ b/src/minecraft/mekanism/generators/client/GeneratorsClientProxy.java @@ -0,0 +1,77 @@ +package mekanism.generators.client; + +import java.io.IOException; + +import net.minecraft.src.*; + +import net.minecraftforge.client.MinecraftForgeClient; + +import cpw.mods.fml.client.TextureFXManager; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.Side; +import cpw.mods.fml.common.asm.SideOnly; + +import mekanism.client.TextureAnimatedFX; +import mekanism.common.Mekanism; +import mekanism.generators.common.*; + +public class GeneratorsClientProxy extends GeneratorsCommonProxy +{ + public static int RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public void registerSpecialTileEntities() + { + ClientRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator", new RenderAdvancedSolarGenerator(new ModelAdvancedSolarGenerator())); + ClientRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator", new RenderBioGenerator()); + } + + @Override + public void registerRenderInformation() + { + System.out.println("[MekanismGenerators] Beginning render initiative..."); + + //Preload block/item textures + MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/generators/items.png"); + MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/generators/terrain.png"); + + //Preload animated textures + MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/HydrogenFront.png"); + MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/HydrogenSide.png"); + + //Register animated TextureFX + try { + TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+5)); + TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+6)); + } catch (IOException e) { + System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage()); + } + + //Register block handler + RenderingRegistry.registerBlockHandler(new RenderHandler()); + + System.out.println("[MekanismGenerators] Render initiative complete."); + } + + @Override + public GuiScreen getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + + switch(ID) + { + case 0: + return new GuiHeatGenerator(player.inventory, (TileEntityHeatGenerator)tileEntity); + case 1: + return new GuiSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity); + case 2: + return new GuiElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator)tileEntity); + case 3: + return new GuiHydrogenGenerator(player.inventory, (TileEntityHydrogenGenerator)tileEntity); + case 4: + return new GuiBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); + } + return null; + } +} diff --git a/src/minecraft/mekanism/client/GuiBioGenerator.java b/src/minecraft/mekanism/generators/client/GuiBioGenerator.java similarity index 73% rename from src/minecraft/mekanism/client/GuiBioGenerator.java rename to src/minecraft/mekanism/generators/client/GuiBioGenerator.java index 4a924a6b2..5a7035d6c 100644 --- a/src/minecraft/mekanism/client/GuiBioGenerator.java +++ b/src/minecraft/mekanism/generators/client/GuiBioGenerator.java @@ -1,10 +1,13 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; -import mekanism.common.ContainerBioGenerator; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; + import mekanism.common.MekanismUtils; -import mekanism.common.TileEntityBioGenerator; +import mekanism.generators.common.ContainerBioGenerator; +import mekanism.generators.common.TileEntityBioGenerator; import net.minecraft.src.*; public class GuiBioGenerator extends GuiContainer @@ -25,9 +28,9 @@ public class GuiBioGenerator extends GuiContainer { fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040); fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY), 51, 26, 0x404040); + fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricInfo.getDisplayShort(tileEntity.MAX_ELECTRICITY, ElectricUnit.JOULES), 51, 26, 0x404040); fontRenderer.drawString("BioFuel: " + tileEntity.bioFuelSlot.liquidStored, 51, 35, 0x404040); - fontRenderer.drawString("Out: " + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.output), 51, 44, 0x404040); + fontRenderer.drawString("Out: " + tileEntity.output + "w", 51, 44, 0x404040); } @Override diff --git a/src/minecraft/mekanism/client/GuiElectrolyticSeparator.java b/src/minecraft/mekanism/generators/client/GuiElectrolyticSeparator.java similarity index 92% rename from src/minecraft/mekanism/client/GuiElectrolyticSeparator.java rename to src/minecraft/mekanism/generators/client/GuiElectrolyticSeparator.java index c786ff296..e12feff82 100644 --- a/src/minecraft/mekanism/client/GuiElectrolyticSeparator.java +++ b/src/minecraft/mekanism/generators/client/GuiElectrolyticSeparator.java @@ -1,13 +1,13 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; import mekanism.api.EnumGas; -import mekanism.common.ContainerElectrolyticSeparator; -import mekanism.common.ContainerHeatGenerator; import mekanism.common.MekanismUtils; import mekanism.common.PacketHandler; -import mekanism.common.TileEntityElectrolyticSeparator; +import mekanism.generators.common.ContainerElectrolyticSeparator; +import mekanism.generators.common.ContainerHeatGenerator; +import mekanism.generators.common.TileEntityElectrolyticSeparator; import net.minecraft.src.*; public class GuiElectrolyticSeparator extends GuiContainer diff --git a/src/minecraft/mekanism/client/GuiHeatGenerator.java b/src/minecraft/mekanism/generators/client/GuiHeatGenerator.java similarity index 73% rename from src/minecraft/mekanism/client/GuiHeatGenerator.java rename to src/minecraft/mekanism/generators/client/GuiHeatGenerator.java index 093b9355d..a6405f529 100644 --- a/src/minecraft/mekanism/client/GuiHeatGenerator.java +++ b/src/minecraft/mekanism/generators/client/GuiHeatGenerator.java @@ -1,10 +1,13 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; -import mekanism.common.ContainerHeatGenerator; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; + import mekanism.common.MekanismUtils; -import mekanism.common.TileEntityHeatGenerator; +import mekanism.generators.common.ContainerHeatGenerator; +import mekanism.generators.common.TileEntityHeatGenerator; import net.minecraft.src.*; public class GuiHeatGenerator extends GuiContainer @@ -25,9 +28,9 @@ public class GuiHeatGenerator extends GuiContainer { fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040); fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY), 51, 26, 0x404040); + fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricInfo.getDisplayShort(tileEntity.MAX_ELECTRICITY, ElectricUnit.JOULES), 51, 26, 0x404040); fontRenderer.drawString("Fuel: " + tileEntity.fuelSlot.liquidStored, 51, 35, 0x404040); - fontRenderer.drawString("Out: " + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.output), 51, 44, 0x404040); + fontRenderer.drawString("Out: " + tileEntity.output + "w", 51, 44, 0x404040); } @Override diff --git a/src/minecraft/mekanism/client/GuiHydrogenGenerator.java b/src/minecraft/mekanism/generators/client/GuiHydrogenGenerator.java similarity index 73% rename from src/minecraft/mekanism/client/GuiHydrogenGenerator.java rename to src/minecraft/mekanism/generators/client/GuiHydrogenGenerator.java index ba57cd92c..3fc66f46e 100644 --- a/src/minecraft/mekanism/client/GuiHydrogenGenerator.java +++ b/src/minecraft/mekanism/generators/client/GuiHydrogenGenerator.java @@ -1,10 +1,13 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; -import mekanism.common.ContainerHydrogenGenerator; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; + import mekanism.common.MekanismUtils; -import mekanism.common.TileEntityHydrogenGenerator; +import mekanism.generators.common.ContainerHydrogenGenerator; +import mekanism.generators.common.TileEntityHydrogenGenerator; import net.minecraft.src.*; public class GuiHydrogenGenerator extends GuiContainer @@ -25,9 +28,9 @@ public class GuiHydrogenGenerator extends GuiContainer { fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040); fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY), 51, 26, 0x404040); + fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricInfo.getDisplayShort(tileEntity.MAX_ELECTRICITY, ElectricUnit.JOULES), 51, 26, 0x404040); fontRenderer.drawString("Hydrogen: " + tileEntity.hydrogenStored, 51, 35, 0x404040); - fontRenderer.drawString("Out: " + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.output), 51, 44, 0x404040); + fontRenderer.drawString("Out: " + tileEntity.output + "w", 51, 44, 0x404040); } @Override diff --git a/src/minecraft/mekanism/client/GuiSolarGenerator.java b/src/minecraft/mekanism/generators/client/GuiSolarGenerator.java similarity index 69% rename from src/minecraft/mekanism/client/GuiSolarGenerator.java rename to src/minecraft/mekanism/generators/client/GuiSolarGenerator.java index eac4301f6..bf628a926 100644 --- a/src/minecraft/mekanism/client/GuiSolarGenerator.java +++ b/src/minecraft/mekanism/generators/client/GuiSolarGenerator.java @@ -1,12 +1,15 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; -import mekanism.common.ContainerHeatGenerator; -import mekanism.common.ContainerSolarGenerator; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.electricity.ElectricInfo.ElectricUnit; + import mekanism.common.MekanismUtils; -import mekanism.common.TileEntityHeatGenerator; -import mekanism.common.TileEntitySolarGenerator; +import mekanism.generators.common.ContainerHeatGenerator; +import mekanism.generators.common.ContainerSolarGenerator; +import mekanism.generators.common.TileEntityHeatGenerator; +import mekanism.generators.common.TileEntitySolarGenerator; import net.minecraft.src.*; public class GuiSolarGenerator extends GuiContainer @@ -27,9 +30,9 @@ public class GuiSolarGenerator extends GuiContainer { fontRenderer.drawString(tileEntity.fullName, tileEntity.fullName != "Advanced Solar Generator" ? 45 : 30, 6, 0x404040); fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY), 51, 26, 0x404040); + fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES) + "/" + ElectricInfo.getDisplayShort(tileEntity.MAX_ELECTRICITY, ElectricUnit.JOULES), 51, 26, 0x404040); fontRenderer.drawString("Sun: " + tileEntity.seesSun, 51, 35, 0x404040); - fontRenderer.drawString("Out: " + MekanismUtils.getDisplayedEnergyNoColor(tileEntity.output), 51, 44, 0x404040); + fontRenderer.drawString("Out: " + tileEntity.output + "w", 51, 44, 0x404040); } @Override diff --git a/src/minecraft/mekanism/client/ModelAdvancedSolarGenerator.java b/src/minecraft/mekanism/generators/client/ModelAdvancedSolarGenerator.java similarity index 99% rename from src/minecraft/mekanism/client/ModelAdvancedSolarGenerator.java rename to src/minecraft/mekanism/generators/client/ModelAdvancedSolarGenerator.java index 8ee6fef8b..b62a725ac 100644 --- a/src/minecraft/mekanism/client/ModelAdvancedSolarGenerator.java +++ b/src/minecraft/mekanism/generators/client/ModelAdvancedSolarGenerator.java @@ -1,4 +1,4 @@ -package mekanism.client; +package mekanism.generators.client; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; diff --git a/src/minecraft/mekanism/client/ModelBioGenerator.java b/src/minecraft/mekanism/generators/client/ModelBioGenerator.java similarity index 99% rename from src/minecraft/mekanism/client/ModelBioGenerator.java rename to src/minecraft/mekanism/generators/client/ModelBioGenerator.java index 1752e1fa6..a26cb4b9a 100644 --- a/src/minecraft/mekanism/client/ModelBioGenerator.java +++ b/src/minecraft/mekanism/generators/client/ModelBioGenerator.java @@ -1,4 +1,4 @@ -package mekanism.client; +package mekanism.generators.client; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; diff --git a/src/minecraft/mekanism/client/RenderAdvancedSolarGenerator.java b/src/minecraft/mekanism/generators/client/RenderAdvancedSolarGenerator.java similarity index 92% rename from src/minecraft/mekanism/client/RenderAdvancedSolarGenerator.java rename to src/minecraft/mekanism/generators/client/RenderAdvancedSolarGenerator.java index 28c86e6fe..13053a5bc 100644 --- a/src/minecraft/mekanism/client/RenderAdvancedSolarGenerator.java +++ b/src/minecraft/mekanism/generators/client/RenderAdvancedSolarGenerator.java @@ -1,6 +1,6 @@ -package mekanism.client; +package mekanism.generators.client; -import mekanism.common.TileEntityAdvancedSolarGenerator; +import mekanism.generators.common.TileEntityAdvancedSolarGenerator; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; diff --git a/src/minecraft/mekanism/client/RenderBioGenerator.java b/src/minecraft/mekanism/generators/client/RenderBioGenerator.java similarity index 91% rename from src/minecraft/mekanism/client/RenderBioGenerator.java rename to src/minecraft/mekanism/generators/client/RenderBioGenerator.java index 62b9d290c..b51145a74 100644 --- a/src/minecraft/mekanism/client/RenderBioGenerator.java +++ b/src/minecraft/mekanism/generators/client/RenderBioGenerator.java @@ -1,6 +1,6 @@ -package mekanism.client; +package mekanism.generators.client; -import mekanism.common.TileEntityBioGenerator; +import mekanism.generators.common.TileEntityBioGenerator; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; diff --git a/src/minecraft/mekanism/client/RenderHandler.java b/src/minecraft/mekanism/generators/client/RenderHandler.java similarity index 85% rename from src/minecraft/mekanism/client/RenderHandler.java rename to src/minecraft/mekanism/generators/client/RenderHandler.java index 7c4f39148..bd8501bab 100644 --- a/src/minecraft/mekanism/client/RenderHandler.java +++ b/src/minecraft/mekanism/generators/client/RenderHandler.java @@ -1,9 +1,10 @@ -package mekanism.client; +package mekanism.generators.client; import org.lwjgl.opengl.GL11; import mekanism.common.Mekanism; +import mekanism.generators.common.MekanismGenerators; import net.minecraft.src.Block; import net.minecraft.src.IBlockAccess; import net.minecraft.src.RenderBlocks; @@ -21,13 +22,13 @@ public class RenderHandler implements ISimpleBlockRenderingHandler GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - if(block.blockID == Mekanism.advancedSolarGeneratorID) + if(block.blockID == MekanismGenerators.advancedSolarGeneratorID) { GL11.glTranslatef(0.0F, 0.3F, 0.0F); GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/AdvancedSolarGenerator.png")); solarGenerator.render(0.0F, 0.024F); } - else if(block.blockID == Mekanism.bioGeneratorID) + else if(block.blockID == MekanismGenerators.bioGeneratorID) { GL11.glTranslated(0.0F, -1.1F, 0.0F); GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/BioGenerator.png")); @@ -52,7 +53,7 @@ public class RenderHandler implements ISimpleBlockRenderingHandler @Override public int getRenderId() { - return Mekanism.RENDER_ID; + return GeneratorsClientProxy.RENDER_ID; } } diff --git a/src/minecraft/mekanism/client/RenderKnife.java b/src/minecraft/mekanism/tools/client/RenderKnife.java similarity index 97% rename from src/minecraft/mekanism/client/RenderKnife.java rename to src/minecraft/mekanism/tools/client/RenderKnife.java index b7ee87db5..c69922c77 100644 --- a/src/minecraft/mekanism/client/RenderKnife.java +++ b/src/minecraft/mekanism/tools/client/RenderKnife.java @@ -1,8 +1,8 @@ -package mekanism.client; +package mekanism.tools.client; import org.lwjgl.opengl.GL11; -import mekanism.common.EntityKnife; +import mekanism.tools.common.EntityKnife; import net.minecraft.src.*; import org.lwjgl.opengl.GL12; diff --git a/src/minecraft/mekanism/tools/client/ToolsClientProxy.java b/src/minecraft/mekanism/tools/client/ToolsClientProxy.java new file mode 100644 index 000000000..23b6d16bb --- /dev/null +++ b/src/minecraft/mekanism/tools/client/ToolsClientProxy.java @@ -0,0 +1,33 @@ +package mekanism.tools.client; + +import java.io.IOException; + +import net.minecraftforge.client.MinecraftForgeClient; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +import mekanism.tools.common.ToolsCommonProxy; +import mekanism.tools.common.EntityKnife; + +public class ToolsClientProxy extends ToolsCommonProxy +{ + @Override + public int getArmorIndex(String string) + { + return RenderingRegistry.addNewArmourRendererPrefix(string); + } + + @Override + public void registerRenderInformation() + { + System.out.println("[Mekanism] Beginning render initiative..."); + + //Preload block/item textures + MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/tools/items.png"); + + //Register entity rendering handlers + RenderingRegistry.registerEntityRenderingHandler(EntityKnife.class, new RenderKnife()); + + System.out.println("[MekanismTools] Render initiative complete."); + } +}