aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities
diff options
context:
space:
mode:
authorJordan Byrne <draknyte1@hotmail.com>2018-02-14 18:23:41 +1000
committerJordan Byrne <draknyte1@hotmail.com>2018-02-14 18:23:41 +1000
commit6858a01769a5875e722eca0d309dd2d020d331d1 (patch)
treec9f511320e1c5fdd0e456d619dd38be2a03bc132 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities
parent6bd0c3409c4b1820fc40afabc4d55405b22e1c08 (diff)
downloadGT5-Unofficial-6858a01769a5875e722eca0d309dd2d020d331d1.tar.gz
GT5-Unofficial-6858a01769a5875e722eca0d309dd2d020d331d1.tar.bz2
GT5-Unofficial-6858a01769a5875e722eca0d309dd2d020d331d1.zip
$ Fixed Tree Farm not using internal power storage.
$ Improved mapping of log cutting targets.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
index 30a4035366..6cb0e4ebb3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
@@ -85,6 +85,27 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
}
@Override
+ public boolean drainEnergyInput(final long aEU) {
+ if (aEU <= 0L) {
+ return true;
+ }
+
+ //Special Override, so that this function uses internally stored power first.
+ if (this.getEUVar() >= aEU) {
+ this.setEUVar(this.getEUVar()-aEU);
+ return true;
+ }
+
+ for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
+ if (isValidMetaTileEntity((MetaTileEntity) tHatch)
+ && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == 0) {
return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log)};
@@ -195,7 +216,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
@Override
public boolean onRunningTick(final ItemStack aStack) {
//Logger.INFO("s");
-
+
return super.onRunningTick(aStack);
}
@@ -204,8 +225,8 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
//Do Main Multi Logic first
super.onPostTick(aBaseMetaTileEntity, aTick);
- //Do Tree Farm logic next on server side
- if (aBaseMetaTileEntity.isServerSide()) {
+ //Do Tree Farm logic next on server side, once per second
+ if (aBaseMetaTileEntity.isServerSide() && (aTick % 20 == 0)) {
//Simple Repairs for a simple machine
if (isCurrentlyWorking()) {
@@ -229,16 +250,17 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
}
}
-
+
//Try Work
- BlockPos t;
- if ((t = TreeFarmHelper.checkForLogsInGrowArea(this.getBaseMetaTileEntity())) != null) {
- Logger.INFO("Lets try find new logs/branches.");
- TreeFarmHelper.findTreeFromBase(this.getBaseMetaTileEntity().getWorld(), t);
+ if (this.drainEnergyInput(32)) {
+ BlockPos t;
+ if ((t = TreeFarmHelper.checkForLogsInGrowArea(this.getBaseMetaTileEntity())) != null) {
+ //Logger.INFO("Lets try find new logs/branches.");
+ TreeFarmHelper.findTreeFromBase(this.getBaseMetaTileEntity().getWorld(), t);
+ }
}
-
}
}