Fix #102
This commit is contained in:
parent
0dfcc950ca
commit
db2a555ae9
1 changed files with 16 additions and 14 deletions
|
@ -35,23 +35,25 @@ 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) {
|
||||||
int anvLevel = context.run((world, blockPos) -> {
|
if (context != ScreenHandlerContext.EMPTY) {
|
||||||
Block anvilBlock = world.getBlockState(blockPos).getBlock();
|
int anvLevel = context.run((world, blockPos) -> {
|
||||||
if (anvilBlock instanceof EndAnvilBlock) {
|
Block anvilBlock = world.getBlockState(blockPos).getBlock();
|
||||||
return ((EndAnvilBlock) anvilBlock).getCraftingLevel();
|
if (anvilBlock instanceof EndAnvilBlock) {
|
||||||
}
|
return ((EndAnvilBlock) anvilBlock).getCraftingLevel();
|
||||||
return 1;
|
}
|
||||||
}, 1);
|
return 1;
|
||||||
Property anvilLevel = Property.create();
|
}, 1);
|
||||||
anvilLevel.set(anvLevel);
|
Property anvilLevel = Property.create();
|
||||||
this.anvilLevel = addProperty(anvilLevel);
|
anvilLevel.set(anvLevel);
|
||||||
|
this.anvilLevel = addProperty(anvilLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue