*Updated textures, gave crusher an animated texture.
*Made sound effect volume be based off of base MC volume.
*Updated javadocs.
*Updated item IDs in all modules.
*Added thin glass to paxel's efficiency array.
*Updated UE API.
*Fixed OreDict crash.
*Added 'Control Circuit' as an essential crafting element for machines.
*Other minor bugfixes.
This commit is contained in:
Aidan Brady 2012-12-09 00:24:27 -05:00
parent 71dcbd34fd
commit aefa33b433
16 changed files with 271 additions and 254 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -174,7 +174,7 @@ public class BlockMachine extends BlockContainer
{ {
if(side == tileEntity.facing) if(side == tileEntity.facing)
{ {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX : 14; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+2 : 14;
} }
else { else {
@ -185,7 +185,7 @@ public class BlockMachine extends BlockContainer
{ {
if(side == tileEntity.facing) if(side == tileEntity.facing)
{ {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+1 : 15; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+3 : 15;
} }
else { else {
return 2; return 2;
@ -195,7 +195,7 @@ public class BlockMachine extends BlockContainer
{ {
if(side == tileEntity.facing) if(side == tileEntity.facing)
{ {
return isActive(world, x, y, z) ? 12 : 13; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+1 : 13;
} }
else { else {
return 2; return 2;
@ -210,14 +210,14 @@ public class BlockMachine extends BlockContainer
else { else {
if(side == tileEntity.facing) if(side == tileEntity.facing)
{ {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+2 : 16; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+4 : 16;
} }
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal()) else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
{ {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+3 : 17; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+5 : 17;
} }
else { else {
return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+4 : 19; return isActive(world, x, y, z) ? Mekanism.ANIMATED_TEXTURE_INDEX+6 : 19;
} }
} }
} }

View file

@ -116,6 +116,7 @@ public class Mekanism
public static ItemAtomicDisassembler AtomicDisassembler; public static ItemAtomicDisassembler AtomicDisassembler;
public static Item AtomicCore; public static Item AtomicCore;
public static ItemStorageTank StorageTank; public static ItemStorageTank StorageTank;
public static Item ControlCircuit;
//Extra Blocks //Extra Blocks
public static Block BasicBlock; public static Block BasicBlock;
@ -202,16 +203,16 @@ public class Mekanism
"ECE", "CPC", "ECE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('C'), EnergyTablet.getUnchargedItem(), Character.valueOf('P'), new ItemStack(EnergyCube, 1, 0) "ECE", "CPC", "ECE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('C'), EnergyTablet.getUnchargedItem(), Character.valueOf('P'), new ItemStack(EnergyCube, 1, 0)
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 0), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 0), new Object[] {
"***", "*R*", "***", Character.valueOf('*'), "ingotPlatinum", Character.valueOf('R'), Item.redstone "ARA", "CIC", "ARA", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('R'), Item.redstone, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5), Character.valueOf('C'), ControlCircuit
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 1), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 1), new Object[] {
"***", "*P*", "***", Character.valueOf('*'), Item.redstone, Character.valueOf('P'), new ItemStack(BasicBlock, 1, 0) "RCR", "GIG", "RCR", Character.valueOf('R'), Item.redstone, Character.valueOf('C'), ControlCircuit, Character.valueOf('G'), Block.glass, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5)
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 2), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 2), new Object[] {
"***", "*P*", "***", Character.valueOf('*'), Block.cobblestone, Character.valueOf('P'), new ItemStack(BasicBlock, 1, 0) "SCS", "RIR", "SCS", Character.valueOf('S'), Block.cobblestone, Character.valueOf('C'), ControlCircuit, Character.valueOf('R'), Item.redstone, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5)
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 3), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(MachineBlock, 1, 3), new Object[] {
"***", "*L*", "***", Character.valueOf('*'), "ingotPlatinum", Character.valueOf('L'), Item.bucketLava "RLR", "CIC", "RLR", Character.valueOf('R'), Item.redstone, Character.valueOf('L'), Item.bucketLava, Character.valueOf('C'), ControlCircuit, Character.valueOf('I'), new ItemStack(BasicBlock, 1, 5)
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(SpeedUpgrade), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(SpeedUpgrade), new Object[] {
"PAP", "AEA", "PAP", Character.valueOf('P'), "dustPlatinum", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), Item.emerald "PAP", "AEA", "PAP", Character.valueOf('P'), "dustPlatinum", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), Item.emerald
@ -232,7 +233,7 @@ public class Mekanism
" R ", "RIR", " R ", Character.valueOf('R'), Item.redstone, Character.valueOf('I'), Item.ingotIron " R ", "RIR", " R ", Character.valueOf('R'), Item.redstone, Character.valueOf('I'), Item.ingotIron
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 5), new Object[] { 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 "PAP", "AIA", "PAP", Character.valueOf('P'), "ingotPlatinum", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('I'), Item.ingotIron
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(StorageTank.getEmptyItem(), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(StorageTank.getEmptyItem(), new Object[] {
"III", "IDI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('D'), "dustIron" "III", "IDI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('D'), "dustIron"
@ -249,6 +250,9 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnumTier.ULTIMATE), new Object[] { CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(MekanismUtils.getEnergyCubeWithTier(EnumTier.ULTIMATE), new Object[] {
"EDE", "TAT", "EDE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('A'), MekanismUtils.getEnergyCubeWithTier(EnumTier.ADVANCED) "EDE", "TAT", "EDE", Character.valueOf('E'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('T'), EnergyTablet.getUnchargedItem(), Character.valueOf('A'), MekanismUtils.getEnergyCubeWithTier(EnumTier.ADVANCED)
})); }));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ControlCircuit), new Object[] {
" P ", "PEP", " P ", Character.valueOf('P'), new ItemStack(Ingot, 1, 1), Character.valueOf('E'), EnrichedAlloy
}));
if(extrasEnabled) if(extrasEnabled)
{ {
@ -317,6 +321,7 @@ public class Mekanism
LanguageRegistry.addName(NullRender, "Null Render"); LanguageRegistry.addName(NullRender, "Null Render");
LanguageRegistry.addName(GasTank, "Gas Tank"); LanguageRegistry.addName(GasTank, "Gas Tank");
LanguageRegistry.addName(StorageTank, "Storage Tank"); LanguageRegistry.addName(StorageTank, "Storage Tank");
LanguageRegistry.addName(ControlCircuit, "Control Circuit");
//Localization for MultiBlock //Localization for MultiBlock
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.PlatinumBlock.name", "Platinum Block"); LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.PlatinumBlock.name", "Platinum Block");
@ -380,6 +385,7 @@ public class Mekanism
AtomicCore.setIconIndex(254); AtomicCore.setIconIndex(254);
ElectricBow.setIconIndex(252); ElectricBow.setIconIndex(252);
StorageTank.setIconIndex(255); StorageTank.setIconIndex(255);
ControlCircuit.setIconIndex(223);
} }
/** /**
@ -387,23 +393,24 @@ public class Mekanism
*/ */
public void addItems() public void addItems()
{ {
ElectricBow = (ItemElectricBow) new ItemElectricBow(11275).setItemName("ElectricBow"); ElectricBow = (ItemElectricBow) new ItemElectricBow(11200).setItemName("ElectricBow");
if(extrasEnabled == true) if(extrasEnabled == true)
{ {
LightningRod = new ItemLightningRod(11276).setItemName("LightningRod"); LightningRod = new ItemLightningRod(11201).setItemName("LightningRod");
Stopwatch = new ItemStopwatch(11277).setItemName("Stopwatch"); Stopwatch = new ItemStopwatch(11202).setItemName("Stopwatch");
WeatherOrb = new ItemWeatherOrb(11278).setItemName("WeatherOrb"); WeatherOrb = new ItemWeatherOrb(11203).setItemName("WeatherOrb");
} }
Dust = new ItemDust(11293-256); Dust = new ItemDust(11204-256);
Ingot = new ItemIngot(11294-256); Ingot = new ItemIngot(11205-256);
EnergyTablet = (ItemEnergized) new ItemEnergized(11306, 250000, 800, 2500).setItemName("EnergyTablet"); EnergyTablet = (ItemEnergized) new ItemEnergized(11206, 250000, 800, 2500).setItemName("EnergyTablet");
SpeedUpgrade = new ItemMachineUpgrade(11309, 0, 150).setItemName("SpeedUpgrade"); SpeedUpgrade = new ItemMachineUpgrade(11207, 0, 150).setItemName("SpeedUpgrade");
EnergyUpgrade = new ItemMachineUpgrade(11310, 1000, 0).setItemName("EnergyUpgrade"); EnergyUpgrade = new ItemMachineUpgrade(11208, 1000, 0).setItemName("EnergyUpgrade");
UltimateUpgrade = new ItemMachineUpgrade(11311, 2500, 180).setItemName("UltimateUpgrade"); UltimateUpgrade = new ItemMachineUpgrade(11209, 2500, 180).setItemName("UltimateUpgrade");
AtomicDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(11312).setItemName("AtomicDisassembler"); AtomicDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(11210).setItemName("AtomicDisassembler");
AtomicCore = new ItemMekanism(11313).setItemName("AtomicCore"); AtomicCore = new ItemMekanism(11211).setItemName("AtomicCore");
EnrichedAlloy = new ItemMekanism(11315).setItemName("EnrichedAlloy"); EnrichedAlloy = new ItemMekanism(11212).setItemName("EnrichedAlloy");
StorageTank = (ItemStorageTank) new ItemStorageTank(11316, 1600, 16, 16).setItemName("StorageTank"); StorageTank = (ItemStorageTank) new ItemStorageTank(11213, 1600, 16, 16).setItemName("StorageTank");
ControlCircuit = new ItemMekanism(11214).setItemName("ControlCircuit");
} }
/** /**
@ -485,7 +492,7 @@ public class Mekanism
{ {
RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustLead").get(0)); RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustLead").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
try { try {
for(ItemStack ore : OreDictionary.getOres("oreSilver")) for(ItemStack ore : OreDictionary.getOres("oreSilver"))
@ -497,7 +504,7 @@ public class Mekanism
{ {
RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustSilver").get(0)); RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustSilver").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
for(ItemStack ore : OreDictionary.getOres("ingotObsidian")) for(ItemStack ore : OreDictionary.getOres("ingotObsidian"))
{ {
@ -524,14 +531,14 @@ public class Mekanism
{ {
RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustCopper").get(0)); RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustCopper").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
try { try {
for(ItemStack ore : OreDictionary.getOres("ingotTin")) for(ItemStack ore : OreDictionary.getOres("ingotTin"))
{ {
RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustTin").get(0)); RecipeHandler.addCrusherRecipe(ore, OreDictionary.getOres("dustTin").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
for(ItemStack ore : OreDictionary.getOres("dustIron")) for(ItemStack ore : OreDictionary.getOres("dustIron"))
{ {
@ -559,28 +566,28 @@ public class Mekanism
{ {
RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreCopper").get(0)); RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreCopper").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
try { try {
for(ItemStack ore : OreDictionary.getOres("dustTin")) for(ItemStack ore : OreDictionary.getOres("dustTin"))
{ {
RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreTin").get(0)); RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreTin").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
try { try {
for(ItemStack ore : OreDictionary.getOres("dustLead")) for(ItemStack ore : OreDictionary.getOres("dustLead"))
{ {
RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreLead").get(0)); RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreLead").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
try { try {
for(ItemStack ore : OreDictionary.getOres("dustSilver")) for(ItemStack ore : OreDictionary.getOres("dustSilver"))
{ {
RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreSilver").get(0)); RecipeHandler.addCombinerRecipe(MekanismUtils.getStackWithSize(ore, 2), OreDictionary.getOres("oreSilver").get(0));
} }
} catch(ArrayIndexOutOfBoundsException e) {} } catch(Exception e) {}
} }
/** /**
@ -642,12 +649,18 @@ public class Mekanism
{ {
//Register the mod's ore handler //Register the mod's ore handler
GameRegistry.registerWorldGenerator(new OreHandler()); GameRegistry.registerWorldGenerator(new OreHandler());
//Register the mod's GUI handler //Register the mod's GUI handler
NetworkRegistry.instance().registerGuiHandler(this, new CoreGuiHandler()); NetworkRegistry.instance().registerGuiHandler(this, new CoreGuiHandler());
//Register the MachineryManager //Register the MachineryManager
manager = new MachineryManager(); manager = new MachineryManager();
System.out.println("[Mekanism] Version " + versionNumber + " initializing..."); System.out.println("[Mekanism] Version " + versionNumber + " initializing...");
new ThreadGetData(); new ThreadGetData();
//Load proxy
proxy.registerRenderInformation(); proxy.registerRenderInformation();
proxy.loadConfiguration(); proxy.loadConfiguration();
proxy.loadUtilities(); proxy.loadUtilities();

View file

@ -1,8 +1,13 @@
package mekanism.common; package mekanism.common;
import java.util.EnumSet;
import universalelectricity.core.electricity.ElectricInfo; import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.implement.IElectricityReceiver; import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.implement.IConductor;
import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.implement.IJouleStorage;
import universalelectricity.core.implement.IVoltage;
import universalelectricity.core.vector.Vector3;
import buildcraft.api.power.IPowerProvider; import buildcraft.api.power.IPowerProvider;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
@ -30,7 +35,7 @@ import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory; import net.minecraftforge.common.ISidedInventory;
public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IElectricityReceiver, IPeripheral public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IEnergySink, IJouleStorage, IVoltage, IPeripheral
{ {
/** The Sound instance for this machine. */ /** The Sound instance for this machine. */
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -78,6 +83,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
public TileEntityBasicMachine(String soundPath, String name, String path, int perTick, int ticksRequired, int maxEnergy) public TileEntityBasicMachine(String soundPath, String name, String path, int perTick, int ticksRequired, int maxEnergy)
{ {
super(name, maxEnergy); super(name, maxEnergy);
ElectricityConnections.registerConnector(this, EnumSet.allOf(ForgeDirection.class));
currentMaxElectricity = MAX_ELECTRICITY; currentMaxElectricity = MAX_ELECTRICITY;
ENERGY_PER_TICK = perTick; ENERGY_PER_TICK = perTick;
TICKS_REQUIRED = currentTicksRequired = ticksRequired; TICKS_REQUIRED = currentTicksRequired = ticksRequired;
@ -95,6 +101,33 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
registered = true; registered = true;
} }
if(!worldObj.isRemote)
{
for(ForgeDirection direction : ForgeDirection.values())
{
if(direction != ForgeDirection.getOrientation(facing))
{
TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), direction);
if(tileEntity != null)
{
if(tileEntity instanceof IConductor)
{
if(electricityStored < currentMaxElectricity)
{
double electricityNeeded = currentMaxElectricity - electricityStored;
((IConductor)tileEntity).getNetwork().startRequesting(this, electricityNeeded, electricityNeeded >= getVoltage() ? getVoltage() : electricityNeeded);
setJoules(electricityStored + ((IConductor)tileEntity).getNetwork().consumeElectricity(this).getWatts());
}
else if(electricityStored >= currentMaxElectricity)
{
((IConductor)tileEntity).getNetwork().stopRequesting(this);
}
}
}
}
}
}
if(worldObj.isRemote) if(worldObj.isRemote)
{ {
handleSound(); handleSound();
@ -233,48 +266,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0); electricityStored = Math.max(Math.min(joules, getMaxJoules()), 0);
} }
@Override
public boolean canConnect(ForgeDirection side)
{
return true;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side)
{
return true;
}
@Override @Override
public double getVoltage() public double getVoltage()
{ {
return 120; return 120;
} }
@Override
public double wattRequest()
{
return currentMaxElectricity - electricityStored;
}
@Override
public void onReceive(Object sender, double amps, double voltage, ForgeDirection side)
{
double electricityToReceive = ElectricInfo.getJoules(amps, voltage);
double electricityNeeded = MAX_ELECTRICITY - electricityStored;
double electricityToStore = 0;
if(electricityToReceive <= electricityNeeded)
{
electricityToStore = electricityToReceive;
}
else if(electricityToReceive > electricityNeeded)
{
electricityToStore = electricityNeeded;
}
setJoules(electricityStored + electricityToStore);
}
@Override @Override
public void setActive(boolean active) public void setActive(boolean active)
{ {

View file

@ -3,13 +3,14 @@ package mekanism.common;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.EnumSet;
import universalelectricity.core.electricity.ElectricInfo; import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.electricity.ElectricityManager; import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.implement.IConductor; import universalelectricity.core.implement.IConductor;
import universalelectricity.core.implement.IElectricityReceiver;
import universalelectricity.core.implement.IItemElectric; import universalelectricity.core.implement.IItemElectric;
import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.implement.IJouleStorage;
import universalelectricity.core.implement.IVoltage;
import universalelectricity.prefab.tile.TileEntityConductor; import universalelectricity.prefab.tile.TileEntityConductor;
import universalelectricity.core.vector.Vector3; import universalelectricity.core.vector.Vector3;
@ -38,7 +39,7 @@ import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory; import net.minecraftforge.common.ISidedInventory;
public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEnergySink, IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IElectricityReceiver, IPeripheral public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEnergySink, IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IVoltage, IPeripheral
{ {
public EnumTier tier = EnumTier.BASIC; public EnumTier tier = EnumTier.BASIC;
@ -64,6 +65,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
public TileEntityEnergyCube(String name, int maxEnergy, int i) public TileEntityEnergyCube(String name, int maxEnergy, int i)
{ {
super(name, maxEnergy); super(name, maxEnergy);
ElectricityConnections.registerConnector(this, EnumSet.allOf(ForgeDirection.class));
inventory = new ItemStack[2]; inventory = new ItemStack[2];
output = i; output = i;
if(PowerFramework.currentFramework != null) if(PowerFramework.currentFramework != null)
@ -82,6 +84,33 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
setJoules(electricityStored + received); setJoules(electricityStored + received);
} }
if(!worldObj.isRemote)
{
for(ForgeDirection direction : ForgeDirection.values())
{
if(direction != ForgeDirection.getOrientation(facing))
{
TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), direction);
if(tileEntity != null)
{
if(tileEntity instanceof IConductor)
{
if(electricityStored < tier.MAX_ELECTRICITY)
{
double electricityNeeded = tier.MAX_ELECTRICITY - electricityStored;
((IConductor)tileEntity).getNetwork().startRequesting(this, electricityNeeded, electricityNeeded >= getVoltage() ? getVoltage() : electricityNeeded);
setJoules(electricityStored + ((IConductor)tileEntity).getNetwork().consumeElectricity(this).getWatts());
}
else if(electricityStored >= tier.MAX_ELECTRICITY)
{
((IConductor)tileEntity).getNetwork().stopRequesting(this);
}
}
}
}
}
}
if(inventory[0] != null && electricityStored > 0) if(inventory[0] != null && electricityStored > 0)
{ {
if(inventory[0].getItem() instanceof IItemElectric) if(inventory[0].getItem() instanceof IItemElectric)
@ -189,15 +218,18 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
} }
else if(tileEntity instanceof IConductor) else if(tileEntity instanceof IConductor)
{ {
double joulesNeeded = ElectricityManager.instance.getElectricityRequired(((IConductor)tileEntity).getNetwork()); double joulesNeeded = ((IConductor)tileEntity).getNetwork().getRequest().getWatts();
double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored, getVoltage())), 80), 0); double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored, getVoltage())), 80), 0);
if (!worldObj.isRemote) if (!worldObj.isRemote && transferAmps > 0)
{ {
ElectricityManager.instance.produceElectricity(this, (IConductor)tileEntity, transferAmps, getVoltage()); ((IConductor)tileEntity).getNetwork().startProducing(this, transferAmps, getVoltage());
setJoules(electricityStored - ElectricInfo.getWatts(transferAmps, getVoltage()));
}
else
{
((IConductor)tileEntity).getNetwork().stopProducing(this);
} }
setJoules(electricityStored - ElectricInfo.getJoules(transferAmps, getVoltage()));
} }
} }
} }
@ -304,12 +336,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }
@Override
public boolean canConnect(ForgeDirection side)
{
return true;
}
@Override @Override
public double getVoltage() public double getVoltage()
{ {
@ -332,36 +358,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
return false; return false;
} }
@Override
public void onReceive(Object sender, double amps, double voltage, ForgeDirection side)
{
double electricityToReceive = ElectricInfo.getJoules(amps, voltage);
double electricityNeeded = tier.MAX_ELECTRICITY - electricityStored;
double electricityToStore = 0;
if(electricityToReceive <= electricityNeeded)
{
electricityToStore = electricityToReceive;
}
else if(electricityToReceive > electricityNeeded)
{
electricityToStore = electricityNeeded;
}
setJoules(electricityStored + electricityToStore);
}
@Override
public double wattRequest()
{
return ElectricInfo.getWatts(tier.MAX_ELECTRICITY) - ElectricInfo.getWatts(electricityStored);
}
@Override
public boolean canReceiveFromSide(ForgeDirection side)
{
return side != ForgeDirection.getOrientation(facing);
}
@Override @Override
public String getType() public String getType()
{ {

View file

@ -153,8 +153,8 @@ public class MekanismGenerators
public void addItems() public void addItems()
{ {
SolarPanel = new ItemMekanism(11314).setItemName("SolarPanel"); SolarPanel = new ItemMekanism(11300).setItemName("SolarPanel");
BioFuel = new ItemMekanism(11318).setItemName("BioFuel"); BioFuel = new ItemMekanism(11301).setItemName("BioFuel");
ElectrolyticCore = new ItemMekanism(11319).setItemName("ElectrolyticCore"); ElectrolyticCore = new ItemMekanism(11302).setItemName("ElectrolyticCore");
} }
} }

