From db0f6f280c1222cf5a3d430241e84664f653bf86 Mon Sep 17 00:00:00 2001 From: paulzzh <28055560+paulzzh@users.noreply.github.com> Date: Sun, 19 Jan 2025 14:38:30 +0800 Subject: [PATCH 1/2] Enhanced the confirmation for exiting the game (#1160) Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../early/MixinMinecraft_ConfirmExit.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java b/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java index b979e0f61..af4b3cb09 100644 --- a/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java +++ b/src/main/java/com/dreammaster/mixin/mixins/early/MixinMinecraft_ConfirmExit.java @@ -10,16 +10,18 @@ import net.minecraft.util.StatCollector; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.dreammaster.client.util.IconLoader; import com.dreammaster.coremod.DreamCoreMod; import com.dreammaster.lib.Refstrings; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; @Mixin(Minecraft.class) -public class MixinMinecraft_ConfirmExit { +public abstract class MixinMinecraft_ConfirmExit { @Unique private boolean dreamcraft$isCloseRequested; @@ -27,19 +29,16 @@ public class MixinMinecraft_ConfirmExit { @Unique private boolean dreamcraft$waitingDialogQuit; - @ModifyExpressionValue( - method = "runGameLoop", - at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;isCloseRequested()Z", remap = false)) - private boolean dreamcraft$confirmGameShutdown(boolean isCloseRequested) { - if (!DreamCoreMod.showConfirmExitWindow) { - return isCloseRequested; - } - if (this.dreamcraft$isCloseRequested) { - return true; + @Shadow + public abstract void shutdown(); + + @Inject(method = "shutdown", at = @At(value = "HEAD"), cancellable = true) + private void dreamcraft$confirmGameShutdown(CallbackInfo ci) { + if (!DreamCoreMod.showConfirmExitWindow || this.dreamcraft$isCloseRequested) { + return; } - if (dreamcraft$waitingDialogQuit) return false; - if (isCloseRequested) { - dreamcraft$waitingDialogQuit = true; + if (!this.dreamcraft$waitingDialogQuit) { + this.dreamcraft$waitingDialogQuit = true; new Thread(() -> { final JFrame frame = new JFrame(); frame.setAlwaysOnTop(true); @@ -60,12 +59,11 @@ public class MixinMinecraft_ConfirmExit { imageIcon); if (result == JOptionPane.YES_OPTION) { this.dreamcraft$isCloseRequested = true; + this.shutdown(); } - dreamcraft$waitingDialogQuit = false; + this.dreamcraft$waitingDialogQuit = false; }).start(); - return false; } - return false; + ci.cancel(); } - } From 069d4a78dc3ac1d01256a152bfa6eb2ff2bcf0d0 Mon Sep 17 00:00:00 2001 From: StaffiX <32968022+StaffiX@users.noreply.github.com> Date: Sun, 19 Jan 2025 19:06:10 +0100 Subject: [PATCH 2/2] Make superchest recipes plate usage consistent (#1169) Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../gthandler/GT_CraftingRecipeLoader.java | 16 ++++++++-------- .../gthandler/recipes/AssemblerRecipes.java | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/dreammaster/gthandler/GT_CraftingRecipeLoader.java b/src/main/java/com/dreammaster/gthandler/GT_CraftingRecipeLoader.java index 4af8a0c5d..e884bee1d 100644 --- a/src/main/java/com/dreammaster/gthandler/GT_CraftingRecipeLoader.java +++ b/src/main/java/com/dreammaster/gthandler/GT_CraftingRecipeLoader.java @@ -262,38 +262,38 @@ public void run() { bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_LV, 'G', OrePrefixes.plate.get(Materials.PulsatingIron), 'D', OrePrefixes.circuit.get(Materials.LV), 'P', - OrePrefixes.plateDense.get(Materials.Iron) }); + OrePrefixes.plateTriple.get(Materials.Iron) }); GTModHandler.addCraftingRecipe( ItemList.Super_Chest_MV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_MV, 'G', OrePrefixes.plate.get(Materials.VibrantAlloy), 'D', OrePrefixes.circuit.get(Materials.MV), 'P', - OrePrefixes.plateDense.get(Materials.Steel) }); + OrePrefixes.plateTriple.get(Materials.Steel) }); GTModHandler.addCraftingRecipe( ItemList.Super_Chest_HV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_HV, 'G', ItemList.Field_Generator_LV, 'D', OrePrefixes.circuit.get(Materials.HV), 'P', - OrePrefixes.plateQuintuple.get(Materials.Aluminium) }); + OrePrefixes.plateTriple.get(Materials.Aluminium) }); GTModHandler.addCraftingRecipe( ItemList.Super_Chest_EV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_EV, 'G', ItemList.Field_Generator_MV, 'D', OrePrefixes.circuit.get(Materials.EV), 'P', - OrePrefixes.plateQuintuple.get(Materials.StainlessSteel) }); + OrePrefixes.plateTriple.get(Materials.StainlessSteel) }); GTModHandler.addCraftingRecipe( ItemList.Super_Chest_IV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_IV, 'G', ItemList.Field_Generator_HV, 'D', OrePrefixes.circuit.get(Materials.IV), 'P', - OrePrefixes.plateQuadruple.get(Materials.Titanium) }); + OrePrefixes.plateTriple.get(Materials.Titanium) }); GTModHandler.addCraftingRecipe( ItemList.Quantum_Chest_LV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_LuV, 'G', ItemList.Field_Generator_EV, 'D', OrePrefixes.circuit.get(Materials.LuV), 'P', - OrePrefixes.plateQuadruple.get(Materials.TungstenSteel) }); + OrePrefixes.plateTriple.get(Materials.TungstenSteel) }); GTModHandler.addCraftingRecipe( ItemList.Quantum_Chest_MV.get(1L), bits, @@ -311,13 +311,13 @@ public void run() { bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_UHV, 'G', ItemList.Field_Generator_ZPM, 'D', OrePrefixes.circuit.get(Materials.UHV), 'P', - OrePrefixes.plateDouble.get(Materials.Europium) }); + OrePrefixes.plateTriple.get(Materials.Europium) }); GTModHandler.addCraftingRecipe( ItemList.Quantum_Chest_IV.get(1L), bits, new Object[] { "DPD", "PMP", "DGD", 'M', ItemList.Automation_ChestBuffer_UEV, 'G', ItemList.Field_Generator_UV, 'D', OrePrefixes.circuit.get(Materials.UEV), 'P', - OrePrefixes.plate.get(Materials.Americium) }); + OrePrefixes.plateTriple.get(Materials.Americium) }); // Hermetic casings GTModHandler.addCraftingRecipe( diff --git a/src/main/java/com/dreammaster/gthandler/recipes/AssemblerRecipes.java b/src/main/java/com/dreammaster/gthandler/recipes/AssemblerRecipes.java index 61fe1a08f..2753d4f06 100644 --- a/src/main/java/com/dreammaster/gthandler/recipes/AssemblerRecipes.java +++ b/src/main/java/com/dreammaster/gthandler/recipes/AssemblerRecipes.java @@ -2013,7 +2013,7 @@ public void run() { GTValues.RA.stdBuilder() .itemInputs( GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), - GTOreDictUnificator.get(OrePrefixes.plateQuadruple, Materials.Titanium, 3), + GTOreDictUnificator.get(OrePrefixes.plateTriple, Materials.Titanium, 3), ItemList.Field_Generator_HV.get(1), ItemList.Automation_ChestBuffer_IV.get(1)) .itemOutputs(ItemList.Super_Chest_IV.get(1L)).duration(5 * SECONDS).eut(TierEU.RECIPE_HV) @@ -2053,7 +2053,7 @@ public void run() { GTValues.RA.stdBuilder() .itemInputs( GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UEV), 4), - Materials.Americium.getPlates(3), + GTOreDictUnificator.get(OrePrefixes.plateTriple.get(Materials.Americium), 3), ItemList.Field_Generator_UV.get(1), ItemList.Automation_ChestBuffer_UEV.get(1L)) .itemOutputs(ItemList.Quantum_Chest_IV.get(1)).duration(5 * SECONDS).eut(TierEU.RECIPE_HV)