mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 22:44:34 +00:00
Upgraded farms now use more power continuously
Farmer harvesting logs now uses more power than harvesting other crops (values in config)
This commit is contained in:
1 parent
57486cf833
commit
7a22a99076
8 files changed
+44
-26
No files matched your search
@@ -206,6 +206,8 @@ public final class Config {
|
||||
|
||||
public static float farmContinuousEnergyUse = 4;
|
||||
public static float farmActionEnergyUse = 50;
|
||||
public static float farmAxeActionEnergyUse = 100;
|
||||
|
||||
public static int farmDefaultSize = 3;
|
||||
public static boolean farmAxeDamageOnLeafBreak = false;
|
||||
public static float farmToolTakeDamageChance = 1;
|
||||
@@ -620,6 +622,10 @@ public final class Config {
|
||||
"The amount of power used by a farm per tick ").getDouble(farmContinuousEnergyUse);
|
||||
farmActionEnergyUse = (float) config.get(sectionFarm.name, "farmActionEnergyUse", farmActionEnergyUse,
|
||||
"The amount of power used by a farm per action (eg plant, till, harvest) ").getDouble(farmActionEnergyUse);
|
||||
|
||||
farmAxeActionEnergyUse= (float) config.get(sectionFarm.name, "farmAxeActionEnergyUse", farmAxeActionEnergyUse,
|
||||
"The amount of power used by a farm per wood block 'chopped'").getDouble(farmAxeActionEnergyUse);
|
||||
|
||||
farmDefaultSize = config.get(sectionFarm.name, "farmDefaultSize", farmDefaultSize,
|
||||
"The number of blocks a farm will extend from its center").getInt(farmDefaultSize);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
* IEntitySelector
|
||||
*/{
|
||||
|
||||
private static final float ENERGY_PER_TICK = Config.farmContinuousEnergyUse;
|
||||
// private static final float ENERGY_PER_TICK = Config.farmContinuousEnergyUse;
|
||||
|
||||
private BlockCoord lastScanned;
|
||||
private EntityPlayerMP farmerJoe;
|
||||
@@ -55,8 +55,6 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
|
||||
private final int upgradeBonusSize = 2;
|
||||
|
||||
private static final DummyTask TASK = new DummyTask();
|
||||
|
||||
private ICapacitor cap = new BasicCapacitor(200, 25000);
|
||||
|
||||
public int tier = 1;
|
||||
@@ -66,7 +64,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
|
||||
public TileFarmStation() {
|
||||
super(new SlotDefinition(6, 4, 1));
|
||||
currentTask = TASK;
|
||||
currentTask = createTask();
|
||||
powerHandler = PowerHandlerUtil.createHandler(cap, this, Type.MACHINE);
|
||||
|
||||
}
|
||||
@@ -75,12 +73,12 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
return farmSize + getUpgradeDist();
|
||||
}
|
||||
|
||||
public void setFarmSize(int farmSize) {
|
||||
this.farmSize = farmSize;
|
||||
}
|
||||
|
||||
public void actionPerformed() {
|
||||
usePower(Config.farmActionEnergyUse * (getUpgradeDist() * upgradeBonusSize));
|
||||
public void actionPerformed(boolean isAxe) {
|
||||
if(isAxe) {
|
||||
usePower(Config.farmAxeActionEnergyUse);
|
||||
} else {
|
||||
usePower(Config.farmActionEnergyUse);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tillBlock(BlockCoord plantingLocation) {
|
||||
@@ -91,7 +89,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
worldObj.setBlock(dirtLoc.x, dirtLoc.y, dirtLoc.z, Blocks.farmland);
|
||||
worldObj.playSoundEffect(dirtLoc.x + 0.5F, dirtLoc.y + 0.5F, dirtLoc.z + 0.5F, Blocks.farmland.stepSound.getStepResourcePath(),
|
||||
(Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F);
|
||||
actionPerformed();
|
||||
actionPerformed(false);
|
||||
return true;
|
||||
} else if(dirtBlock == Blocks.farmland) {
|
||||
return true;
|
||||
@@ -510,6 +508,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
|
||||
@Override
|
||||
public void setCapacitor(Capacitors capacitorType) {
|
||||
this.capacitorType = capacitorType;
|
||||
switch (capacitorType.ordinal()) {
|
||||
case 1:
|
||||
cap = new BasicCapacitor(400, 50000);
|
||||
@@ -523,6 +522,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
}
|
||||
tier = capacitorType.ordinal();
|
||||
powerHandler.configure(cap.getMinEnergyReceived(), cap.getMaxEnergyReceived(), cap.getMinActivationEnergy(), cap.getMaxEnergyStored());
|
||||
currentTask = createTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -532,13 +532,18 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
|
||||
@Override
|
||||
public float getPowerUsePerTick() {
|
||||
return ENERGY_PER_TICK;
|
||||
return Math.round(Config.farmContinuousEnergyUse * (getFarmSize()/(float)Config.farmDefaultSize ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.readCustomNBT(nbtRoot);
|
||||
currentTask = TASK;
|
||||
currentTask = createTask();
|
||||
|
||||
}
|
||||
|
||||
IPoweredTask createTask() {
|
||||
return new DummyTask(getPowerUsePerTick());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -548,6 +553,13 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
}
|
||||
|
||||
private static class DummyTask implements IPoweredTask {
|
||||
|
||||
float powerUserPerTick;
|
||||
|
||||
public DummyTask(float powerUsePerTick) {
|
||||
this.powerUserPerTick = powerUsePerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
}
|
||||
@@ -563,7 +575,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*
|
||||
|
||||
@Override
|
||||
public float getRequiredEnergy() {
|
||||
return ENERGY_PER_TICK;
|
||||
return powerUserPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,7 +128,7 @@ public class CustomSeedFarmer implements IFarmerJoe {
|
||||
|
||||
ArrayList<ItemStack> drops = block.getDrops(worldObj, bc.x, bc.y, bc.z, meta, farm.getMaxLootingValue());
|
||||
farm.damageMaxLootingItem(1, bc, block);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
boolean removed = false;
|
||||
if(drops != null) {
|
||||
for (ItemStack stack : drops) {
|
||||
@@ -167,7 +167,7 @@ public class CustomSeedFarmer implements IFarmerJoe {
|
||||
worldObj.setBlock(dirtLoc.x, dirtLoc.y, dirtLoc.z, Blocks.farmland);
|
||||
worldObj.playSoundEffect(dirtLoc.x + 0.5F, dirtLoc.y + 0.5F, dirtLoc.z + 0.5F, Blocks.farmland.stepSound.getStepResourcePath(),
|
||||
(Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -199,7 +199,7 @@ public class CustomSeedFarmer implements IFarmerJoe {
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
|
||||
if(canPlant(worldObj, bc)) {
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, getPlantedBlock(), getPlantedBlockMeta(), 1 | 2);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NaturaBerryFarmer extends PickableFarmer {
|
||||
for(EntityItem stack : addToDrops) {
|
||||
res.getDrops().add(stack);
|
||||
}
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
farm.damageMaxLootingItem(1, checkBlock, farm.getBlock(checkBlock));
|
||||
}
|
||||
checkBlock = checkBlock.getLocation(ForgeDirection.UP);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PickableFarmer extends CustomSeedFarmer {
|
||||
drops.add(entityitem);
|
||||
}
|
||||
}
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
farm.damageMaxLootingItem(1, bc, block);
|
||||
return new HarvestResult(drops, bc);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
Block target = plantable.getPlant(null, 0, 0, 0);
|
||||
int meta = plantable.getPlantMetadata(null, 0, 0, 0);
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, target, meta, 1 | 2);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
|
||||
ArrayList<ItemStack> drops = block.getDrops(worldObj, bc.x, bc.y, bc.z, meta, farm.getMaxLootingValue());
|
||||
farm.damageMaxLootingItem(1, bc, block);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
boolean removed = false;
|
||||
if(drops != null) {
|
||||
for (ItemStack stack : drops) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StemFarmer extends CustomSeedFarmer {
|
||||
|
||||
}
|
||||
farm.damageMaxLootingItem(1, harvestCoord, farm.getBlock(harvestCoord));
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
farm.getWorld().setBlockToAir(harvestCoord.x, harvestCoord.y, harvestCoord.z);
|
||||
} else {
|
||||
done = true;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TreeFarmer implements IFarmerJoe {
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
|
||||
if(canPlant(worldObj, bc)) {
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, sapling, seed.getItemDamage(), 1 | 2);
|
||||
farm.actionPerformed();
|
||||
farm.actionPerformed(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -125,9 +125,9 @@ public class TreeFarmer implements IFarmerJoe {
|
||||
if(farm.getWorldObj().rand.nextInt(200) == 0) {
|
||||
res.drops.add(new EntityItem(farm.getWorld(), bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, new ItemStack(Items.apple)));
|
||||
}
|
||||
}
|
||||
}
|
||||
farm.actionPerformed();
|
||||
}
|
||||
}
|
||||
farm.actionPerformed(isWood);
|
||||
if(isWood) {
|
||||
farm.damageAxe(blk, coord);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user