Use access widener instead of accessor

This commit is contained in:
tibs 2022-08-18 20:28:36 -04:00
parent 3473abfd87
commit 4de7fe39e5
Signed by untrusted user who does not match committer: tibs
GPG key ID: 047833989F50F88F
6 changed files with 9 additions and 19 deletions

View file

@ -30,6 +30,10 @@ dependencies {
modCompileOnly libs.sodium modCompileOnly libs.sodium
} }
loom {
accessWidenerPath.set file("src/main/resources/cauldron-dyeing.accesswidener")
}
processResources { processResources {
inputs.property 'version', project.version inputs.property 'version', project.version
filteringCharset 'UTF-8' filteringCharset 'UTF-8'

View file

@ -53,8 +53,7 @@ public interface CauldronBehaviorMixin {
@Inject(method = "registerBehavior", at = @At("TAIL")) @Inject(method = "registerBehavior", at = @At("TAIL"))
private static void cauldron_dyeing$injectRegisterBehavior(CallbackInfo ci) { private static void cauldron_dyeing$injectRegisterBehavior(CallbackInfo ci) {
var dyeMap = DyeItemAccessor.getDyeMap(); for (Map.Entry<DyeColor, DyeItem> dyeItem : DyeItem.DYES.entrySet()) {
for (Map.Entry<DyeColor, DyeItem> dyeItem : dyeMap.entrySet()) {
CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(dyeItem.getValue(), CauldronBehaviorExtended.DYE_WATER); CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(dyeItem.getValue(), CauldronBehaviorExtended.DYE_WATER);
} }
} }

View file

@ -1,16 +0,0 @@
package me.tibinonest.mods.cauldron_dyeing.mixin;
import net.minecraft.item.DyeItem;
import net.minecraft.util.DyeColor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.Map;
@Mixin(DyeItem.class)
public interface DyeItemAccessor {
@Accessor("DYES")
static Map<DyeColor, DyeItem> getDyeMap() {
throw new AssertionError();
}
}

View file

@ -0,0 +1,3 @@
accessWidener v1 named
accessible field net/minecraft/item/DyeItem DYES Ljava/util/Map;

View file

@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
"CauldronBehaviorMixin", "CauldronBehaviorMixin",
"DyeItemAccessor",
"LeveledCauldronBlockMixin" "LeveledCauldronBlockMixin"
], ],
"client": [ "client": [

View file

@ -19,6 +19,7 @@
"me.tibinonest.mods.cauldron_dyeing.CauldronDyeing" "me.tibinonest.mods.cauldron_dyeing.CauldronDyeing"
] ]
}, },
"accessWidener": "cauldron-dyeing.accesswidener",
"mixins": [ "mixins": [
"cauldron-dyeing.mixins.json" "cauldron-dyeing.mixins.json"
], ],