View file

@ -1,14 +1,18 @@
package mekanism.generators.common; package mekanism.generators.common;
import java.util.EnumSet;
import ic2.api.Direction; import ic2.api.Direction;
import ic2.api.ElectricItem; import ic2.api.ElectricItem;
import ic2.api.IElectricItem; import ic2.api.IElectricItem;
import ic2.api.IEnergySink; import ic2.api.IEnergySink;
import universalelectricity.core.electricity.ElectricInfo; import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.implement.IElectricityReceiver; import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.implement.IConductor;
import universalelectricity.core.implement.IItemElectric; import universalelectricity.core.implement.IItemElectric;
import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.implement.IJouleStorage;
import universalelectricity.core.implement.IVoltage;
import universalelectricity.core.vector.Vector3; import universalelectricity.core.vector.Vector3;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
@ -31,7 +35,7 @@ import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank; import net.minecraftforge.liquids.LiquidTank;
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IGasStorage, IEnergySink, IJouleStorage, IElectricityReceiver, ITankContainer, IPeripheral public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IGasStorage, IEnergySink, IJouleStorage, IVoltage, ITankContainer, IPeripheral
{ {
public LiquidSlot waterSlot = new LiquidSlot(24000, 9); public LiquidSlot waterSlot = new LiquidSlot(24000, 9);
@ -53,6 +57,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
public TileEntityElectrolyticSeparator() public TileEntityElectrolyticSeparator()
{ {
super("Electrolytic Seperator", 9600); super("Electrolytic Seperator", 9600);
ElectricityConnections.registerConnector(this, EnumSet.allOf(ForgeDirection.class));
inventory = new ItemStack[4]; inventory = new ItemStack[4];
outputType = EnumGas.HYDROGEN; outputType = EnumGas.HYDROGEN;
} }
@ -70,6 +75,33 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
oxygenStored = MAX_GAS; oxygenStored = MAX_GAS;
} }
if(!worldObj.isRemote)
{
for(ForgeDirection direction : ForgeDirection.values())
{
if(direction != ForgeDirection.getOrientation(facing))
{
TileEntity tileEntity = Vector3.getTileEntityFromSide(worldObj, Vector3.get(this), direction);
if(tileEntity != null)
{
if(tileEntity instanceof IConductor)
{
if(electricityStored < MAX_ELECTRICITY)
{
double electricityNeeded = MAX_ELECTRICITY - electricityStored;
((IConductor)tileEntity).getNetwork().startRequesting(this, electricityNeeded, electricityNeeded >= getVoltage() ? getVoltage() : electricityNeeded);
setJoules(electricityStored + ((IConductor)tileEntity).getNetwork().consumeElectricity(this).getWatts());
}
else if(electricityStored >= MAX_ELECTRICITY)
{
((IConductor)tileEntity).getNetwork().stopRequesting(this);
}
}
}
}
}
}
if(inventory[3] != null && electricityStored < MAX_ELECTRICITY) if(inventory[3] != null && electricityStored < MAX_ELECTRICITY)
{ {
if(inventory[3].getItem() instanceof IItemElectric) if(inventory[3].getItem() instanceof IItemElectric)
@ -343,48 +375,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
setEnergy((int)(joules*Mekanism.TO_IC2)); setEnergy((int)(joules*Mekanism.TO_IC2));
} }
@Override
public boolean canConnect(ForgeDirection side)
{
return true;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side)
{
return side != ForgeDirection.getOrientation(facing);
}
@Override
public double getVoltage()
{
return 120;
}
@Override
public double wattRequest()
{
return electricityStored < MAX_ELECTRICITY ? ElectricInfo.getWatts((16)*Mekanism.FROM_IC2) : 0;
}
@Override
public void onReceive(Object sender, double amps, double voltage, ForgeDirection side)
{
double electricityToReceive = ElectricInfo.getJoules(amps, voltage);
double electricityNeeded = MAX_ELECTRICITY - electricityStored;
double electricityToStore = 0;
if(electricityToReceive <= electricityNeeded)
{
electricityToStore = electricityToReceive;
}
else if(electricityToReceive > electricityNeeded)
{
electricityToStore = electricityNeeded;
}
setJoules(electricityStored + electricityToStore);
}
@Override @Override
public boolean demandsEnergy() public boolean demandsEnergy()
{ {
@ -552,4 +542,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
@Override @Override
public void detach(IComputerAccess computer) {} public void detach(IComputerAccess computer) {}
@Override
public double getVoltage()
{
return 120;
}
} }

