diff --git a/changelog.md b/changelog.md index b0ecfa1..e4695b7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +### 4.4.8 +- Removed a fringe feature that was eating away at the computer's memory ### 4.4.7 - Fixed crash in certain cases ### 4.4.6 diff --git a/common/src/main/java/fudge/notenoughcrashes/StateManager.java b/common/src/main/java/fudge/notenoughcrashes/StateManager.java index a734ba3..6b1bcdf 100644 --- a/common/src/main/java/fudge/notenoughcrashes/StateManager.java +++ b/common/src/main/java/fudge/notenoughcrashes/StateManager.java @@ -5,34 +5,33 @@ import java.util.Iterator; import java.util.Set; -/** - * Allows registering objects to be reset after a crash. Objects registered - * use WeakReferences, so they will be garbage-collected despite still being - * registered here. - */ -public class StateManager { - - // Use WeakReference to allow garbage collection, preventing memory leaks - private static final Set> resettableRefs = new HashSet<>(); - - public static void resetStates() { - Iterator> iterator = resettableRefs.iterator(); - while (iterator.hasNext()) { - IResettable ref = iterator.next().get(); - if (ref != null) { - ref.resetState(); - } else { - iterator.remove(); - } - } - } - - public interface IResettable { - - default void register() { - resettableRefs.add(new WeakReference<>(this)); - } - - void resetState(); - } -} +///** +// * Allows registering objects to be reset after a crash. Objects registered +// * use WeakReferences, so they will be garbage-collected despite still being +// * registered here. +// */ +//public class StateManager { +// +// // Use WeakReference to allow garbage collection, preventing memory leaks +// private static final Set> resettableRefs = new HashSet<>(); +// +// public static void resetStates() { +// Iterator> iterator = resettableRefs.iterator(); +// while (iterator.hasNext()) { +// IResettable ref = iterator.next().get(); +// if (ref != null) { +// ref.resetState(); +// } else { +// iterator.remove(); +// } +// } +// } +// +// public interface IResettable { +// default void register() { +// resettableRefs.add(new WeakReference<>(this)); +// } +// +// void resetState(); +// } +//} diff --git a/common/src/main/java/fudge/notenoughcrashes/mixinhandlers/InGameCatcher.java b/common/src/main/java/fudge/notenoughcrashes/mixinhandlers/InGameCatcher.java index b5dc0a9..4db573b 100644 --- a/common/src/main/java/fudge/notenoughcrashes/mixinhandlers/InGameCatcher.java +++ b/common/src/main/java/fudge/notenoughcrashes/mixinhandlers/InGameCatcher.java @@ -1,7 +1,6 @@ package fudge.notenoughcrashes.mixinhandlers; import fudge.notenoughcrashes.NotEnoughCrashes; -import fudge.notenoughcrashes.StateManager; import fudge.notenoughcrashes.config.NecConfig; import fudge.notenoughcrashes.gui.CrashScreen; import fudge.notenoughcrashes.patches.MinecraftClientAccess; @@ -40,7 +39,7 @@ public static void handleClientCrash(CrashReport report) { private static void resetStates() { GlUtil.resetState(); - StateManager.resetStates(); +// StateManager.resetStates(); resetModState(); resetCriticalGameState(); } diff --git a/common/src/main/java/fudge/notenoughcrashes/mixins/client/MixinBufferBuilder.java b/common/src/main/java/fudge/notenoughcrashes/mixins/client/MixinBufferBuilder.java index 025c7d9..b1ded2b 100644 --- a/common/src/main/java/fudge/notenoughcrashes/mixins/client/MixinBufferBuilder.java +++ b/common/src/main/java/fudge/notenoughcrashes/mixins/client/MixinBufferBuilder.java @@ -1,6 +1,5 @@ package fudge.notenoughcrashes.mixins.client; -import fudge.notenoughcrashes.StateManager; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BuiltBuffer; import net.minecraft.client.render.VertexFormat; @@ -11,22 +10,22 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(BufferBuilder.class) -public abstract class MixinBufferBuilder implements StateManager.IResettable { - - @Shadow private boolean building; - - @Shadow public abstract BuiltBuffer end(); - - @Inject(method = "", at = @At("RETURN")) - public void onInit(BufferAllocator allocator, VertexFormat.DrawMode drawMode, VertexFormat format, CallbackInfo ci) { - register(); - } - - @Override - public void resetState() { - if (building) { - end(); - } - } -} +//@Mixin(BufferBuilder.class) +//public abstract class MixinBufferBuilder implements StateManager.IResettable { +// +// @Shadow private boolean building; +// +// @Shadow public abstract BuiltBuffer end(); +// +// @Inject(method = "", at = @At("RETURN")) +// public void onInit(BufferAllocator allocator, VertexFormat.DrawMode drawMode, VertexFormat format, CallbackInfo ci) { +//// register(); +// } +// +// @Override +// public void resetState() { +// if (building) { +// end(); +// } +// } +//} diff --git a/common/src/main/resources/notenoughcrashes.mixins.json b/common/src/main/resources/notenoughcrashes.mixins.json index 460ea03..45c3d97 100644 --- a/common/src/main/resources/notenoughcrashes.mixins.json +++ b/common/src/main/resources/notenoughcrashes.mixins.json @@ -10,7 +10,6 @@ "MixinTileEntity" ], "client": [ - "client.MixinBufferBuilder", "client.MixinKeyboard", "client.MixinMinecraftClient", "client.MixinMinecraftServerClientOnly" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 58390e0..d63bd53 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ task_tree = { id = "com.dorongold.task-tree", version.ref = "task_tree" } [versions] # This Mod Version -mod_version = "4.4.7" +mod_version = "4.4.8" # Gradle Plugins architectury_plugin = "3.4-SNAPSHOT"