mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 05:12:16 +00:00
Fix tile entity pass markers skipped on newer class files (#2075)
This commit is contained in:
1 parent
744c1f971f
commit
37a10eee3f
3 files changed
+14
-5
No files matched your search
+2
-1
@@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.loading.shared.transformers.TileEntityMarkerTr
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
/** IClassTransformer wrapper for {@link CeleritasBlockTransform} */
|
||||
@@ -18,7 +19,7 @@ public class CeleritasBlockTransformer implements IClassTransformer {
|
||||
|
||||
public CeleritasBlockTransformer() {
|
||||
this.inner = new CeleritasBlockTransform(AngelicaClientTweaker.isObfEnv());
|
||||
this.tileEntities = new TileEntityMarkerTransform(AngelicaClientTweaker.isObfEnv());
|
||||
this.tileEntities = new TileEntityMarkerTransform(AngelicaClientTweaker.isObfEnv(), Opcodes.ASM5);
|
||||
this.exclusions = inner.getTransformerExclusions();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import com.gtnewhorizons.angelica.loading.shared.transformers.TileEntityMarkerTr
|
||||
import com.gtnewhorizons.retrofuturabootstrap.api.ClassHeaderMetadata;
|
||||
import com.gtnewhorizons.retrofuturabootstrap.api.ClassNodeHandle;
|
||||
import com.gtnewhorizons.retrofuturabootstrap.api.ExtensibleClassLoader;
|
||||
import com.gtnewhorizons.retrofuturabootstrap.api.RetroFuturaBootstrap;
|
||||
import com.gtnewhorizons.retrofuturabootstrap.api.RfbClassTransformer;
|
||||
import org.intellij.lang.annotations.Pattern;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -21,7 +22,7 @@ public class RFBCeleritasBlockTransformer implements RfbClassTransformer {
|
||||
|
||||
public RFBCeleritasBlockTransformer(boolean isObf) {
|
||||
inner = new CeleritasBlockTransform(isObf);
|
||||
tileEntities = new TileEntityMarkerTransform(isObf);
|
||||
tileEntities = new TileEntityMarkerTransform(isObf, RetroFuturaBootstrap.API.newestAsmVersion());
|
||||
}
|
||||
|
||||
@Pattern("[a-z0-9-]+")
|
||||
|
||||
+10
-3
@@ -32,11 +32,18 @@ public final class TileEntityMarkerTransform {
|
||||
|
||||
private record Marker(int bit, String method, String desc, String iface) {}
|
||||
|
||||
/**
|
||||
* A visitor refuses to visit attributes newer than its api level, such as the NestMember one javac emits for
|
||||
* classes with nested classes, so the caller passes the highest level its class loader supports.
|
||||
*/
|
||||
private final int asmApi;
|
||||
|
||||
private final Marker[] markers;
|
||||
private final ClassConstantPoolParser prefilter;
|
||||
private final Set<String> tileEntities = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
||||
public TileEntityMarkerTransform(boolean isObf) {
|
||||
public TileEntityMarkerTransform(boolean isObf, int asmApi) {
|
||||
this.asmApi = asmApi;
|
||||
this.markers = new Marker[] {
|
||||
new Marker(MARK_DESCRIPTION_PACKET, isObf ? "func_145844_m" : "getDescriptionPacket", "()Lnet/minecraft/network/Packet;", SENDS_DESCRIPTION_PACKET),
|
||||
new Marker(MARK_SHOULD_RENDER_IN_PASS, "shouldRenderInPass", "(I)Z", OVERRIDES_SHOULD_RENDER_IN_PASS),
|
||||
@@ -67,7 +74,7 @@ public final class TileEntityMarkerTransform {
|
||||
public byte[] addMarkers(byte[] classBytes, int markers) {
|
||||
final ClassReader cr = new ClassReader(classBytes);
|
||||
final ClassWriter cw = new ClassWriter(cr, 0);
|
||||
cr.accept(new ClassVisitor(Opcodes.ASM5, cw) {
|
||||
cr.accept(new ClassVisitor(asmApi, cw) {
|
||||
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String sig, String superName, String[] interfaces) {
|
||||
@@ -112,7 +119,7 @@ public final class TileEntityMarkerTransform {
|
||||
private int alreadyPresent;
|
||||
|
||||
MarkerScanner() {
|
||||
super(Opcodes.ASM5);
|
||||
super(asmApi);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user