View file

@ -1,5 +1,7 @@
package mekanism.generators.common; package mekanism.generators.common;
import java.util.EnumSet;
import buildcraft.api.power.IPowerProvider; import buildcraft.api.power.IPowerProvider;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerFramework; import buildcraft.api.power.PowerFramework;
@ -18,10 +20,10 @@ import ic2.api.IEnergySource;
import ic2.api.IEnergyStorage; import ic2.api.IEnergyStorage;
import universalelectricity.core.electricity.ElectricInfo; import universalelectricity.core.electricity.ElectricInfo;
import universalelectricity.core.electricity.ElectricityManager; import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.implement.IConductor; import universalelectricity.core.implement.IConductor;
import universalelectricity.core.implement.IElectricityProducer;
import universalelectricity.core.implement.IJouleStorage; import universalelectricity.core.implement.IJouleStorage;
import universalelectricity.core.implement.IVoltage;
import universalelectricity.core.vector.Vector3; import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.tile.TileEntityConductor; import universalelectricity.prefab.tile.TileEntityConductor;
@ -31,7 +33,7 @@ import mekanism.common.TileEntityElectricBlock;
import net.minecraft.src.*; import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IElectricityProducer, IPeripheral public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IEnergySource, IEnergyStorage, IPowerReceptor, IJouleStorage, IVoltage, IPeripheral
{ {
/** Output per tick this generator can transfer. */ /** Output per tick this generator can transfer. */
public int output; public int output;
@ -55,6 +57,8 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
{ {
super(name, maxEnergy); super(name, maxEnergy);
ElectricityConnections.registerConnector(this, EnumSet.allOf(ForgeDirection.class));
output = out; output = out;
isActive = false; isActive = false;
@ -92,15 +96,18 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
} }
else if(tileEntity instanceof IConductor) else if(tileEntity instanceof IConductor)
{ {
double joulesNeeded = ElectricityManager.instance.getElectricityRequired(((IConductor)tileEntity).getNetwork()); double joulesNeeded = ((IConductor)tileEntity).getNetwork().getRequest().getWatts();
double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored, getVoltage())), 80), 0); double transferAmps = Math.max(Math.min(Math.min(ElectricInfo.getAmps(joulesNeeded, getVoltage()), ElectricInfo.getAmps(electricityStored, getVoltage())), 80), 0);
if (!worldObj.isRemote) if (!worldObj.isRemote && transferAmps > 0)
{ {
ElectricityManager.instance.produceElectricity(this, (IConductor)tileEntity, transferAmps, getVoltage()); ((IConductor)tileEntity).getNetwork().startProducing(this, transferAmps, getVoltage());
setJoules(electricityStored - ElectricInfo.getWatts(transferAmps, getVoltage()));
}
else
{
((IConductor)tileEntity).getNetwork().stopProducing(this);
} }
setJoules(electricityStored - ElectricInfo.getJoules(transferAmps, getVoltage()));
} }
} }
} }
@ -253,12 +260,6 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
return output; return output;
} }
@Override
public boolean canConnect(ForgeDirection side)
{
return side == ForgeDirection.getOrientation(facing);
}
@Override @Override
public void readFromNBT(NBTTagCompound nbtTags) public void readFromNBT(NBTTagCompound nbtTags)
{ {

View file

@ -74,7 +74,7 @@ public class ItemMekanismPaxel extends ItemMekanismTool
Block.railDetector, Block.railPowered, Block.leaves, Block.grass, Block.dirt, Block.sand, Block.railDetector, Block.railPowered, Block.leaves, Block.grass, Block.dirt, Block.sand,
Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium, Block.planks, Block.bookShelf, Block.wood, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium, Block.planks, Block.bookShelf, Block.wood,
Block.chest, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.pumpkin, Block.pumpkinLantern, Block.snow, Block.pistonBase, Block.pistonStickyBase, Block.workbench, Block.chest, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.pumpkin, Block.pumpkinLantern, Block.snow, Block.pistonBase, Block.pistonStickyBase, Block.workbench,
Block.stoneOvenActive, Block.stoneOvenIdle, Block.music, Block.trapdoor, Block.silverfish, Block.stoneBrick, Block.glowStone Block.stoneOvenActive, Block.stoneOvenIdle, Block.music, Block.trapdoor, Block.silverfish, Block.stoneBrick, Block.glowStone, Block.thinGlass
}); });
} }
} }

