Started implementing UE 3.0

This commit is contained in:
Calclavia 2013-12-20 16:29:13 +08:00
parent d106f72d81
commit 3f2e74299b
5 changed files with 29 additions and 37 deletions

View file

@ -44,11 +44,11 @@ import resonantinduction.wire.TileEntityWire;
import universalelectricity.compatibility.Compatibility;
import universalelectricity.core.item.IItemElectric;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.TranslationHelper;
import basiccomponents.api.BasicRegistry;
import calclavia.lib.UniversalRecipe;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.network.PacketTile;
import calclavia.lib.prefab.TranslationHelper;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
@ -117,7 +117,7 @@ public class ResonantInduction
* Settings
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
public static float FURNACE_WATTAGE = 10;
public static int FURNACE_WATTAGE = 10000;
public static boolean SOUND_FXS = true;
public static boolean LO_FI_INSULATION = false;
public static boolean SHINY_SILVER = true;
@ -176,7 +176,7 @@ public class ResonantInduction
CONFIGURATION.load();
// Config
FURNACE_WATTAGE = (float) CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage Per Tick", FURNACE_WATTAGE).getDouble(FURNACE_WATTAGE);
FURNACE_WATTAGE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage Per Tick", FURNACE_WATTAGE).getInt(FURNACE_WATTAGE);
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
LO_FI_INSULATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Use lo-fi insulation texture", LO_FI_INSULATION).getBoolean(LO_FI_INSULATION);
SHINY_SILVER = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER);

View file

@ -24,10 +24,10 @@ import net.minecraftforge.fluids.IFluidBlock;
import resonantinduction.ResonantInduction;
import resonantinduction.tesla.TileEntityTesla;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import calclavia.lib.InventoryHelper;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import calclavia.lib.prefab.tile.TileEntityAdvanced;
import com.google.common.io.ByteArrayDataInput;

View file

@ -1,13 +1,15 @@
package resonantinduction.furnace;
import resonantinduction.ResonantInduction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction;
import universalelectricity.api.IEnergyInterface;
import universalelectricity.api.IVoltage;
import universalelectricity.api.UniversalClass;
import universalelectricity.core.block.IConductor;
import universalelectricity.core.block.IElectrical;
import universalelectricity.core.electricity.ElectricityHelper;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.grid.IElectricityNetwork;
@ -20,12 +22,13 @@ import universalelectricity.core.vector.VectorHelper;
* @author Calclavia
*
*/
public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IElectrical
@UniversalClass
public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEnergyInterface, IVoltage
{
private static final float WATTAGE = 5;
private boolean doProduce = false;
private boolean init = true;
private float energyBuffer = 0;
private int energyBuffer = 0;
@Override
public void updateEntity()
@ -94,7 +97,8 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
if (doBlockStateUpdate != this.furnaceBurnTime > 0)
{
//BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
// BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0,
// this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.refreshConductors();
}
}
@ -144,7 +148,7 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
{
if (!this.worldObj.isRemote && outputDirection != null && outputDirection != ForgeDirection.UNKNOWN)
{
float provide = this.getProvide(outputDirection);
float provide = this.onReceiveEnergy(null, Integer.MAX_VALUE, false);
if (provide > 0)
{
@ -157,9 +161,9 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
if (powerRequest.getWatts() > 0)
{
ElectricityPack sendPack = ElectricityPack.getFromWatts(provide, this.getVoltage());
ElectricityPack sendPack = ElectricityPack.getFromWatts(provide, this.getVoltage(null));
float rejectedPower = outputNetwork.produce(sendPack, this);
this.provideElectricity(outputDirection.getOpposite(), ElectricityPack.getFromWatts(sendPack.getWatts() - rejectedPower, this.getVoltage()), true);
this.onExtractEnergy(outputDirection.getOpposite(), (int) (sendPack.getWatts() - rejectedPower), true);
}
return true;
@ -197,28 +201,16 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
}
@Override
public float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive)
{
if (doReceive)
{
this.energyBuffer += receive.getWatts();
return 0;
}
return receive.getWatts();
}
@Override
public ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide)
{
return ElectricityPack.getFromWatts(ResonantInduction.FURNACE_WATTAGE / 20, this.getVoltage());
}
@Override
public float getRequest(ForgeDirection direction)
public int onReceiveEnergy(ForgeDirection from, int receive, boolean doReceive)
{
if (this.canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0)
{
if (doReceive)
{
this.energyBuffer += receive;
return receive;
}
return ResonantInduction.FURNACE_WATTAGE / 20;
}
@ -226,7 +218,7 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
}
@Override
public float getProvide(ForgeDirection direction)
public int onExtractEnergy(ForgeDirection from, int request, boolean doProvide)
{
if (this.furnaceBurnTime > 0)
{
@ -237,9 +229,9 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
}
@Override
public float getVoltage()
public int getVoltage(ForgeDirection direction)
{
return 0.12f;
return 100;
}
}

View file

@ -19,12 +19,12 @@ import universalelectricity.core.block.IConductor;
import universalelectricity.core.block.IConnector;
import universalelectricity.core.block.IElectricalStorage;
import universalelectricity.core.grid.IElectricityNetwork;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import universalelectricity.prefab.tile.TileEntityElectrical;
import buildcraft.api.power.IPowerReceptor;
import calclavia.lib.IRotatable;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import calclavia.lib.prefab.tile.TileEntityAdvanced;
import calclavia.lib.prefab.tile.TileEntityElectrical;
import cofh.api.energy.TileEnergyHandler;
import com.google.common.io.ByteArrayDataInput;

View file

@ -2,6 +2,7 @@ package resonantinduction.wire;
import java.util.List;
import calclavia.lib.prefab.block.BlockConductor;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.block.material.Material;
@ -13,7 +14,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonantinduction.ResonantInduction;
import resonantinduction.TabRI;
import universalelectricity.prefab.block.BlockConductor;
/**
* A copper wire block that can change its collision bounds based on the connection.