1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/AnvilMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AnvilMenu.java
|
||||
@@ -43,6 +_,12 @@
|
||||
@@ -44,6 +_,12 @@
|
||||
private static final int ADDITIONAL_SLOT_X_PLACEMENT = 76;
|
||||
private static final int RESULT_SLOT_X_PLACEMENT = 134;
|
||||
private static final int SLOT_Y_PLACEMENT = 47;
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
public AnvilMenu(int containerId, Inventory playerInventory) {
|
||||
this(containerId, playerInventory, ContainerLevelAccess.NULL);
|
||||
@@ -68,7 +_,7 @@
|
||||
@@ -69,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected boolean mayPickup(Player player, boolean hasStack) {
|
||||
@@ -22,14 +22,16 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,12 +_,22 @@
|
||||
@@ -90,7 +_,7 @@
|
||||
this.inputSlots.setItem(1, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- this.cost.set(0);
|
||||
+ this.cost.set(AnvilMenu.DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item
|
||||
this.inputSlots.setItem(0, ItemStack.EMPTY);
|
||||
this.access.execute((level, blockPos) -> {
|
||||
if (player instanceof ServerPlayer serverPlayer
|
||||
&& !StringUtil.isBlank(this.itemName)
|
||||
&& !this.inputSlots.getItem(0).getHoverName().getString().equals(this.itemName)) {
|
||||
@@ -102,6 +_,16 @@
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
if (!player.hasInfiniteMaterials() && blockState.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) {
|
||||
BlockState blockState1 = AnvilBlock.damage(blockState);
|
||||
@@ -46,7 +48,7 @@
|
||||
if (blockState1 == null) {
|
||||
level.removeBlock(blockPos, false);
|
||||
level.levelEvent(1029, blockPos, 0);
|
||||
@@ -127,8 +_,8 @@
|
||||
@@ -134,8 +_,8 @@
|
||||
if (itemStack.isDamageableItem() && item.isValidRepairItem(item1)) {
|
||||
int min = Math.min(itemStack.getDamageValue(), itemStack.getMaxDamage() / 4);
|
||||
if (min <= 0) {
|
||||
@@ -57,7 +59,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,8 +_,8 @@
|
||||
@@ -150,8 +_,8 @@
|
||||
this.repairItemCountCost = i2;
|
||||
} else {
|
||||
if (!hasStoredEnchantments && (!itemStack.is(item1.getItem()) || !itemStack.isDamageableItem())) {
|
||||
@@ -68,7 +70,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +_,7 @@
|
||||
@@ -197,7 +_,7 @@
|
||||
flag1 = true;
|
||||
} else {
|
||||
flag = true;
|
||||
@@ -77,7 +79,7 @@
|
||||
intValue = enchantment.getMaxLevel();
|
||||
}
|
||||
|
||||
@@ -208,8 +_,8 @@
|
||||
@@ -215,8 +_,8 @@
|
||||
}
|
||||
|
||||
if (flag1 && !flag) {
|
||||
@@ -88,7 +90,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -234,14 +_,16 @@
|
||||
@@ -241,14 +_,16 @@
|
||||
}
|
||||
|
||||
if (i1 == i && i1 > 0) {
|
||||
@@ -108,7 +110,7 @@
|
||||
itemStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -259,12 +_,13 @@
|
||||
@@ -266,12 +_,13 @@
|
||||
EnchantmentHelper.setEnchantments(itemStack, mutable.toImmutable());
|
||||
}
|
||||
|
||||
@@ -125,7 +127,7 @@
|
||||
}
|
||||
|
||||
public static int calculateIncreasedRepairCost(int oldRepairCost) {
|
||||
@@ -285,6 +_,7 @@
|
||||
@@ -292,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.createResult();
|
||||
@@ -133,7 +135,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -300,4 +_,19 @@
|
||||
@@ -307,4 +_,19 @@
|
||||
public int getCost() {
|
||||
return this.cost.get();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
+ // Paper start - Fire BlockExpEvent on grindstone use
|
||||
+ org.bukkit.event.block.BlockExpEvent event = new org.bukkit.event.block.BlockExpEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, blockPos), this.getExperienceAmount(level));
|
||||
+ event.callEvent();
|
||||
+ ExperienceOrb.award((ServerLevel) level, Vec3.atCenterOf(blockPos), event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player);
|
||||
+ ExperienceOrb.awardWithDirection((ServerLevel) level, Vec3.atCenterOf(blockPos), Vec3.ZERO, event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player, null);
|
||||
+ // Paper end - Fire BlockExpEvent on grindstone use
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user