View file

@ -534,83 +534,83 @@ public class MekanismTools
public void addItems() public void addItems()
{ {
//Redstone //Redstone
RedstoneHelmet = (new ItemMekanismArmor(11235, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 0)).setItemName("RedstoneHelmet"); RedstoneHelmet = (new ItemMekanismArmor(11400, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 0)).setItemName("RedstoneHelmet");
RedstoneBody = (new ItemMekanismArmor(11236, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 1)).setItemName("RedstoneBody"); RedstoneBody = (new ItemMekanismArmor(11401, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 1)).setItemName("RedstoneBody");
RedstoneLegs = (new ItemMekanismArmor(11237, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 2)).setItemName("RedstoneLegs"); RedstoneLegs = (new ItemMekanismArmor(11402, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 2)).setItemName("RedstoneLegs");
RedstoneBoots = (new ItemMekanismArmor(11238, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 3)).setItemName("RedstoneBoots"); RedstoneBoots = (new ItemMekanismArmor(11403, armorREDSTONE, Mekanism.proxy.getArmorIndex("redstone"), 3)).setItemName("RedstoneBoots");
RedstonePaxel = new ItemMekanismPaxel(11239, toolREDSTONE2).setItemName("RedstonePaxel"); RedstonePaxel = new ItemMekanismPaxel(11404, toolREDSTONE2).setItemName("RedstonePaxel");
RedstonePickaxe = new ItemMekanismPickaxe(11240, toolREDSTONE).setItemName("RedstonePickaxe"); RedstonePickaxe = new ItemMekanismPickaxe(11405, toolREDSTONE).setItemName("RedstonePickaxe");
RedstoneAxe = new ItemMekanismAxe(11241, toolREDSTONE).setItemName("RedstoneAxe"); RedstoneAxe = new ItemMekanismAxe(11406, toolREDSTONE).setItemName("RedstoneAxe");
RedstoneSpade = new ItemMekanismSpade(11242, toolREDSTONE).setItemName("RedstoneSpade"); RedstoneSpade = new ItemMekanismSpade(11407, toolREDSTONE).setItemName("RedstoneSpade");
RedstoneHoe = new ItemMekanismHoe(11243, toolREDSTONE).setItemName("RedstoneHoe"); RedstoneHoe = new ItemMekanismHoe(11408, toolREDSTONE).setItemName("RedstoneHoe");
RedstoneSword = new ItemMekanismSword(11244, toolREDSTONE).setItemName("RedstoneSword"); RedstoneSword = new ItemMekanismSword(11409, toolREDSTONE).setItemName("RedstoneSword");
//Platinum //Platinum
PlatinumHelmet = (new ItemMekanismArmor(11245, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 0)).setItemName("PlatinumHelmet"); PlatinumHelmet = (new ItemMekanismArmor(11410, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 0)).setItemName("PlatinumHelmet");
PlatinumBody = (new ItemMekanismArmor(11246, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 1)).setItemName("PlatinumBody"); PlatinumBody = (new ItemMekanismArmor(11411, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 1)).setItemName("PlatinumBody");
PlatinumLegs = (new ItemMekanismArmor(11247, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 2)).setItemName("PlatinumLegs"); PlatinumLegs = (new ItemMekanismArmor(11412, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 2)).setItemName("PlatinumLegs");
PlatinumBoots = (new ItemMekanismArmor(11248, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 3)).setItemName("PlatinumBoots"); PlatinumBoots = (new ItemMekanismArmor(11413, EnumArmorMaterial.DIAMOND, Mekanism.proxy.getArmorIndex("platinum"), 3)).setItemName("PlatinumBoots");
PlatinumPaxel = new ItemMekanismPaxel(11249, toolPLATINUM2).setItemName("PlatinumPaxel"); PlatinumPaxel = new ItemMekanismPaxel(11414, toolPLATINUM2).setItemName("PlatinumPaxel");
PlatinumPickaxe = new ItemMekanismPickaxe(11250, toolPLATINUM).setItemName("PlatinumPickaxe"); PlatinumPickaxe = new ItemMekanismPickaxe(11415, toolPLATINUM).setItemName("PlatinumPickaxe");
PlatinumAxe = new ItemMekanismAxe(11251, toolPLATINUM).setItemName("PlatinumAxe"); PlatinumAxe = new ItemMekanismAxe(11416, toolPLATINUM).setItemName("PlatinumAxe");
PlatinumSpade = new ItemMekanismSpade(11252, toolPLATINUM).setItemName("PlatinumSpade"); PlatinumSpade = new ItemMekanismSpade(11417, toolPLATINUM).setItemName("PlatinumSpade");
PlatinumHoe = new ItemMekanismHoe(11253, toolPLATINUM).setItemName("PlatinumHoe"); PlatinumHoe = new ItemMekanismHoe(11418, toolPLATINUM).setItemName("PlatinumHoe");
PlatinumSword = new ItemMekanismSword(11254, toolPLATINUM).setItemName("PlatinumSword"); PlatinumSword = new ItemMekanismSword(11419, toolPLATINUM).setItemName("PlatinumSword");
//Obsidian //Obsidian
ObsidianHelmet = (new ItemMekanismArmor(11255, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 0)).setItemName("ObsidianHelmet"); ObsidianHelmet = (new ItemMekanismArmor(11420, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 0)).setItemName("ObsidianHelmet");
ObsidianBody = (new ItemMekanismArmor(11256, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 1)).setItemName("ObsidianBody"); ObsidianBody = (new ItemMekanismArmor(11421, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 1)).setItemName("ObsidianBody");
ObsidianLegs = (new ItemMekanismArmor(11257, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 2)).setItemName("ObsidianLegs"); ObsidianLegs = (new ItemMekanismArmor(11422, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 2)).setItemName("ObsidianLegs");
ObsidianBoots = (new ItemMekanismArmor(11258, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 3)).setItemName("ObsidianBoots"); ObsidianBoots = (new ItemMekanismArmor(11423, armorOBSIDIAN, Mekanism.proxy.getArmorIndex("obsidian"), 3)).setItemName("ObsidianBoots");
ObsidianPaxel = new ItemMekanismPaxel(11259, toolOBSIDIAN2).setItemName("ObsidianPaxel"); ObsidianPaxel = new ItemMekanismPaxel(11424, toolOBSIDIAN2).setItemName("ObsidianPaxel");
ObsidianPickaxe = new ItemMekanismPickaxe(11260, toolOBSIDIAN).setItemName("ObsidianPickaxe"); ObsidianPickaxe = new ItemMekanismPickaxe(11425, toolOBSIDIAN).setItemName("ObsidianPickaxe");
ObsidianAxe = new ItemMekanismAxe(11261, toolOBSIDIAN).setItemName("ObsidianAxe"); ObsidianAxe = new ItemMekanismAxe(11426, toolOBSIDIAN).setItemName("ObsidianAxe");
ObsidianSpade = new ItemMekanismSpade(11262, toolOBSIDIAN).setItemName("ObsidianSpade"); ObsidianSpade = new ItemMekanismSpade(11427, toolOBSIDIAN).setItemName("ObsidianSpade");
ObsidianHoe = new ItemMekanismHoe(11263, toolOBSIDIAN).setItemName("ObsidianHoe"); ObsidianHoe = new ItemMekanismHoe(11428, toolOBSIDIAN).setItemName("ObsidianHoe");
ObsidianSword = new ItemMekanismSword(11264, toolOBSIDIAN).setItemName("ObsidianSword"); ObsidianSword = new ItemMekanismSword(11429, toolOBSIDIAN).setItemName("ObsidianSword");
//Lazuli //Lazuli
LazuliPaxel = new ItemMekanismPaxel(11265, toolLAZULI2).setItemName("LazuliPaxel"); LazuliPaxel = new ItemMekanismPaxel(11430, toolLAZULI2).setItemName("LazuliPaxel");
LazuliPickaxe = new ItemMekanismPickaxe(11266, toolLAZULI).setItemName("LazuliPickaxe"); LazuliPickaxe = new ItemMekanismPickaxe(11431, toolLAZULI).setItemName("LazuliPickaxe");
LazuliAxe = new ItemMekanismAxe(11267, toolLAZULI).setItemName("LazuliAxe"); LazuliAxe = new ItemMekanismAxe(11432, toolLAZULI).setItemName("LazuliAxe");
LazuliSpade = new ItemMekanismSpade(11268, toolLAZULI).setItemName("LazuliSpade"); LazuliSpade = new ItemMekanismSpade(11433, toolLAZULI).setItemName("LazuliSpade");
LazuliHoe = new ItemMekanismHoe(11269, toolLAZULI).setItemName("LazuliHoe"); LazuliHoe = new ItemMekanismHoe(11434, toolLAZULI).setItemName("LazuliHoe");
LazuliSword = new ItemMekanismSword(11270, toolLAZULI).setItemName("LazuliSword"); LazuliSword = new ItemMekanismSword(11435, toolLAZULI).setItemName("LazuliSword");
LazuliHelmet = (new ItemMekanismArmor(11271, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 0)).setItemName("LazuliHelmet"); LazuliHelmet = (new ItemMekanismArmor(11436, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 0)).setItemName("LazuliHelmet");
LazuliBody = (new ItemMekanismArmor(11272, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 1)).setItemName("LazuliBody"); LazuliBody = (new ItemMekanismArmor(11437, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 1)).setItemName("LazuliBody");
LazuliLegs = (new ItemMekanismArmor(11273, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 2)).setItemName("LazuliLegs"); LazuliLegs = (new ItemMekanismArmor(11438, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 2)).setItemName("LazuliLegs");
LazuliBoots = (new ItemMekanismArmor(11274, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 3)).setItemName("LazuliBoots"); LazuliBoots = (new ItemMekanismArmor(11439, armorLAZULI, Mekanism.proxy.getArmorIndex("lazuli"), 3)).setItemName("LazuliBoots");
//Glowstone //Glowstone
GlowstonePaxel = new ItemMekanismPaxel(11295, toolGLOWSTONE2).setItemName("GlowstonePaxel"); GlowstonePaxel = new ItemMekanismPaxel(11440, toolGLOWSTONE2).setItemName("GlowstonePaxel");
GlowstonePickaxe = new ItemMekanismPickaxe(11296, toolGLOWSTONE).setItemName("GlowstonePickaxe"); GlowstonePickaxe = new ItemMekanismPickaxe(11441, toolGLOWSTONE).setItemName("GlowstonePickaxe");
GlowstoneAxe = new ItemMekanismAxe(11297, toolGLOWSTONE).setItemName("GlowstoneAxe"); GlowstoneAxe = new ItemMekanismAxe(11442, toolGLOWSTONE).setItemName("GlowstoneAxe");
GlowstoneSpade = new ItemMekanismSpade(11298, toolGLOWSTONE).setItemName("GlowstoneSpade"); GlowstoneSpade = new ItemMekanismSpade(11443, toolGLOWSTONE).setItemName("GlowstoneSpade");
GlowstoneHoe = new ItemMekanismHoe(11299, toolGLOWSTONE).setItemName("GlowstoneHoe"); GlowstoneHoe = new ItemMekanismHoe(11444, toolGLOWSTONE).setItemName("GlowstoneHoe");
GlowstoneSword = new ItemMekanismSword(11300, toolGLOWSTONE).setItemName("GlowstoneSword"); GlowstoneSword = new ItemMekanismSword(11445, toolGLOWSTONE).setItemName("GlowstoneSword");
GlowstoneHelmet = new ItemMekanismArmor(11301, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 0).setItemName("GlowstoneHelmet"); GlowstoneHelmet = new ItemMekanismArmor(11446, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 0).setItemName("GlowstoneHelmet");
GlowstoneBody = new ItemMekanismArmor(11302, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 1).setItemName("GlowstoneBody"); GlowstoneBody = new ItemMekanismArmor(11447, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 1).setItemName("GlowstoneBody");
GlowstoneLegs = new ItemMekanismArmor(11303, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 2).setItemName("GlowstoneLegs"); GlowstoneLegs = new ItemMekanismArmor(11448, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 2).setItemName("GlowstoneLegs");
GlowstoneBoots = new ItemMekanismArmor(11304, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 3).setItemName("GlowstoneBoots"); GlowstoneBoots = new ItemMekanismArmor(11449, armorGLOWSTONE, Mekanism.proxy.getArmorIndex("glowstone"), 3).setItemName("GlowstoneBoots");
//Base Paxels //Base Paxels
WoodPaxel = new ItemMekanismPaxel(11279, EnumToolMaterial.WOOD).setItemName("WoodPaxel"); WoodPaxel = new ItemMekanismPaxel(11450, EnumToolMaterial.WOOD).setItemName("WoodPaxel");
StonePaxel = new ItemMekanismPaxel(11280, EnumToolMaterial.STONE).setItemName("StonePaxel"); StonePaxel = new ItemMekanismPaxel(11451, EnumToolMaterial.STONE).setItemName("StonePaxel");
IronPaxel = new ItemMekanismPaxel(11281, EnumToolMaterial.IRON).setItemName("IronPaxel"); IronPaxel = new ItemMekanismPaxel(11452, EnumToolMaterial.IRON).setItemName("IronPaxel");
DiamondPaxel = new ItemMekanismPaxel(11282, EnumToolMaterial.EMERALD).setItemName("DiamondPaxel"); DiamondPaxel = new ItemMekanismPaxel(11453, EnumToolMaterial.EMERALD).setItemName("DiamondPaxel");
GoldPaxel = new ItemMekanismPaxel(11283, EnumToolMaterial.GOLD).setItemName("GoldPaxel"); GoldPaxel = new ItemMekanismPaxel(11454, EnumToolMaterial.GOLD).setItemName("GoldPaxel");
//Knives //Knives
WoodKnife = new ItemMekanismKnife(11284, EnumToolMaterial.WOOD).setItemName("WoodKnife"); WoodKnife = new ItemMekanismKnife(11455, EnumToolMaterial.WOOD).setItemName("WoodKnife");
StoneKnife = new ItemMekanismKnife(11285, EnumToolMaterial.STONE).setItemName("StoneKnife"); StoneKnife = new ItemMekanismKnife(11456, EnumToolMaterial.STONE).setItemName("StoneKnife");
IronKnife = new ItemMekanismKnife(11286, EnumToolMaterial.IRON).setItemName("IronKnife"); IronKnife = new ItemMekanismKnife(11457, EnumToolMaterial.IRON).setItemName("IronKnife");
DiamondKnife = new ItemMekanismKnife(11287, EnumToolMaterial.EMERALD).setItemName("DiamondKnife"); DiamondKnife = new ItemMekanismKnife(11458, EnumToolMaterial.EMERALD).setItemName("DiamondKnife");
GoldKnife = new ItemMekanismKnife(11288, EnumToolMaterial.GOLD).setItemName("GoldKnife"); GoldKnife = new ItemMekanismKnife(11459, EnumToolMaterial.GOLD).setItemName("GoldKnife");
ObsidianKnife = new ItemMekanismKnife(11289, toolOBSIDIAN).setItemName("ObsidianKnife"); ObsidianKnife = new ItemMekanismKnife(11460, toolOBSIDIAN).setItemName("ObsidianKnife");
LazuliKnife = new ItemMekanismKnife(11290, toolLAZULI).setItemName("LazuliKnife"); LazuliKnife = new ItemMekanismKnife(11461, toolLAZULI).setItemName("LazuliKnife");
PlatinumKnife = new ItemMekanismKnife(11291, toolPLATINUM).setItemName("PlatinumKnife"); PlatinumKnife = new ItemMekanismKnife(11462, toolPLATINUM).setItemName("PlatinumKnife");
RedstoneKnife = new ItemMekanismKnife(11292, toolREDSTONE).setItemName("RedstoneKnife"); RedstoneKnife = new ItemMekanismKnife(11463, toolREDSTONE).setItemName("RedstoneKnife");
GlowstoneKnife = new ItemMekanismKnife(11305, toolGLOWSTONE).setItemName("GlowstoneKnife"); GlowstoneKnife = new ItemMekanismKnife(11464, toolGLOWSTONE).setItemName("GlowstoneKnife");
} }
public void addEntities() public void addEntities()

