Fix #102
This commit is contained in:
parent
0dfcc950ca
commit
db2a555ae9
1 changed files with 16 additions and 14 deletions
|
@ -35,13 +35,14 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
||||||
private AnvilRecipe be_currentRecipe;
|
private AnvilRecipe be_currentRecipe;
|
||||||
private Property anvilLevel;
|
private Property anvilLevel;
|
||||||
|
|
||||||
public AnvilScreenHandlerMixin(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory,
|
public AnvilScreenHandlerMixin(int syncId, PlayerInventory playerInventory) {
|
||||||
ScreenHandlerContext context) {
|
super(ScreenHandlerType.ANVIL, syncId, playerInventory, ScreenHandlerContext.EMPTY);
|
||||||
super(type, syncId, playerInventory, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
public void be_initAnvilLevel(int syncId, PlayerInventory inventory, ScreenHandlerContext context, CallbackInfo info) {
|
||||||
|
if (context != ScreenHandlerContext.EMPTY) {
|
||||||
int anvLevel = context.run((world, blockPos) -> {
|
int anvLevel = context.run((world, blockPos) -> {
|
||||||
Block anvilBlock = world.getBlockState(blockPos).getBlock();
|
Block anvilBlock = world.getBlockState(blockPos).getBlock();
|
||||||
if (anvilBlock instanceof EndAnvilBlock) {
|
if (anvilBlock instanceof EndAnvilBlock) {
|
||||||
|
@ -53,6 +54,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
||||||
anvilLevel.set(anvLevel);
|
anvilLevel.set(anvLevel);
|
||||||
this.anvilLevel = addProperty(anvilLevel);
|
this.anvilLevel = addProperty(anvilLevel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract void updateResult();
|
public abstract void updateResult();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue