Added extended debug info

This commit is contained in:
TheDarkDnKTv 2021-08-17 05:03:10 +03:00
parent 87a2854752
commit e8661f58a2
9 changed files with 131 additions and 7 deletions

View file

@ -665,10 +665,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (getRFCapacity() > 0 && hasRFConverterUpgrade()) tList.add("RF energy strored: " + getStoredRF() + " of " + getRFCapacity() + " RF"); if (getRFCapacity() > 0 && hasRFConverterUpgrade()) tList.add("RF energy strored: " + getStoredRF() + " of " + getRFCapacity() + " RF");
if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) tList.add("Steam stored: " + getStoredSteam() + " of " + getSteamCapacity() + " Steam"); if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) tList.add("Steam stored: " + getStoredSteam() + " of " + getSteamCapacity() + " Steam");
tList.add("Machine is " + (mActive?"active":"inactive")); tList.add("Machine is " + (mActive?"active":"inactive"));
tList.add("Working is " + (mWorks?"enabled":"disabled"));
if (mNeedsBatteryUpgrade && isBatteryUpgradable(10000, (byte)1)) tList.add("WARNING: Requires more Energy Capacity to work! Add Battery Upgrades!"); if (mNeedsBatteryUpgrade && isBatteryUpgradable(10000, (byte)1)) tList.add("WARNING: Requires more Energy Capacity to work! Add Battery Upgrades!");
if (!mHasEnoughEnergy) tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process."); if (!mHasEnoughEnergy) tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process.");
} }
return mMetaTileEntity.getSpecialDebugInfo(aPlayer, aLogLevel, tList);
return aLogLevel > 2 ? mMetaTileEntity.getSpecialDebugInfo(aPlayer, aLogLevel, tList) : tList;
} }
@Override public void issueTextureUpdate() {mNeedsUpdate = true;} @Override public void issueTextureUpdate() {mNeedsUpdate = true;}

View file

@ -1,5 +1,6 @@
package gregtechmod.api.metatileentity.implementations; package gregtechmod.api.metatileentity.implementations;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -57,6 +58,28 @@ public abstract class BaseMultiWorkable extends MetaTileEntity implements IRecip
protected abstract boolean checkMachine(); protected abstract boolean checkMachine();
@Override
public ArrayList<String> getSpecialDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
super.getSpecialDebugInfo(aPlayer, aLogLevel, aList);
if (aLogLevel >= 2) {
boolean active = recipeLogic.isActive();
aList.add("§4§l-- Recipe Logic --");
aList.add(" §cActive: §r" + active);
if (active) {
Recipe recipe = recipeLogic.getCurrentRecipe();
aList.add(" §cProgress: §r" + recipeLogic.getProgressTime() + " / " + recipeLogic.getMaxProgressTime());
aList.add(" §cRequired EUt: §r" + recipeLogic.getEUt());
aList.add(" §cItem inputs: §r" + recipe.getInputs());
aList.add(" §cFluid inputs: §r" + recipe.getFluidInputs());
aList.add(" §cItem outputs: §r" + recipe.getOutputs());
aList.add(" §cItem chanced outputs: §r" + recipe.getChancedOutputs());
aList.add(" §cFluid outputs: §r" + recipe.getFluidOutputs());
}
}
return aList;
}
@Override @Override
public ItemStack getStackIn(int idx) { public ItemStack getStackIn(int idx) {
return super.getStackInSlot(idx); return super.getStackInSlot(idx);

View file

@ -1,5 +1,6 @@
package gregtechmod.api.metatileentity.implementations; package gregtechmod.api.metatileentity.implementations;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -66,6 +67,28 @@ public abstract class BasicFluidWorkable extends GT_MetaTileEntity_BasicTank imp
recipeLogic = new RecipeLogic(recipeMap, this); recipeLogic = new RecipeLogic(recipeMap, this);
} }
@Override
public ArrayList<String> getSpecialDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
super.getSpecialDebugInfo(aPlayer, aLogLevel, aList);
if (aLogLevel >= 2) {
boolean active = recipeLogic.isActive();
aList.add("§4§l-- Recipe Logic --");
aList.add(" §cActive: §r" + active);
if (active) {
Recipe recipe = recipeLogic.getCurrentRecipe();
aList.add(" §cProgress: §r" + recipeLogic.getProgressTime() + " / " + recipeLogic.getMaxProgressTime());
aList.add(" §cRequired EUt: §r" + recipeLogic.getEUt());
aList.add(" §cItem inputs: §r" + recipe.getInputs());
aList.add(" §cFluid inputs: §r" + recipe.getFluidInputs());
aList.add(" §cItem outputs: §r" + recipe.getOutputs());
aList.add(" §cItem chanced outputs: §r" + recipe.getChancedOutputs());
aList.add(" §cFluid outputs: §r" + recipe.getFluidOutputs());
}
}
return aList;
}
@Override @Override
public ItemStack getStackIn(int idx) { public ItemStack getStackIn(int idx) {
return super.getStackInSlot(idx); return super.getStackInSlot(idx);

View file

@ -1,5 +1,6 @@
package gregtechmod.api.metatileentity.implementations; package gregtechmod.api.metatileentity.implementations;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -82,6 +83,28 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity impl
recipeLogic = new RecipeLogic(recipeMap, this); recipeLogic = new RecipeLogic(recipeMap, this);
} }
@Override
public ArrayList<String> getSpecialDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
super.getSpecialDebugInfo(aPlayer, aLogLevel, aList);
if (aLogLevel >= 2) {
boolean active = recipeLogic.isActive();
aList.add("§4§l-- Recipe Logic --");
aList.add(" §cActive: §r" + active);
if (active) {
Recipe recipe = recipeLogic.getCurrentRecipe();
aList.add(" §cProgress: §r" + recipeLogic.getProgressTime() + " / " + recipeLogic.getMaxProgressTime());
aList.add(" §cRequired EUt: §r" + recipeLogic.getEUt());
aList.add(" §cItem inputs: §r" + recipe.getInputs());
aList.add(" §cFluid inputs: §r" + recipe.getFluidInputs());
aList.add(" §cItem outputs: §r" + recipe.getOutputs());
aList.add(" §cItem chanced outputs: §r" + recipe.getChancedOutputs());
aList.add(" §cFluid outputs: §r" + recipe.getFluidOutputs());
}
}
return aList;
}
@Override @Override
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setBoolean("bOutput", bOutput); aNBT.setBoolean("bOutput", bOutput);