View file

@ -55,6 +55,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/terrain.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/terrain.png");
//Preload animated textures //Preload animated textures
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CrusherFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CompressorFront.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CompressorFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CombinerFront.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CombinerFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerFront.png"); MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerFront.png");
@ -63,11 +64,12 @@ public class ClientProxy extends CommonProxy
//Register animated TextureFX //Register animated TextureFX
try { try {
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CompressorFront.png", Mekanism.ANIMATED_TEXTURE_INDEX)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CrusherFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+1));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CombinerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+1)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CompressorFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+2));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+2)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CombinerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+3));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerBack.png", Mekanism.ANIMATED_TEXTURE_INDEX+3)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+4));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+4)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerBack.png", Mekanism.ANIMATED_TEXTURE_INDEX+5));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+6));
} catch (IOException e) { } catch (IOException e) {
System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage()); System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage());
} }

View file

@ -3,6 +3,8 @@ package mekanism.client;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import cpw.mods.fml.client.FMLClientHandler;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.src.Block; import net.minecraft.src.Block;
@ -74,7 +76,9 @@ public class Sound
soundSystem.activate(id); soundSystem.activate(id);
} }
/** Start looping the sound effect */ /**
* Start looping the sound effect
*/
public void play() public void play()
{ {
if(isPlaying) if(isPlaying)
@ -86,7 +90,9 @@ public class Sound
isPlaying = true; isPlaying = true;
} }
/** Stop looping the sound effect */ /**
* Stop looping the sound effect
*/
public void stop() public void stop()
{ {
if(!isPlaying) if(!isPlaying)
@ -98,7 +104,9 @@ public class Sound
isPlaying = false; isPlaying = false;
} }
/** Remove the sound effect from the PaulsCode SoundSystem */ /**
* Remove the sound effect from the PaulsCode SoundSystem
*/
public void remove() public void remove()
{ {
if(isPlaying) if(isPlaying)
@ -124,8 +132,7 @@ public class Sound
} }
double distanceVolume = entityplayer.getDistanceSq(xCoord, yCoord, zCoord)*0.01; double distanceVolume = entityplayer.getDistanceSq(xCoord, yCoord, zCoord)*0.01;
volume = (float)Math.max(Mekanism.audioHandler.masterVolume-distanceVolume, 0);
volume = (float)Math.max(1.0F-distanceVolume, 0);
soundSystem.setVolume(identifier, volume); soundSystem.setVolume(identifier, volume);
} }

