Skip to content

Commit

Permalink
Add mixin to OreIngredient to get the oredict name (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak authored Jul 23, 2024
1 parent cca1525 commit 6067df5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.cleanroommc.groovyscript.core.mixin;

import net.minecraftforge.oredict.OreIngredient;
import org.spongepowered.asm.mixin.Mixin;
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(value = OreIngredient.class, remap = false)
public class OreIngredientMixin {

@Unique
private String groovyScript$oreDict;

@Inject(at = @At("TAIL"), method = "<init>(Ljava/lang/String;)V")
private void init(String ore, CallbackInfo ci) {
groovyScript$oreDict = ore;
}

@Unique
public String getOreDict() {
return groovyScript$oreDict;
}

}
1 change: 1 addition & 0 deletions src/main/resources/mixin.groovyscript.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ItemStackMixin",
"LoaderControllerMixin",
"OreDictionaryAccessor",
"OreIngredientMixin",
"SlotCraftingAccess",
"TileEntityPistonMixin",
"groovy.AsmDecompilerMixin",
Expand Down

0 comments on commit 6067df5

Please sign in to comment.