Skip to content

Commit

Permalink
Fix compatibility with latest EMI release
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed May 11, 2024
1 parent aae92d9 commit 7acf141
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
git config --global user.name Docs deploy
git config --global user.email [email protected]
mike set-default latest
mike deploy --push --update-aliases 0.5.x latest
mike deploy --push --update-aliases 0.5.x
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fabric_version=0.83.0+1.20.1

maven_group = eu.pb4

mod_version = 0.5.19
mod_version = 0.5.20

minecraft_version_supported = ">=1.20-"

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion polymer-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies {

//modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:9.1.530"
modCompileOnly /*modLocalRuntime*/ ("me.shedaniel:RoughlyEnoughItems-fabric:12.0.645")
modCompileOnly /*modLocalRuntime*/("dev.emi:emi-fabric:1.0.19+1.20.1")
modCompileOnly /*modLocalRuntime*/("dev.emi:emi-fabric:1.1.6+1.20.1")

//modCompileOnlyApi modLocalRuntime("mezz.jei:jei-1.19-common:11.0.0.206")
//modCompileOnlyApi modLocalRuntime("mezz.jei:jei-1.19-fabric:11.0.0.206")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package eu.pb4.polymer.core.mixin.client.compat;

import dev.emi.emi.api.stack.ItemEmiStack;
import eu.pb4.polymer.core.api.item.PolymerItemUtils;
import eu.pb4.polymer.core.impl.client.compat.CompatUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import org.spongepowered.asm.mixin.Final;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -17,22 +18,28 @@
@Environment(EnvType.CLIENT)
@Pseudo
@Mixin(ItemEmiStack.class)
public abstract class emi_ItemEmiStackMixin {
public abstract class emi_ItemEmiStack2Mixin {
@Shadow public abstract ItemStack getItemStack();

@Shadow @Final private ItemStack stack;

/*@Inject(method = "getKey", at = @At("HEAD"), cancellable = true, remap = false, require = 0)
@Inject(method = "getKey", at = @At("HEAD"), cancellable = true, remap = false, require = 0)
private void polymer$getKey(CallbackInfoReturnable<Object> cir) {
if (CompatUtils.isServerSide(this.stack)) {
cir.setReturnValue(CompatUtils.getKey(this.stack));
if (CompatUtils.isServerSide(this.getItemStack())) {
cir.setReturnValue(CompatUtils.getKey(this.getItemStack()));
}
}*/
}

@Inject(method = "getId", at = @At("HEAD"), cancellable = true, remap = false, require = 0)
private void polymer$getId(CallbackInfoReturnable<Identifier> cir) {
var x = PolymerItemUtils.getServerIdentifier(this.getItemStack());
if (x != null) {
cir.setReturnValue(x);
}
}

@Inject(method = "getNbt", at = @At("HEAD"), cancellable = true, remap = false, require = 0)
private void polymer$getNbt(CallbackInfoReturnable<NbtCompound> cir) {
if (CompatUtils.isServerSide(this.stack)) {
cir.setReturnValue(CompatUtils.getBackingNbt(this.stack));
if (CompatUtils.isServerSide(this.getItemStack())) {
cir.setReturnValue(CompatUtils.getBackingNbt(this.getItemStack()));
}
}
}
2 changes: 1 addition & 1 deletion polymer-core/src/main/resources/polymer-core.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"client.block.EmptyChunkMixin",
"client.block.WorldChunkMixin",
"client.compat.emi_EmiStackMixin",
"client.compat.emi_ItemEmiStackMixin",
"client.compat.emi_ItemEmiStack2Mixin",
"client.compat.jei_StackHelperMixin",
"client.compat.rei_ItemEntryDefinitionMixin",
"client.entity.EntityMixin",
Expand Down

0 comments on commit 7acf141

Please sign in to comment.