View file

@ -7,9 +7,12 @@ import gregtechmod.api.recipe.RecipeLogic;
import gregtechmod.api.recipe.RecipeMap; import gregtechmod.api.recipe.RecipeMap;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.api.util.InfoBuilder; import gregtechmod.api.util.InfoBuilder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -38,6 +41,28 @@ public abstract class MTEWorkableMultiblock extends MetaTileEntityMultiblock imp
@Override public RecipeLogic getRecipeLogic() {return recipeLogic;} @Override public RecipeLogic getRecipeLogic() {return recipeLogic;}
@Override public int increaseProgress(int aProgress) {recipeLogic.increaseProgressTime(aProgress);return recipeLogic.getMaxProgressTime()-recipeLogic.getProgressTime();} @Override public int increaseProgress(int aProgress) {recipeLogic.increaseProgressTime(aProgress);return recipeLogic.getMaxProgressTime()-recipeLogic.getProgressTime();}
@Override
public ArrayList<String> getSpecialDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
super.getSpecialDebugInfo(aPlayer, aLogLevel, aList);
if (aLogLevel >= 2) {
boolean active = recipeLogic.isActive();
aList.add("§4§l-- Recipe Logic --");
aList.add(" §cActive: §r" + active);
if (active) {
Recipe recipe = recipeLogic.getCurrentRecipe();
aList.add(" §cProgress: §r" + recipeLogic.getProgressTime() + " / " + recipeLogic.getMaxProgressTime());
aList.add(" §cRequired EUt: §r" + recipeLogic.getEUt());
aList.add(" §cItem inputs: §r" + recipe.getInputs());
aList.add(" §cFluid inputs: §r" + recipe.getFluidInputs());
aList.add(" §cItem outputs: §r" + recipe.getOutputs());
aList.add(" §cItem chanced outputs: §r" + recipe.getChancedOutputs());
aList.add(" §cFluid outputs: §r" + recipe.getFluidOutputs());
}
}
return aList;
}
@Override @Override
public ItemStack getStackIn(int idx) { public ItemStack getStackIn(int idx) {
return this.getStackInSlot(idx); return this.getStackInSlot(idx);

View file

@ -1325,9 +1325,10 @@ public class GT_Utility {
try {if (tTileEntity instanceof IUpgradableMachine) { try {if (tTileEntity instanceof IUpgradableMachine) {
rEUAmount+=500; rEUAmount+=500;
int tValue = 0; int tValue = 0;
if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getOverclockerUpgradeCount())) tList.add(tValue + " Overclocker Upgrades"); tList.add("** Machine upgrades **");
if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getTransformerUpgradeCount())) tList.add(tValue + " Transformer Upgrades"); if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getOverclockerUpgradeCount())) tList.add(" - " + tValue + " Overclocker Upgrades");
if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getUpgradeStorageVolume() )) tList.add(tValue + " Upgraded EU Capacity"); if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getTransformerUpgradeCount())) tList.add(" - " + tValue + " Transformer Upgrades");
if (0 < (tValue = ((IUpgradableMachine)tTileEntity).getUpgradeStorageVolume() )) tList.add(" - " + tValue + " Upgraded EU Capacity");
}} catch(Throwable e) {if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);} }} catch(Throwable e) {if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);}
try {if (tTileEntity instanceof IMachineProgress) { try {if (tTileEntity instanceof IMachineProgress) {
rEUAmount+=400; rEUAmount+=400;
@ -1378,7 +1379,7 @@ public class GT_Utility {
} }
try {if (tBlock instanceof IDebugableBlock) { try {if (tBlock instanceof IDebugableBlock) {
rEUAmount+=500; rEUAmount+=500;
ArrayList<String> temp = ((IDebugableBlock)tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3); ArrayList<String> temp = ((IDebugableBlock)tBlock).getDebugInfo(aPlayer, aX, aY, aZ, aScanLevel);
if (temp != null) tList.addAll(temp); if (temp != null) tList.addAll(temp);
}} catch(Throwable e) {if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);} }} catch(Throwable e) {if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);}

View file

@ -98,7 +98,7 @@ public class GT_Debug_Item extends GT_Generic_Item implements IElectricItem {
ArrayList<String> tList = new ArrayList<String>(); ArrayList<String> tList = new ArrayList<String>();
tList.add("====================="); tList.add("=====================");
tList.add(String.format("%s-sided info", side.isClient() ? "§aCLIENT" : "§cSERVER")); tList.add(String.format("%s-sided info", side.isClient() ? "§aCLIENT" : "§cSERVER"));
GT_ModHandler.useElectricItem(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aPlayer.worldObj, 1, aX, aY, aZ, aSide, aClickX, aClickY, aClickZ), aPlayer); GT_ModHandler.useElectricItem(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aPlayer.worldObj, 3, aX, aY, aZ, aSide, aClickX, aClickY, aClickZ), aPlayer);
for (int i = 0; i < tList.size(); i++) GT_Utility.sendChatToPlayer(aPlayer, tList.get(i)); for (int i = 0; i < tList.size(); i++) GT_Utility.sendChatToPlayer(aPlayer, tList.get(i));
} }

