Config values for Contractor, began work on energy usage
This commit is contained in:
parent
32cbb970f4
commit
3e194f16e4
2 changed files with 39 additions and 1 deletions
|
@ -120,6 +120,11 @@ public class ResonantInduction
|
|||
// Config
|
||||
POWER_PER_COAL = (float) CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Coal Wattage", POWER_PER_COAL).getDouble(POWER_PER_COAL);
|
||||
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
|
||||
|
||||
TileEntityEMContractor.ACCELERATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", TileEntityEMContractor.ACCELERATION).getDouble(TileEntityEMContractor.ACCELERATION);
|
||||
TileEntityEMContractor.MAX_REACH = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Reach", TileEntityEMContractor.MAX_REACH).getInt(TileEntityEMContractor.MAX_REACH);
|
||||
TileEntityEMContractor.MAX_SPEED = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Speed", TileEntityEMContractor.MAX_SPEED).getDouble(TileEntityEMContractor.MAX_SPEED);
|
||||
TileEntityEMContractor.PUSH_DELAY = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Push Delay", TileEntityEMContractor.PUSH_DELAY).getInt(TileEntityEMContractor.PUSH_DELAY);
|
||||
|
||||
// Items
|
||||
itemQuantumEntangler = new ItemQuantumEntangler(getNextItemID());
|
||||
|
|
|
@ -13,20 +13,29 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.PacketHandler;
|
||||
import resonantinduction.api.ITesla;
|
||||
import resonantinduction.base.IPacketReceiver;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityEMContractor extends TileEntity implements IPacketReceiver
|
||||
/**
|
||||
*
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class TileEntityEMContractor extends TileEntity implements IPacketReceiver, ITesla
|
||||
{
|
||||
public static int MAX_REACH = 40;
|
||||
public static int PUSH_DELAY = 5;
|
||||
public static double MAX_SPEED = .1;
|
||||
public static double ACCELERATION = .01;
|
||||
public static float ENERGY_USAGE = .005F;
|
||||
|
||||
private ForgeDirection facing = ForgeDirection.UP;
|
||||
|
||||
public int pushDelay;
|
||||
|
||||
public float energyStored;
|
||||
|
||||
public AxisAlignedBB operationBounds;
|
||||
public AxisAlignedBB suckBounds;
|
||||
|
@ -460,6 +469,11 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
|||
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
public boolean canFunction()
|
||||
{
|
||||
return energyStored == ENERGY_USAGE && worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
|
@ -501,4 +515,23 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
|
|||
data.add(suck);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float transfer(float transferEnergy, boolean doTransfer)
|
||||
{
|
||||
float energyToUse = Math.min(transferEnergy, energyStored-ENERGY_USAGE);
|
||||
|
||||
if(doTransfer)
|
||||
{
|
||||
energyStored += energyToUse;
|
||||
}
|
||||
|
||||
return energyToUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceive(TileEntity transferTile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue