mirror of
https://github.com/architectury/architectury-api.git
synced 2026-04-02 13:37:43 -05:00
Remove hacks around RegistryEntry (#144)
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This file is part of architectury.
|
||||
* Copyright (C) 2020, 2021 architectury
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package me.shedaniel.architectury.mixin.forge;
|
||||
|
||||
import me.shedaniel.architectury.core.RegistryEntry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(RegistryEntry.class)
|
||||
public class MixinRegistryEntry<T> {
|
||||
}
|
||||
@@ -19,16 +19,11 @@
|
||||
|
||||
package me.shedaniel.architectury.plugin.forge;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class ArchitecturyMixinPlugin implements IMixinConfigPlugin {
|
||||
@@ -59,26 +54,7 @@ public class ArchitecturyMixinPlugin implements IMixinConfigPlugin {
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
// Inject our own sugar
|
||||
switch (mixinClassName) {
|
||||
case "me.shedaniel.architectury.mixin.forge.MixinRegistryEntry":
|
||||
targetClass.superName = "net/minecraftforge/registries/ForgeRegistryEntry";
|
||||
for (MethodNode method : targetClass.methods) {
|
||||
if (Objects.equals(method.name, "<init>")) {
|
||||
for (AbstractInsnNode insnNode : method.instructions) {
|
||||
if (insnNode.getOpcode() == Opcodes.INVOKESPECIAL && insnNode instanceof MethodInsnNode) {
|
||||
MethodInsnNode node = (MethodInsnNode) insnNode;
|
||||
if (Objects.equals(node.name, "<init>") && Objects.equals(node.owner, "java/lang/Object")) {
|
||||
node.owner = "net/minecraftforge/registries/ForgeRegistryEntry";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
targetClass.signature = "<T::Lnet/minecraftforge/registries/IForgeRegistryEntry<TT;>;>Lnet/minecraftforge/registries/ForgeRegistryEntry<TT;>;";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"MixinBlockEntityExtension",
|
||||
"MixinChunkSerializer",
|
||||
"MixinItemExtension",
|
||||
"MixinRegistryEntry",
|
||||
"MixinWorldEvent",
|
||||
"MobSpawnSettingsBuilderAccessor"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user