aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-30 02:18:50 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-30 02:18:50 +0000
commit7832b6223896af1b1435cdfeb52ce0210bfd2203 (patch)
tree495a4e090f0bfadbb31e3718e50e2fc7ae5e0230 /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom
parent222fbc044f89a2d272f0bace58c28db1e6927e0f (diff)
downloadGT5-Unofficial-7832b6223896af1b1435cdfeb52ce0210bfd2203.tar.gz
GT5-Unofficial-7832b6223896af1b1435cdfeb52ce0210bfd2203.tar.bz2
GT5-Unofficial-7832b6223896af1b1435cdfeb52ce0210bfd2203.zip
$ Fixed 'bug' where GT wooden Pipes/Frames would require an Axe to harvest. They now require a wrench, freeing up 4 MetaIDs on BlockMachines for myself to use.
$ Fixed handling of custom BaseMetaTileEntity implementations. Meta 12-15 is now used by GT++ to deploy custom without requiring any outside items or blocks. $ Fixed IC2 items requiring a pickaxe to mine and shitty wrench handling. You can now just mine them as usual with a wrench. $ Fixed ALL GT/GT++ Tile Entity Tooltips. Formatted some things slighty, added additional information and additional custom tooltip support.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java59
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java7
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java15
3 files changed, 40 insertions, 41 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java
index e39c65b82f..0b8cb10606 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java
@@ -8,50 +8,36 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BaseCustomPower_MTE extends BaseCustomTileEntity {
- public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- //Logger.INFO("Injecting Energy Units");
-
+ public BaseCustomPower_MTE() {
+ super();
+ Logger.INFO("Created new BaseCustomPower_MTE");
+ }
+
+ public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
if (mMetaTileEntity == null) {
- Logger.INFO("Bad Tile");
-
- }
-
+ Logger.MACHINE_INFO("Bad Tile");
+ }
if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L
&& aVoltage > 0L && this.getStoredEU() < this.getEUCapacity()
- && this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes) {
- Logger.INFO("Injecting Energy Units");
- if (aVoltage > this.getInputVoltage()) {
- this.doExplosion(aVoltage);
- return 0L;
- } else if (this
- .increaseStoredEnergyUnits(
- aVoltage * (aAmperage = Math
- .min(aAmperage,
- Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes,
- 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))),
- true)) {
- Logger.INFO("Injecting Energy Units");
- this.mAverageEUInput[this.mAverageEUInputIndex] = (int) ((long) this.mAverageEUInput[this.mAverageEUInputIndex]
- + aVoltage * aAmperage);
- this.mAcceptedAmperes += aAmperage;
- return aAmperage;
- } else {
- return 0L;
- }
+ && this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()) {
+ Logger.MACHINE_INFO("Injecting Energy Units");
+ return super.injectEnergyUnits(aSide, aVoltage, aAmperage);
} else {
- Logger.INFO("canAccessData(): "+canAccessData());
- Logger.INFO("isElectric(): "+this.mMetaTileEntity.isElectric());
- Logger.INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide));
- Logger.INFO("aAmperage: "+aAmperage);
- Logger.INFO("aVoltage: "+aVoltage);
- Logger.INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity()));
- Logger.INFO("this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes));
+ Logger.MACHINE_INFO("canAccessData(): "+canAccessData());
+ Logger.MACHINE_INFO("isElectric(): "+this.mMetaTileEntity.isElectric());
+ Logger.MACHINE_INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide));
+ Logger.MACHINE_INFO("aAmperage: "+aAmperage);
+ Logger.MACHINE_INFO("aVoltage: "+aVoltage);
+ Logger.MACHINE_INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity()));
+ Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()));
+ Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn(): "+(this.mMetaTileEntity.maxAmperesIn()));
+ Logger.MACHINE_INFO("this.mAcceptedAmperes: "+(this.getInputAmperage()));
return 0L;
}
}
public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- Logger.INFO("Draining Energy Units");
+ Logger.MACHINE_INFO("Draining Energy Units 4");
if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide)
&& this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) {
if (this.decreaseStoredEU(aVoltage * aAmperage, false)) {
@@ -68,6 +54,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity {
@Override
public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
+ Logger.MACHINE_INFO("Draining Energy Units 3");
// TODO Auto-generated method stub
return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy);
}
@@ -86,6 +73,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity {
@Override
public boolean outputsEnergyTo(byte aSide) {
+ Logger.MACHINE_INFO("Draining Energy Units 2");
// TODO Auto-generated method stub
return super.outputsEnergyTo(aSide);
}
@@ -146,6 +134,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity {
@Override
public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) {
+ Logger.MACHINE_INFO("Draining Energy Units 1");
// TODO Auto-generated method stub
return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy);
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java
index e3ab7915d2..785c4698db 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java
@@ -2,9 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
import static gregtech.api.enums.GT_Values.GT;
-import org.apache.commons.lang3.ArrayUtils;
-
-import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.ITexture;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.lib.CORE;
@@ -67,7 +64,7 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo
@Override
public byte getTileEntityBaseType() {
- return (byte) (Math.min(3, mTier <= 0 ? 0 : 1 + ((mTier - 1) / 4)));
+ return 12;
}
@Override
@@ -85,8 +82,6 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo
AutoMap<String> aTooltip = new AutoMap<String>();
String []s1 = null;
- aTooltip.put("Special GT++ Machine");
- aTooltip.put(CORE.GT_Tooltip);
s1 = new String[aTooltip.size()];
int u = 0;
for (String s : aTooltip) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java
index 3824206d24..ba98af25f7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java
@@ -3,7 +3,10 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
@@ -12,6 +15,7 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase {
public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
super(aID, aBasicName, aRegionalName, aInvSlotCount);
+ this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower());
}
public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) {
@@ -23,6 +27,12 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase {
}
public void doExplosion(long aExplosionPower) {
+
+ if (MathUtils.randInt(1, 10) > 0) {
+ Logger.INFO("Machine tried to explode, let's stop that. xo");
+ return;
+ }
+
float tStrength = aExplosionPower < GT_Values.V[0]
? 1.0F
: (aExplosionPower < GT_Values.V[1]
@@ -58,6 +68,11 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase {
@Override
public void onExplosion() {
+
+ if (MathUtils.randInt(1, 10) > 0) {
+ Logger.INFO("Machine tried to explode, let's stop that. xo");
+ return;
+ }
// TODO Auto-generated method stub
super.onExplosion();
}