View file

@ -79,7 +79,11 @@ public class UnifierRecipeEntry implements Ingredient, IRecipeInput {
@Override @Override
public String toString() { public String toString() {
ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE); ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE);
return new ToStringBuilder(this).build(); return new ToStringBuilder(this)
.append("prefix", prefix)
.append("material", material)
.append("count", count)
.build();
} }
//////////////// ////////////////

View file

@ -17,6 +17,7 @@ import gregtechmod.api.util.ListAdapter;
import gregtechmod.api.util.WeakList; import gregtechmod.api.util.WeakList;
import gregtechmod.common.recipe.RecipeMaps; import gregtechmod.common.recipe.RecipeMaps;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -66,6 +67,28 @@ public class GT_MetaTileEntity_FusionComputer extends MetaTileEntity implements
@Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
@Override public int increaseProgress(int aProgress) {return aProgress;} @Override public int increaseProgress(int aProgress) {return aProgress;}
@Override
public ArrayList<String> getSpecialDebugInfo(EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
super.getSpecialDebugInfo(aPlayer, aLogLevel, aList);
if (aLogLevel >= 2) {
boolean active = recipeLogic.isActive();
aList.add("§4§l-- Recipe Logic --");
aList.add(" §cActive: §r" + active);
if (active) {
Recipe recipe = recipeLogic.getCurrentRecipe();
aList.add(" §cProgress: §r" + recipeLogic.getProgressTime() + " / " + recipeLogic.getMaxProgressTime());
aList.add(" §cRequired EUt: §r" + recipeLogic.getEUt());
aList.add(" §cItem inputs: §r" + recipe.getInputs());
aList.add(" §cFluid inputs: §r" + recipe.getFluidInputs());
aList.add(" §cItem outputs: §r" + recipe.getOutputs());
aList.add(" §cItem chanced outputs: §r" + recipe.getChancedOutputs());
aList.add(" §cFluid outputs: §r" + recipe.getFluidOutputs());
}
}
return aList;
}
@Override @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_FusionComputer(); return new GT_MetaTileEntity_FusionComputer();