-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca9819c
commit 841098b
Showing
5 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/falsepattern/falsetweaks/asm/ASMFixerUtility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* This file is part of FalseTweaks. | ||
* | ||
* Copyright (C) 2022-2024 FalsePattern | ||
* All Rights Reserved | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* FalseTweaks is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* FalseTweaks is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.falsepattern.falsetweaks.asm; | ||
|
||
import lombok.val; | ||
|
||
import net.minecraft.launchwrapper.IClassTransformer; | ||
|
||
import java.util.List; | ||
|
||
public class ASMFixerUtility { | ||
public static void removeGTNHLibHook(List<IClassTransformer> transformers) { | ||
val iter = transformers.iterator(); | ||
while (iter.hasNext()) { | ||
val transformer = (IClassTransformer) iter.next(); | ||
if (transformer.getClass().getName().equals("com.gtnewhorizon.gtnhlib.core.transformer.TessellatorRedirectorTransformer")) { | ||
iter.remove(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/com/falsepattern/falsetweaks/asm/RFBFixerUtility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* This file is part of FalseTweaks. | ||
* | ||
* Copyright (C) 2022-2024 FalsePattern | ||
* All Rights Reserved | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* FalseTweaks is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* FalseTweaks is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.falsepattern.falsetweaks.asm; | ||
|
||
import com.gtnewhorizons.retrofuturabootstrap.SharedConfig; | ||
import com.gtnewhorizons.retrofuturabootstrap.api.RfbClassTransformerHandle; | ||
import lombok.SneakyThrows; | ||
import lombok.val; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
public class RFBFixerUtility { | ||
@SneakyThrows | ||
public static void removeGTNHLibHook() { | ||
val theField = SharedConfig.class.getDeclaredField("rfbTransformers"); | ||
theField.setAccessible(true); | ||
val ref = (AtomicReference<RfbClassTransformerHandle[]>) theField.get(null); | ||
val arr = new ArrayList<>(Arrays.asList(ref.get())); | ||
val iter = arr.iterator(); | ||
while (iter.hasNext()) { | ||
val elem = iter.next(); | ||
if (elem.id().equals("gtnhlib:redirector")) { | ||
iter.remove(); | ||
} | ||
} | ||
ref.set(arr.toArray(new RfbClassTransformerHandle[0])); | ||
} | ||
} |