Skip to content

Commit

Permalink
Stop making use of deprecated apis
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Apr 28, 2024
1 parent f80b3bf commit d20d8be
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 27 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ allprojects {
rename { "${it}_${base.archivesName.get()}" }
}
}

tasks.withType(JavaCompile) {
options.deprecation = true
}
}

loom {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx2G
loader_version = 0.15.10

# Legacy Fabric API
mod_remapping_api = 1.21.1
mod_remapping_api = 1.22.0
forge_version = 4.3.5.318
mixin_extras_version=0.2.1
spasm_version=0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
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.Redirect;
Expand All @@ -19,8 +20,9 @@

@Mixin(ClassDiscoverer.class)
public abstract class ClassDiscovererMixin {
@Shadow public ArrayList classes;
@Shadow public ModClassLoader modClassLoader;
@Shadow(remap = false) public ArrayList classes;
@Shadow(remap = false) public ModClassLoader modClassLoader;
@Unique
public String[] superclassesString;

@Inject(method = "<init>", at = @At("RETURN"), remap = false)
Expand All @@ -41,6 +43,10 @@ private void checkClassBeforeLoadingIt(ClassDiscoverer instance, String resource
checkAddClass(resource);
}

/**
* @author ChickenBones
* Backported from CCC for MC 1.4.7
*/
private void checkAddClass(String resource) {
try {
String classname = resource.replace(".class", "").replace("\\", ".").replace("/", ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ private void remap(String declaringclass, String fieldname, String type, Callbac
}
MappingUtils.ClassMember pair = Constants.mapFieldFromRemappedClass(this.owner, this.name, this.type);
this.name = pair.name;
this.type = pair.desc;
this.type = Constants.mapTypeDescriptor(pair.desc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ private void remap() {
}
MappingUtils.ClassMember pair = Constants.mapMethodFromRemappedClass(this.owner, this.name, this.desc);
this.name = pair.name;
this.desc = pair.desc;
this.desc = Constants.mapMethodDescriptor(pair.desc);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package fr.catcore.fabricatedforge.mixin;

import fr.catcore.modremapperapi.utils.MixinUtils;
import fr.catcore.cursedmixinextensions.CursedMixinExtensions;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down Expand Up @@ -40,6 +40,6 @@ public void preApply(String targetClassName, ClassNode targetClass, String mixin

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
MixinUtils.applyASMMagic(targetClassName, targetClass, mixinClassName, mixinInfo);
CursedMixinExtensions.postApply(targetClass);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.FireSprite;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.NetherPortalSprite;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.class_586;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.class_587;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.class_589;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.class_590;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client.texture;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.Minecraft;
import net.minecraft.client.texture.ClockSprite;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client.texture;

import cpw.mods.fml.client.FMLTextureFX;
import fr.catcore.cursedmixinextensions.annotations.ChangeSuperClass;
import fr.catcore.fabricatedforge.mixininterface.IFMLTextureFX;
import fr.catcore.modremapperapi.api.mixin.ChangeSuperClass;
import net.minecraft.client.Minecraft;
import net.minecraft.client.texture.CompassSprite;
import net.minecraft.util.math.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package fr.catcore.fabricatedforge.mixin.forgefml.item.itemgroup;

import fr.catcore.cursedmixinextensions.annotations.NewConstructor;
import fr.catcore.cursedmixinextensions.annotations.Public;
import fr.catcore.cursedmixinextensions.annotations.ShadowConstructor;
import fr.catcore.fabricatedforge.mixininterface.IItemGroup;
import fr.catcore.modremapperapi.api.mixin.NewConstructor;
import fr.catcore.modremapperapi.api.mixin.Public;
import fr.catcore.modremapperapi.api.mixin.ShadowConstructor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fr.catcore.fabricatedforge.mixin.forgefml.util;

import fr.catcore.cursedmixinextensions.annotations.NewConstructor;
import fr.catcore.cursedmixinextensions.annotations.ShadowSuperConstructor;
import fr.catcore.fabricatedforge.mixininterface.IWeightedRandomChestContent;
import fr.catcore.modremapperapi.api.mixin.NewConstructor;
import fr.catcore.modremapperapi.api.mixin.SuperConstructor;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.entity.DispenserBlockEntity;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -32,7 +32,7 @@ private void fmlCtr(int par1, int par2, int par3, int par4, int par5, CallbackIn
this.itemStack = new ItemStack(par1, 1, par2);
}

@SuperConstructor
@ShadowSuperConstructor
public abstract void weight$ctr(int weight);

@NewConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import com.google.common.collect.SetMultimap;
import fr.catcore.cursedmixinextensions.annotations.ReplaceConstructor;
import fr.catcore.cursedmixinextensions.annotations.ShadowSuperConstructor;
import fr.catcore.fabricatedforge.forged.reflection.ReflectedWorld;
import fr.catcore.fabricatedforge.mixininterface.IBlock;
import fr.catcore.fabricatedforge.mixininterface.IBlockEntity;
import fr.catcore.fabricatedforge.mixininterface.IChunk;
import fr.catcore.fabricatedforge.mixininterface.IWorld;
import fr.catcore.modremapperapi.api.mixin.SuperConstructor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -164,7 +164,7 @@ public Biome getBiomeGenForCoordsBody(int par1, int par2) {
return this.dimension.biomeSource.method_3853(par1, par2);
}

@SuperConstructor
@ShadowSuperConstructor
private void superCtr() {}

@Environment(EnvType.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package fr.catcore.fabricatedforge.mixin.forgefml.world.chunk;

import fr.catcore.cursedmixinextensions.annotations.NewConstructor;
import fr.catcore.cursedmixinextensions.annotations.ShadowConstructor;
import fr.catcore.fabricatedforge.forged.reflection.ReflectedWorld;
import fr.catcore.fabricatedforge.mixininterface.IBlock;
import fr.catcore.fabricatedforge.mixininterface.IChunk;
import fr.catcore.modremapperapi.api.mixin.NewConstructor;
import fr.catcore.modremapperapi.api.mixin.ShadowConstructor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/minecraftforge/event/ASMEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Class<?> createWrapper(Method callback) {
MethodVisitor mv = cw.visitMethod(1, "<init>", "(Ljava/lang/Object;)V", (String)null, (String[])null);
mv.visitCode();
mv.visitVarInsn(25, 0);
mv.visitMethodInsn(183, "java/lang/Object", "<init>", "()V");
mv.visitMethodInsn(183, "java/lang/Object", "<init>", "()V", false);
mv.visitVarInsn(25, 0);
mv.visitVarInsn(25, 1);
mv.visitFieldInsn(181, desc, "instance", "Ljava/lang/Object;");
Expand All @@ -60,7 +60,7 @@ public Class<?> createWrapper(Method callback) {
mv.visitTypeInsn(192, instType);
mv.visitVarInsn(25, 1);
mv.visitTypeInsn(192, eventType);
mv.visitMethodInsn(182, instType, callback.getName(), Type.getMethodDescriptor(callback));
mv.visitMethodInsn(182, instType, callback.getName(), Type.getMethodDescriptor(callback), false);
mv.visitInsn(177);
mv.visitMaxs(2, 2);
mv.visitEnd();
Expand Down

0 comments on commit d20d8be

Please sign in to comment.