Improved Anvil-Level handling

This commit is contained in:
Frank 2022-07-28 19:52:07 +02:00
parent bb15db429d
commit 2aa13a76ee
9 changed files with 64 additions and 53 deletions

View file

@ -58,14 +58,11 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
if (context != ContainerLevelAccess.NULL) {
int level = context.evaluate((world, blockPos) -> {
Block anvilBlock = world.getBlockState(blockPos).getBlock();
if (anvilBlock instanceof LeveledAnvilBlock) {
return ((LeveledAnvilBlock) anvilBlock).getCraftingLevel();
}
return 1;
}, 1);
return LeveledAnvilBlock.getAnvilCraftingLevel(anvilBlock);
}, 0);
anvilLevel.set(level);
} else {
anvilLevel.set(1);
anvilLevel.set(0);
}
}