View file

@ -21,6 +21,8 @@ public class SoundHandler
public List<Sound> sounds = new ArrayList<Sound>(); public List<Sound> sounds = new ArrayList<Sound>();
public float masterVolume = 0;
/** SoundHandler -- a class that handles all Sounds used by Mekanism. */ /** SoundHandler -- a class that handles all Sounds used by Mekanism. */
public SoundHandler() public SoundHandler()
{ {
@ -35,8 +37,11 @@ public class SoundHandler
{ {
for(Sound sound : sounds) for(Sound sound : sounds)
{ {
if(FMLClientHandler.instance().getClient().theWorld != null && FMLClientHandler.instance().getClient().thePlayer != null)
sound.updateVolume(FMLClientHandler.instance().getClient().thePlayer); sound.updateVolume(FMLClientHandler.instance().getClient().thePlayer);
} }
masterVolume = FMLClientHandler.instance().getClient().gameSettings.soundVolume;
} }
/** Create and return an instance of a Sound. /** Create and return an instance of a Sound.

View file

@ -40,8 +40,8 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
//Register animated TextureFX //Register animated TextureFX
try { try {
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+5)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+7));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+6)); TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/HydrogenSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+8));
} catch (IOException e) { } catch (IOException e) {
System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage()); System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage());
} }