generated from Legacy-Fabric/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP CodeChickenCore and NEI Compatibility
- Loading branch information
1 parent
6296e9e
commit 42e2ec9
Showing
16 changed files
with
163 additions
and
93 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
10 changes: 4 additions & 6 deletions
10
.../main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassMappingMixin.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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package fr.catcore.fabricatedforge.compat.mixin.codechickencore; | ||
|
||
import codechicken.core.asm.ObfuscationManager; | ||
import codechicken.core.asm.ObfuscationMappings; | ||
import fr.catcore.fabricatedforge.Constants; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ObfuscationManager.ClassMapping.class) | ||
@Mixin(ObfuscationMappings.ClassMapping.class) | ||
public class ClassMappingMixin { | ||
@Shadow(remap = false) public String classname; | ||
@Shadow(remap = false) public String s_class; | ||
|
||
@Inject(method = "<init>", remap = false, at = @At("RETURN")) | ||
private void remapClassName(String classname, CallbackInfo ci) { | ||
if (!this.classname.contains(".")) { | ||
this.classname = Constants.getRemappedClassName(this.classname); | ||
} | ||
this.s_class = Constants.getRemappedClassName(this.s_class).replace(".", "/"); | ||
} | ||
} |
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
88 changes: 88 additions & 0 deletions
88
.../java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/DescriptorMappingMixin.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,88 @@ | ||
package fr.catcore.fabricatedforge.compat.mixin.codechickencore; | ||
|
||
import codechicken.core.asm.ObfuscationMappings; | ||
import fr.catcore.fabricatedforge.Constants; | ||
import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair; | ||
import org.objectweb.asm.tree.MethodInsnNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(ObfuscationMappings.DescriptorMapping.class) | ||
public class DescriptorMappingMixin { | ||
|
||
@Shadow(remap = false) public String s_owner; | ||
|
||
@Shadow(remap = false) public String s_name; | ||
|
||
@Shadow(remap = false) public String s_desc; | ||
|
||
@Inject(method = "<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", remap = false, at = @At("RETURN")) | ||
private void remap(String declaringclass, String methodname, String descriptor, CallbackInfo ci) { | ||
this.remap(); | ||
} | ||
|
||
@Inject(method = "<init>(Ljava/lang/String;Lcodechicken/core/asm/ObfuscationMappings$DescriptorMapping;)V", remap = false, at = @At("RETURN")) | ||
private void remap(String owner, ObfuscationMappings.DescriptorMapping descmap, CallbackInfo ci) { | ||
this.remap(); | ||
} | ||
|
||
@Unique | ||
private void remap() { | ||
if (!this.s_owner.contains("/")) { | ||
this.s_owner = Constants.getRemappedClassName(this.s_owner).replace(".", "/"); | ||
} | ||
if (this.s_desc.startsWith("(")) { | ||
Pair<String, String> pair = Constants.getRemappedMethodName(this.s_owner, this.s_name, this.s_desc); | ||
this.s_name = pair.first(); | ||
this.s_desc = Constants.remapMethodDescriptor(pair.second()); | ||
} else { | ||
Pair<String, String> pair = Constants.getRemappedFieldName(this.s_owner, this.s_name, this.s_desc); | ||
this.s_name = pair.first(); | ||
this.s_desc = Constants.remapIndividualType(pair.second()); | ||
} | ||
} | ||
|
||
// /** | ||
// * @author CatCore | ||
// * @reason fix match because of the way methods are added to classes | ||
// */ | ||
// @Overwrite(remap = false) | ||
// public boolean matches(MethodNode node) { | ||
// String className = this.getClassNameForMethod(); | ||
// | ||
// System.out.println(this.s_owner + " -> " + className); | ||
// | ||
// return this.s_name.equals(node.name) && this.s_desc.equals(node.desc); | ||
// } | ||
// | ||
// /** | ||
// * @author CatCore | ||
// * @reason fix match because of the way methods are added to classes | ||
// */ | ||
// @Overwrite(remap = false) | ||
// public boolean matches(MethodInsnNode node) { | ||
// String className = this.getClassNameForMethod(); | ||
// | ||
// System.out.println(this.s_name + " -> " + className + " : " + node.owner); | ||
// | ||
// return className.equals(node.owner) && this.s_name.equals(node.name) && this.s_desc.equals(node.desc); | ||
// } | ||
// | ||
// @Unique | ||
// private String getClassNameForMethod() { | ||
// if (this.s_owner.equals("net/minecraft/class_197") && ( | ||
// this.s_name.equals("canBeReplacedByLeaves") | ||
// || this.s_name.equals("isAirBlock") | ||
// )) { | ||
// return "fr/catcore/fabricatedforge/mixininterface/IBlock"; | ||
// } | ||
// | ||
// return this.s_name; | ||
// } | ||
} |
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
29 changes: 0 additions & 29 deletions
29
.../main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/FieldMappingMixin.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
...main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/MethodMappingMixin.java
This file was deleted.
Oops, something went wrong.
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
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
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