Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Nov 6, 2024
1 parent 87064ba commit 7dc32b2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public String[] getASMTransformerClass() {
}

GenericCompatTransformer.build();
transformers.add("com.gtnewhorizons.angelica.transform.compat.GenericCompatTransformer");
transformers.add(GenericCompatTransformer.class.getName());

// Add NotFine transformers
final List<String> notFineTransformers = AsmTransformers.getTransformers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,24 @@ public enum CompatHandlers {
THAUMCRAFT(() -> CompatConfig.fixThaumcraft, new ThaumcraftCompatHandler()),
THAUMIC_HORIZONS(() -> CompatConfig.fixThaumicHorizons, new ThaumicHorizonsCompatHandler());

private static List<CompatHandler> compatHandlers = null;

private final Supplier<Boolean> applyIf;

@Getter
private final CompatHandler handler;

CompatHandlers(Supplier<Boolean> applyIf, CompatHandler handler) {
this.applyIf = applyIf;
this.handler = handler;
}

public boolean shouldBeLoaded() {
return applyIf.get();
}
private static List<CompatHandler> compatHandlers = null;

public static List<CompatHandler> getHandlers() {
if (compatHandlers != null) {
return compatHandlers;
}
compatHandlers = new ArrayList<>();
for (CompatHandlers handler : values()) {
if (handler.shouldBeLoaded()) {
compatHandlers.add(handler.getHandler());
for (CompatHandlers value : values()) {
if (value.applyIf.get()) {
compatHandlers.add(value.handler);
}
}
return compatHandlers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.ImmersiveEngineeringTransformer;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -37,7 +38,7 @@ public Map<String, Boolean> getThreadSafeISBRHAnnotations() {

@Override
public List<String> extraTransformers() {
return ImmutableList.of("com.gtnewhorizons.angelica.transform.compat.transformers.specific.ImmersiveEngineeringTransformer");
return ImmutableList.of(ImmersiveEngineeringTransformer.class.getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.StacksOnStacksTransformer;

import java.util.List;
import java.util.Map;
Expand All @@ -27,6 +28,6 @@ public Map<String, Boolean> getThreadSafeISBRHAnnotations() {

@Override
public List<String> extraTransformers() {
return ImmutableList.of("com.gtnewhorizons.angelica.transform.compat.transformers.specific.StacksOnStacksTransformer");
return ImmutableList.of(StacksOnStacksTransformer.class.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void transform(ClassNode cn, List<String> patchMethods) {
}
}

public static void injectLocalTessellatorAndReplaceFieldUsage(MethodNode mn) {
private static void injectLocalTessellatorAndReplaceFieldUsage(MethodNode mn) {
// This part searches the instructions to see if there is any usage of a Tessellator field
// which is NOT owned by Minecraft itself. This means anyone that caches it into a field will get caught
// but not direct usage of Tessellator.instance.whatever()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static InsnList buildPilerRenderInitializer(String type) {
return list;
}

private void transformRenderTilePile(ClassNode cn) {
private static void transformRenderTilePile(ClassNode cn) {
MethodNode clinit = null;
for (MethodNode mn : cn.methods) {
// Handles injecting field initializers for the various PileRender fields which used to be static
Expand Down Expand Up @@ -140,7 +140,7 @@ private void transformRenderTilePile(ClassNode cn) {
}
}

private void transformClientUtils(ClassNode cn) {
private static void transformClientUtils(ClassNode cn) {
// Various things throughout the ISBRH call these functions which in turn call GL11.glPush/PopMatrix
// Upon checking, these aren't called anywhere but in the ISBRH, and they're entirely unnecessary in there.
// This just makes the methods no-op, since they aren't required by any other part of the mod to be working.
Expand Down

0 comments on commit 7dc32b2

Please sign in to comment.