From 29258132152e2b0b6670fffc366598ccc2b00351 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 29 May 2018 19:10:36 +1000 Subject: + Added a display string to the GUI of the threaded buffers, showing seconds remaining before the thread belonging to this buffer is released. This will also show ms/25 lag info someday. + Added invokeGC() to SystemUtils.java. $ More thread safety. --- .../GT_MetaTileEntity_ThreadedBuffer.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ThreadedBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ThreadedBuffer.java index 855b856f49..9642ff63ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ThreadedBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_ThreadedBuffer.java @@ -7,6 +7,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.xmod.gregtech.api.objects.GregtechBufferThread; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -378,4 +379,40 @@ public abstract class GT_MetaTileEntity_ThreadedBuffer extends GT_MetaTileEntity this.mInventorySynchro[aIndex] = aStack; } } + + private synchronized void cleanup() { + if (this.mLogicThread != null) { + this.mLogicThread.destroy(); + this.mLogicThread = null; + } + } + + @Override + public void onExplosion() { + cleanup(); + super.onExplosion(); + } + + @Override + public void onRemoval() { + cleanup(); + super.onRemoval(); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + String mResult[] = super.getInfoData(); + String mAdditive[] = new String[] { + "info" + }; + for (String s : mAdditive) { + ArrayUtils.expandArray(mResult, s); + } + return mResult; + } } \ No newline at end of file -- cgit