aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-08-18 20:10:40 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-08-18 20:10:40 +1000
commitca1e4e052e576dde163920701a6b7e06634d4007 (patch)
treefe7a9831bdd19e52d7e7875126f68b5c110e92c2 /src/Java/gtPlusPlus/xmod
parentfb7d800252f986457f96d39931f7ab83ebb4419a (diff)
downloadGT5-Unofficial-ca1e4e052e576dde163920701a6b7e06634d4007.tar.gz
GT5-Unofficial-ca1e4e052e576dde163920701a6b7e06634d4007.tar.bz2
GT5-Unofficial-ca1e4e052e576dde163920701a6b7e06634d4007.zip
$ Fixed a rather major issue which effects all GT++ Multis. Log files should no longer grow by the gigabyte every hour.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java143
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java1
2 files changed, 35 insertions, 109 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 8706f572d6..0a039830ee 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -23,14 +23,12 @@ import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
@@ -41,13 +39,11 @@ import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
public abstract class GregtechMeta_MultiBlockBase
@@ -99,20 +95,13 @@ GT_MetaTileEntity_MultiBlockBase {
return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png");
}
}
-
- public abstract String getMachineType();
-
- public String getMachineTooltip() {
- return "Machine Type: " + EnumChatFormatting.YELLOW + getMachineType() + EnumChatFormatting.RESET;
- }
public String[] getExtraInfoData() {
return new String[0];
};
@Override
- public String[] getInfoData() {
-
+ public String[] getInfoData() {
ArrayList<String> mInfo = new ArrayList<String>();
if (!this.getMetaName().equals("")) {
mInfo.add(this.getMetaName());
@@ -136,11 +125,9 @@ GT_MetaTileEntity_MultiBlockBase {
long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
- mInfo.add(getMachineTooltip());
mInfo.add("Progress: " + Integer.toString((this.mProgresstime / 20)) +" / "+ Integer.toString((this.mMaxProgresstime / 20)) + " secs");
mInfo.add("Efficiency: " + Float.toString((this.mEfficiency / 100.0F)) + "%");
mInfo.add("Problems: " + Integer.toString((this.getIdealStatus() - this.getRepairStatus())));
- mInfo.add("Pollution: "+this.getPollutionPerTick(null)*20+"/second");
mInfo.add("Total Time Since Built: " + Integer.toString(weeks)+" Weeks, " + Integer.toString(days) + " Days, ");
mInfo.add(Long.toString(hours) + " Hours, " + Long.toString(minutes) + " Minutes, " + Long.toString(second) + " Seconds.");
mInfo.add("Total Time in ticks: " + Long.toString(this.mTotalRunTime));
@@ -258,10 +245,10 @@ GT_MetaTileEntity_MultiBlockBase {
/**
* A Static {@link Method} object which holds the current status of logging.
*/
- Method aLogger = null;
-
+ public static Method aLogger = null;
+
public void log(String s) {
- boolean isDebugLogging = false;
+ boolean isDebugLogging = CORE.DEBUG;
boolean reset = false;
if (aLogger == null || reset) {
if (isDebugLogging) {
@@ -321,7 +308,7 @@ GT_MetaTileEntity_MultiBlockBase {
getBaseMetaTileEntity(), mLastRecipe, false,
gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
- log("Running checkRecipeGeneric(1)");
+ log("Running checkRecipeGeneric(1)");
// Remember last recipe - an optimization for findRecipe()
this.mLastRecipe = tRecipe;
@@ -467,11 +454,11 @@ GT_MetaTileEntity_MultiBlockBase {
baseRecipe = tRecipe.copy();
if ((baseRecipe != null) && ((cloneRecipe != baseRecipe) || (cloneRecipe == null))) {
cloneRecipe = baseRecipe.copy();
- Logger.WARNING("Setting Recipe");
+ log("Setting Recipe");
}
if ((baseRecipe != null) && ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0))) {
cloneTime = baseRecipe.mDuration;
- Logger.WARNING("Setting Time");
+ log("Setting Time");
}
if ((cloneRecipe != null) && cloneRecipe.mDuration > 0) {
@@ -624,63 +611,6 @@ GT_MetaTileEntity_MultiBlockBase {
}
return b;
}
-
-
- public boolean resetRecipeMapForAllInputHatches() {
- return resetRecipeMapForAllInputHatches(this.getRecipeMap());
- }
-
- public boolean resetRecipeMapForAllInputHatches(GT_Recipe_Map aMap) {
- int cleared = 0;
- for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) {
- if (resetRecipeMapForHatch(g, aMap)) {
- cleared++;
- }
- }
- for (GT_MetaTileEntity_Hatch_InputBus g : this.mInputBusses) {
- if (resetRecipeMapForHatch(g, aMap)) {
- cleared++;
- }
- }
- return cleared > 0;
- }
-
- public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, GT_Recipe_Map aMap) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();;
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
- return resetRecipeMapForHatch((IGregTechTileEntity) aMetaTileEntity, aMap);
- }
- else {
- return false;
- }
- }
-
- public boolean resetRecipeMapForHatch(GT_MetaTileEntity_Hatch aTileEntity, GT_Recipe_Map aMap) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity;
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){
- ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null;
- ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap;
- }
- else {
- ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null;
- ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap;
- }
- return true;
- }
- else {
- return false;
- }
- }
@Override
public boolean addToMachineList(final IGregTechTileEntity aTileEntity,
@@ -694,20 +624,20 @@ GT_MetaTileEntity_MultiBlockBase {
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {
- Logger.REFLECTION("Found GT_MetaTileEntity_Hatch_InputBattery");
+ log("Found GT_MetaTileEntity_Hatch_InputBattery");
updateTexture(aTileEntity, aBaseCasingIndex);
return this.mChargeHatches.add(
(GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
- Logger.REFLECTION("Found GT_MetaTileEntity_Hatch_OutputBattery");
+ log("Found GT_MetaTileEntity_Hatch_OutputBattery");
updateTexture(aTileEntity, aBaseCasingIndex);
return this.mDischargeHatches.add(
(GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
}
if (LoadedMods.TecTech){
if (isThisHatchMultiDynamo(aMetaTileEntity)) {
- Logger.REFLECTION("Found isThisHatchMultiDynamo");
+ log("Found isThisHatchMultiDynamo");
updateTexture(aTileEntity, aBaseCasingIndex);
return this.mMultiDynamoHatches.add(
(GT_MetaTileEntity_Hatch) aMetaTileEntity);
@@ -787,6 +717,7 @@ GT_MetaTileEntity_MultiBlockBase {
* Enable Texture Casing Support if found in GT 5.09
*/
+ @SuppressWarnings("deprecation")
public boolean updateTexture(final IGregTechTileEntity aTileEntity, int aCasingID){
try { //gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int)
@@ -799,34 +730,35 @@ GT_MetaTileEntity_MultiBlockBase {
if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){
mProper.setAccessible(true);
mProper.invoke(aMetaTileEntity, aCasingID);
- Logger.REFLECTION("Good Method Call for updateTexture.");
+ log("Good Method Call for updateTexture.");
return true;
}
}
else {
- Logger.REFLECTION("Bad Method Call for updateTexture.");
+ log("Bad Method Call for updateTexture.");
if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){
if (aCasingID <= Byte.MAX_VALUE) {
((GT_MetaTileEntity_Hatch) aTileEntity.getMetaTileEntity()).mMachineBlock = (byte) aCasingID;
- Logger.REFLECTION("Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128.");
+ log("Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128.");
return true;
}
else {
- Logger.REFLECTION("updateTexture returning false. 1.2");
+ log("updateTexture returning false. 1.2");
}
}
else {
- Logger.REFLECTION("updateTexture returning false. 1.3");
+ log("updateTexture returning false. 1.3");
}
}
- Logger.REFLECTION("updateTexture returning false. 1");
+ log("updateTexture returning false. 1");
return false;
}
- catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {Logger.REFLECTION("updateTexture returning false.");
- Logger.REFLECTION("updateTexture returning false. 2");
- e.printStackTrace();
- return false;
+ catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ log("updateTexture returning false.");
+ log("updateTexture returning false. 2");
+ e.printStackTrace();
+ return false;
}
}
@@ -873,6 +805,7 @@ GT_MetaTileEntity_MultiBlockBase {
return false;
}
+ @SuppressWarnings("rawtypes")
public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){
Class mDynamoClass;
try {
@@ -906,7 +839,7 @@ GT_MetaTileEntity_MultiBlockBase {
public int getPollutionPerTick(ItemStack arg0) {
return 0;
}
-
+
public String getPollutionTooltip() {
if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
return "Causes " + 20 * this.getPollutionPerTick(null) + " Pollution per second";
@@ -981,7 +914,7 @@ GT_MetaTileEntity_MultiBlockBase {
final boolean aNotUnificated, final boolean aDontCheckStackSizes, final long aVoltage,
final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) {
if (this.getRecipeMap().mRecipeList.isEmpty()) {
- Logger.INFO("No Recipes in Map to search through.");
+ log("No Recipes in Map to search through.");
return null;
}
GT_Recipe mRecipeResult = null;
@@ -989,7 +922,7 @@ GT_MetaTileEntity_MultiBlockBase {
if (GregTech_API.sPostloadFinished) {
if (this.getRecipeMap().mMinimalInputFluids > 0) {
if (aFluids == null) {
- Logger.INFO("aFluids == null && minFluids > 0");
+ log("aFluids == null && minFluids > 0");
return null;
}
int tAmount = 0;
@@ -999,13 +932,13 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
if (tAmount < this.getRecipeMap().mMinimalInputFluids) {
- Logger.INFO("Not enough fluids?");
+ log("Not enough fluids?");
return null;
}
}
if (this.getRecipeMap().mMinimalInputItems > 0) {
if (aInputs == null) {
- Logger.INFO("No inputs and minItems > 0");
+ log("No inputs and minItems > 0");
return null;
}
int tAmount = 0;
@@ -1015,13 +948,13 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
if (tAmount < this.getRecipeMap().mMinimalInputItems) {
- Logger.INFO("Not enough items?");
+ log("Not enough items?");
return null;
}
}
}
else {
- Logger.INFO("Game Not Loaded properly for recipe lookup.");
+ log("Game Not Loaded properly for recipe lookup.");
}
if (aNotUnificated) {
aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs);
@@ -1029,7 +962,7 @@ GT_MetaTileEntity_MultiBlockBase {
if (aRecipe != null && !aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered
&& aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
mRecipeResult = (aRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= aRecipe.mEUt*/) ? aRecipe : null;
- Logger.INFO("x) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
+ log("x) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
if (mRecipeResult != null) {
return mRecipeResult;
}
@@ -1044,7 +977,7 @@ GT_MetaTileEntity_MultiBlockBase {
mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/)
? tRecipe
: null;
- Logger.INFO("1) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
+ log("1) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
//return mRecipeResult;
}
}
@@ -1060,7 +993,7 @@ GT_MetaTileEntity_MultiBlockBase {
mRecipeResult = (tRecipe.mEnabled /*&& aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/)
? tRecipe
: null;
- Logger.INFO("2) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
+ log("2) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
//return mRecipeResult;
}
}
@@ -1079,7 +1012,7 @@ GT_MetaTileEntity_MultiBlockBase {
mRecipeResult = (tRecipe.mEnabled/* && aVoltage * this.getRecipeMap().mAmperage >= tRecipe.mEUt*/)
? tRecipe
: null;
- Logger.INFO("3) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
+ log("3) Found Recipe? "+(mRecipeResult != null ? "true" : "false"));
//return mRecipeResult;
}
}
@@ -1089,7 +1022,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
catch (Throwable t) {
- Logger.INFO("Invalid recipe lookup.");
+ log("Invalid recipe lookup.");
}
if (mRecipeResult == null) {
return this.getRecipeMap().findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, aSpecialSlot, aInputs);
@@ -1099,12 +1032,6 @@ GT_MetaTileEntity_MultiBlockBase {
}
}
- @Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- resetRecipeMapForAllInputHatches();
- super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
- }
-
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
index 1cb8647915..6c3e69d797 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -18,7 +18,6 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;