Implement Forge ingredient invalidation correctly
This commit is contained in:
parent
e30a7fccf2
commit
e411f11c0c
|
|
@ -17,6 +17,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -169,4 +170,9 @@ public abstract class IngredientMixin implements ExtendedIngredient {
|
||||||
public void mfix$clearReference() {
|
public void mfix$clearReference() {
|
||||||
this.mfix$cachedItemStacks = null;
|
this.mfix$cachedItemStacks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "invalidate", at = @At("RETURN"), remap = false)
|
||||||
|
private void invalidateSoftReference(CallbackInfo ci) {
|
||||||
|
mfix$clearReference();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user