Updated UE and standardized ratio

This commit is contained in:
Calclavia 2013-12-21 11:10:21 +08:00
parent a499f5781e
commit 49668fb60a
3 changed files with 73 additions and 28 deletions

View file

@ -114,7 +114,7 @@ public class ResonantInduction
* Settings
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static int FURNACE_WATTAGE = 10000;
public static int FURNACE_WATTAGE = 50000;
public static boolean SOUND_FXS = true;
public static boolean LO_FI_INSULATION = false;
public static boolean SHINY_SILVER = true;

View file

@ -1,5 +1,6 @@
package resonantinduction.furnace;
import net.minecraft.block.BlockFurnace;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntity;
@ -31,9 +32,10 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
@Override
public void updateEntity()
{
boolean doSmeltingProcess = canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0;
boolean canSmelt = canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0;
boolean canBurn = this.getStackInSlot(0) == null && TileEntityFurnace.getItemBurnTime(this.getStackInSlot(1)) > 0;
if (doSmeltingProcess)
if (canSmelt)
{
if (this.energy.checkExtract(ResonantInduction.FURNACE_WATTAGE / 20))
{
@ -49,7 +51,7 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
this.energy.extractEnergy(ResonantInduction.FURNACE_WATTAGE / 20, true);
}
}
else if (this.getStackInSlot(0) == null && TileEntityFurnace.getItemBurnTime(this.getStackInSlot(1)) > 0 && !this.energy.isFull())
else if (!this.energy.isFull())
{
boolean doBlockStateUpdate = this.furnaceBurnTime > 0;
@ -72,8 +74,63 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
}
else
{
// TODO: Fix vanilla changing the blockID of this furnace.
super.updateEntity();
boolean flag = this.furnaceBurnTime > 0;
boolean flag1 = false;
if (this.furnaceBurnTime > 0)
{
--this.furnaceBurnTime;
}
if (!this.worldObj.isRemote)
{
if (this.furnaceBurnTime == 0 && this.canSmelt())
{
this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.getStackInSlot(1));
if (this.furnaceBurnTime > 0)
{
flag1 = true;
if (this.getStackInSlot(1) != null)
{
--this.getStackInSlot(1).stackSize;
if (this.getStackInSlot(1).stackSize == 0)
{
this.setInventorySlotContents(1, this.getStackInSlot(1).getItem().getContainerItemStack(this.getStackInSlot(1)));
}
}
}
}
if (this.isBurning() && this.canSmelt())
{
++this.furnaceCookTime;
if (this.furnaceCookTime == 200)
{
this.furnaceCookTime = 0;
this.smeltItem();
flag1 = true;
}
}
else
{
this.furnaceCookTime = 0;
}
if (flag != this.furnaceBurnTime > 0)
{
flag1 = true;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
if (flag1)
{
this.onInventoryChanged();
}
}
}
@ -136,7 +193,7 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
}
@Override
public int onReceiveEnergy(ForgeDirection from, int receive, boolean doReceive)
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
if (this.canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0)
{
@ -147,13 +204,13 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEne
}
@Override
public int onExtractEnergy(ForgeDirection from, int request, boolean doProvide)
public long onExtractEnergy(ForgeDirection from, long request, boolean doProvide)
{
return this.energy.extractEnergy(request, doProvide);
}
@Override
public int getVoltage(ForgeDirection direction)
public long getVoltage(ForgeDirection direction)
{
return 100;
}

View file

@ -1,5 +1,7 @@
package resonantinduction.wire;
import resonantinduction.ResonantInduction;
import calclavia.lib.prefab.block.EnergyStorage;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.IConnector;
@ -17,36 +19,22 @@ import codechicken.multipart.TileMultipart;
public abstract class PartConductor extends PartAdvanced implements IConductor
{
private IEnergyNetwork network;
private int buffer = 0;
private EnergyStorage buffer = new EnergyStorage(ResonantInduction.FURNACE_WATTAGE * 5);
public TileEntity[] adjacentConnections = null;
public byte currentWireConnections = 0x00;
public byte currentAcceptorConnections = 0x00;
@Override
public int onReceiveEnergy(ForgeDirection from, int receive, boolean doReceive)
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
int energyReceived = Math.min(this.getEnergyCapacitance() - this.buffer, receive);
if (doReceive)
{
this.buffer += energyReceived;
}
return energyReceived;
return buffer.receiveEnergy(receive, doReceive);
}
@Override
public int onExtractEnergy(ForgeDirection from, int request, boolean doExtract)
public long onExtractEnergy(ForgeDirection from, long request, boolean doExtract)
{
int energyExtracted = Math.min(this.buffer, request);
if (doExtract)
{
this.buffer -= energyExtracted;
}
return energyExtracted;
return buffer.extractEnergy(request, doExtract);
}
@Override