This commit is contained in:
Aleksey 2021-02-26 22:39:43 +03:00
parent 0dfcc950ca
commit db2a555ae9

View file

@ -35,13 +35,14 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
private AnvilRecipe be_currentRecipe;
private Property anvilLevel;
public AnvilScreenHandlerMixin(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory,
ScreenHandlerContext context) {
super(type, syncId, playerInventory, context);
public AnvilScreenHandlerMixin(int syncId, PlayerInventory playerInventory) {
super(ScreenHandlerType.ANVIL, syncId, playerInventory, ScreenHandlerContext.EMPTY);
}
@Inject(method = "<init>*", at = @At("TAIL"))
@Inject(method = "<init>(ILnet/minecraft/entity/player/PlayerInventory;Lnet/minecraft/screen/ScreenHandlerContext;)V",
at = @At("TAIL"))
public void be_initAnvilLevel(int syncId, PlayerInventory inventory, ScreenHandlerContext context, CallbackInfo info) {
if (context != ScreenHandlerContext.EMPTY) {
int anvLevel = context.run((world, blockPos) -> {
Block anvilBlock = world.getBlockState(blockPos).getBlock();
if (anvilBlock instanceof EndAnvilBlock) {
@ -53,6 +54,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
anvilLevel.set(anvLevel);
this.anvilLevel = addProperty(anvilLevel);
}
}
@Shadow
public abstract void updateResult();