Fixed generator direction and creative battery

This commit is contained in:
Calclavia 2014-01-19 20:54:36 +08:00
parent a3122c7e0f
commit 2bbc93b70a
4 changed files with 16 additions and 14 deletions

View file

@ -33,6 +33,7 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage
@Override @Override
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean par4) public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean par4)
{ {
list.add("Tier: " + (getTier(itemStack) + 1));
String color = ""; String color = "";
long joules = this.getEnergy(itemStack); long joules = this.getEnergy(itemStack);
@ -168,7 +169,7 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage
@Override @Override
public long getEnergyCapacity(ItemStack theItem) public long getEnergyCapacity(ItemStack theItem)
{ {
return TileBattery.getEnergyForTier(theItem.getItemDamage() + 1); return TileBattery.getEnergyForTier(getTier(theItem));
} }
public long getTransferRate(ItemStack itemStack) public long getTransferRate(ItemStack itemStack)
@ -182,9 +183,8 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage
{ {
for (byte tier = 0; tier < 3; tier++) for (byte tier = 0; tier < 3; tier++)
{ {
par3List.add(setTier(new ItemStack(this, 1), tier)); par3List.add(CompatibilityModule.getItemWithCharge(setTier(new ItemStack(this), tier), 0));
par3List.add(setTier(CompatibilityModule.getItemWithCharge(new ItemStack(this, 1, 0), this.getEnergyCapacity(new ItemStack(this, 1, 0))), tier)); par3List.add(CompatibilityModule.getItemWithCharge(setTier(new ItemStack(this), tier), TileBattery.getEnergyForTier(tier)));
} }
} }
} }

View file

@ -45,25 +45,26 @@ public class TileGenerator extends TileElectrical implements IMechanical, IRotat
} }
else else
{ {
produceMechanical(new Vector3(this).modifyPositionFromSide(this.getDirection())); produceMechanical(this.getDirection());
produceMechanical(new Vector3(this).modifyPositionFromSide(this.getDirection().getOpposite())); produceMechanical(this.getDirection().getOpposite());
} }
} }
} }
public void produceMechanical(Vector3 outputVector) public void produceMechanical(ForgeDirection outputDir)
{ {
Vector3 outputVector = new Vector3(this).modifyPositionFromSide(outputDir);
TileEntity mechanical = outputVector.getTileEntity(worldObj); TileEntity mechanical = outputVector.getTileEntity(worldObj);
if (mechanical instanceof IMechanical) if (mechanical instanceof IMechanical)
{ {
long extract = energy.extractEnergy(); long extract = energy.extractEnergy(false);
if (extract > 0) if (extract > 0)
{ {
float angularVelocity = extract / torqueRatio; float angularVelocity = extract / torqueRatio;
long torque = (long) (extract / angularVelocity); long torque = (long) (extract / angularVelocity);
((IMechanical) mechanical).onReceiveEnergy(this.getDirection().getOpposite(), torque, angularVelocity, true); energy.extractEnergy(((IMechanical) mechanical).onReceiveEnergy(outputDir.getOpposite(), torque, angularVelocity, true), true);
} }
} }
} }

View file

@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import resonantinduction.mechanical.Mechanical; import resonantinduction.mechanical.Mechanical;
import resonantinduction.mechanical.network.IMechanicalConnector;
import resonantinduction.mechanical.network.PartMechanical; import resonantinduction.mechanical.network.PartMechanical;
import codechicken.lib.vec.Vector3; import codechicken.lib.vec.Vector3;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -15,7 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author Calclavia * @author Calclavia
* *
*/ */
public class PartGear extends PartMechanical public class PartGear extends PartMechanical implements IMechanicalConnector
{ {
private int manualCrankTime = 0; private int manualCrankTime = 0;

View file

@ -269,11 +269,11 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
{ {
if (isPositive) if (isPositive)
{ {
((PartMechanical) neighbor).isClockwise = isClockwise; ((PartMechanical) neighbor).setClockwise(isClockwise);
} }
else else
{ {
((PartMechanical) neighbor).isClockwise = !isClockwise; ((PartMechanical) neighbor).setClockwise(!isClockwise);
} }
neighbor.markRotationUpdate = true; neighbor.markRotationUpdate = true;