@@ -179,7 +179,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,6 +926,11 @@
|
||||
@@ -830,6 +924,11 @@
|
||||
}
|
||||
|
||||
public ItemStack getCarried() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerAnvil.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerAnvil.java
|
||||
@@ -19,6 +19,10 @@
|
||||
@@ -21,6 +21,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class ContainerAnvil extends ContainerAnvilAbstract {
|
||||
|
||||
public static final int INPUT_SLOT = 0;
|
||||
@@ -42,6 +46,11 @@
|
||||
@@ -44,6 +48,11 @@
|
||||
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;
|
||||
@@ -23,16 +23,16 @@
|
||||
|
||||
public ContainerAnvil(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.NULL);
|
||||
@@ -69,7 +78,7 @@
|
||||
@@ -71,7 +80,7 @@
|
||||
|
||||
@Override
|
||||
protected boolean mayPickup(EntityHuman entityhuman, boolean flag) {
|
||||
- return (entityhuman.getAbilities().instabuild || entityhuman.experienceLevel >= this.cost.get()) && this.cost.get() > 0;
|
||||
+ return (entityhuman.getAbilities().instabuild || entityhuman.experienceLevel >= this.cost.get()) && this.cost.get() > ContainerAnvil.DEFAULT_DENIED_COST && flag; // CraftBukkit - allow cost 0 like a free item
|
||||
- return (entityhuman.hasInfiniteMaterials() || entityhuman.experienceLevel >= this.cost.get()) && this.cost.get() > 0;
|
||||
+ return (entityhuman.hasInfiniteMaterials() || entityhuman.experienceLevel >= this.cost.get()) && this.cost.get() > ContainerAnvil.DEFAULT_DENIED_COST && flag; // CraftBukkit - allow cost 0 like a free item
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,7 +101,7 @@
|
||||
@@ -94,7 +103,7 @@
|
||||
this.inputSlots.setItem(1, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -41,17 +41,6 @@
|
||||
this.access.execute((world, blockposition) -> {
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
@@ -123,8 +132,8 @@
|
||||
byte b1 = 0;
|
||||
|
||||
if (itemstack.isEmpty()) {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
- this.cost.set(0);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
+ this.cost.set(DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item
|
||||
} else {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
ItemStack itemstack2 = this.inputSlots.getItem(1);
|
||||
@@ -141,8 +150,8 @@
|
||||
if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) {
|
||||
k = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4);
|
||||
@@ -74,7 +63,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -246,8 +255,8 @@
|
||||
@@ -231,8 +240,8 @@
|
||||
}
|
||||
|
||||
if (flag2 && !flag1) {
|
||||
@@ -85,13 +74,13 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -270,11 +279,11 @@
|
||||
@@ -257,11 +266,11 @@
|
||||
itemstack1 = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- if (b1 == i && b1 > 0 && this.cost.get() >= 40) {
|
||||
- if (b0 == i && b0 > 0 && this.cost.get() >= 40) {
|
||||
- this.cost.set(39);
|
||||
+ if (b1 == i && b1 > 0 && this.cost.get() >= maximumRepairCost) { // CraftBukkit
|
||||
+ if (b0 == i && b0 > 0 && this.cost.get() >= maximumRepairCost) { // CraftBukkit
|
||||
+ this.cost.set(maximumRepairCost - 1); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -100,17 +89,23 @@
|
||||
itemstack1 = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -293,7 +302,8 @@
|
||||
EnchantmentManager.setEnchantments(map, itemstack1);
|
||||
@@ -279,11 +288,12 @@
|
||||
EnchantmentManager.setEnchantments(itemstack1, itemenchantments_a.toImmutable());
|
||||
}
|
||||
|
||||
- this.resultSlots.setItem(0, itemstack1);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit
|
||||
+ sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client
|
||||
this.broadcastChanges();
|
||||
} else {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
- this.cost.set(0);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
+ this.cost.set(DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item
|
||||
}
|
||||
}
|
||||
@@ -334,4 +344,18 @@
|
||||
|
||||
@@ -323,4 +333,18 @@
|
||||
public int getCost() {
|
||||
return this.cost.get();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java
|
||||
@@ -47,7 +47,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
final ItemCombinerMenuSlotDefinition.b itemcombinermenuslotdefinition_b = (ItemCombinerMenuSlotDefinition.b) iterator.next();
|
||||
|
||||
- this.addSlot(new Slot(this, this.inputSlots, itemcombinermenuslotdefinition_b.slotIndex(), itemcombinermenuslotdefinition_b.x(), itemcombinermenuslotdefinition_b.y()) {
|
||||
+ this.addSlot(new Slot(this.inputSlots, itemcombinermenuslotdefinition_b.slotIndex(), itemcombinermenuslotdefinition_b.x(), itemcombinermenuslotdefinition_b.y()) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemcombinermenuslotdefinition_b.mayPlace().test(itemstack);
|
||||
@@ -124,6 +124,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
+ if (!this.checkReachable) return true; // CraftBukkit
|
||||
return (Boolean) this.access.evaluate((world, blockposition) -> {
|
||||
return !this.isValidBlock(world.getBlockState(blockposition)) ? false : entityhuman.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
|
||||
return !this.isValidBlock(world.getBlockState(blockposition)) ? false : entityhuman.canInteractWithBlock(blockposition, 4.0D);
|
||||
}, true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerBeacon.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
|
||||
@@ -12,6 +12,11 @@
|
||||
@@ -13,6 +13,11 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ContainerBeacon extends Container {
|
||||
|
||||
private static final int PAYMENT_SLOT = 0;
|
||||
@@ -26,6 +31,10 @@
|
||||
@@ -27,6 +32,10 @@
|
||||
private final ContainerBeacon.SlotBeacon paymentSlot;
|
||||
private final ContainerAccess access;
|
||||
private final IContainerProperties beaconData;
|
||||
@@ -23,15 +23,17 @@
|
||||
|
||||
public ContainerBeacon(int i, IInventory iinventory) {
|
||||
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
|
||||
@@ -33,6 +42,7 @@
|
||||
@@ -34,7 +43,8 @@
|
||||
|
||||
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
|
||||
super(Containers.BEACON, i);
|
||||
- this.beacon = new InventorySubcontainer(this, 1) {
|
||||
+ player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this
|
||||
this.beacon = new InventorySubcontainer(1) {
|
||||
+ this.beacon = new InventorySubcontainer(1) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean canPlaceItem(int j, ItemStack itemstack) {
|
||||
@@ -82,6 +92,7 @@
|
||||
return itemstack.is(TagsItem.BEACON_PAYMENT_ITEMS);
|
||||
@@ -83,6 +93,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
@@ -39,18 +41,18 @@
|
||||
return stillValid(this.access, entityhuman, Blocks.BEACON);
|
||||
}
|
||||
|
||||
@@ -163,8 +174,8 @@
|
||||
@@ -164,8 +175,8 @@
|
||||
|
||||
public void updateEffects(Optional<MobEffectList> optional, Optional<MobEffectList> optional1) {
|
||||
public void updateEffects(Optional<Holder<MobEffectList>> optional, Optional<Holder<MobEffectList>> optional1) {
|
||||
if (this.paymentSlot.hasItem()) {
|
||||
- this.beaconData.set(1, encodeEffect((MobEffectList) optional.orElse((Object) null)));
|
||||
- this.beaconData.set(2, encodeEffect((MobEffectList) optional1.orElse((Object) null)));
|
||||
+ this.beaconData.set(1, encodeEffect((MobEffectList) optional.orElse(null))); // CraftBukkit - decompile error
|
||||
+ this.beaconData.set(2, encodeEffect((MobEffectList) optional1.orElse(null))); // CraftBukkit - decompile error
|
||||
- this.beaconData.set(1, encodeEffect((Holder) optional.orElse((Object) null)));
|
||||
- this.beaconData.set(2, encodeEffect((Holder) optional1.orElse((Object) null)));
|
||||
+ this.beaconData.set(1, encodeEffect((Holder) optional.orElse(null)));// CraftBukkit - decompile error
|
||||
+ this.beaconData.set(2, encodeEffect((Holder) optional1.orElse(null)));// CraftBukkit - decompile error
|
||||
this.paymentSlot.remove(1);
|
||||
this.access.execute(World::blockEntityChanged);
|
||||
}
|
||||
@@ -191,4 +202,17 @@
|
||||
@@ -192,4 +203,17 @@
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
|
||||
@@ -13,6 +13,11 @@
|
||||
@@ -15,6 +15,11 @@
|
||||
import net.minecraft.world.item.alchemy.PotionContents;
|
||||
import net.minecraft.world.item.alchemy.PotionRegistry;
|
||||
import net.minecraft.world.item.alchemy.PotionUtil;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ContainerBrewingStand extends Container {
|
||||
|
||||
private static final int BOTTLE_SLOT_START = 0;
|
||||
@@ -29,12 +34,18 @@
|
||||
@@ -31,12 +36,18 @@
|
||||
private final IContainerProperties brewingStandData;
|
||||
private final Slot ingredientSlot;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
checkContainerSize(iinventory, 5);
|
||||
checkContainerDataCount(icontainerproperties, 2);
|
||||
this.brewingStand = iinventory;
|
||||
@@ -62,6 +73,7 @@
|
||||
@@ -66,6 +77,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
@@ -39,8 +39,8 @@
|
||||
return this.brewingStand.stillValid(entityhuman);
|
||||
}
|
||||
|
||||
@@ -199,4 +211,17 @@
|
||||
return 64;
|
||||
@@ -196,4 +208,17 @@
|
||||
return itemstack.is(Items.BLAZE_POWDER);
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerCartography.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerCartography.java
|
||||
@@ -12,8 +12,30 @@
|
||||
@@ -14,8 +14,30 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
public static final int MAP_SLOT = 0;
|
||||
public static final int ADDITIONAL_SLOT = 1;
|
||||
public static final int RESULT_SLOT = 2;
|
||||
@@ -38,6 +60,13 @@
|
||||
@@ -40,6 +62,13 @@
|
||||
ContainerCartography.this.slotsChanged(this);
|
||||
super.setChanged();
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
};
|
||||
this.resultContainer = new InventoryCraftResult() {
|
||||
@Override
|
||||
@@ -45,6 +74,13 @@
|
||||
@@ -47,15 +76,22 @@
|
||||
ContainerCartography.this.slotsChanged(this);
|
||||
super.setChanged();
|
||||
}
|
||||
@@ -58,8 +58,19 @@
|
||||
+ // CraftBukkit end
|
||||
};
|
||||
this.access = containeraccess;
|
||||
this.addSlot(new Slot(this.container, 0, 15, 15) {
|
||||
@@ -95,10 +131,12 @@
|
||||
- this.addSlot(new Slot(this, this.container, 0, 15, 15) {
|
||||
+ this.addSlot(new Slot(this.container, 0, 15, 15) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.FILLED_MAP);
|
||||
}
|
||||
});
|
||||
- this.addSlot(new Slot(this, this.container, 1, 15, 52) {
|
||||
+ this.addSlot(new Slot(this.container, 1, 15, 52) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.PAPER) || itemstack.is(Items.MAP) || itemstack.is(Items.GLASS_PANE);
|
||||
@@ -97,10 +133,12 @@
|
||||
this.addSlot(new Slot(playerinventory, j, 8 + j * 18, 142));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerEnchantTable.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerEnchantTable.java
|
||||
@@ -27,6 +27,21 @@
|
||||
@@ -25,6 +25,21 @@
|
||||
import net.minecraft.world.level.block.BlockEnchantmentTable;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
public class ContainerEnchantTable extends Container {
|
||||
|
||||
static final MinecraftKey EMPTY_SLOT_LAPIS_LAZULI = new MinecraftKey("item/empty_slot_lapis_lazuli");
|
||||
@@ -37,6 +52,10 @@
|
||||
@@ -35,6 +50,10 @@
|
||||
public final int[] costs;
|
||||
public final int[] enchantClue;
|
||||
public final int[] levelClue;
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.NULL);
|
||||
@@ -50,6 +69,13 @@
|
||||
@@ -48,6 +67,13 @@
|
||||
super.setChanged();
|
||||
ContainerEnchantTable.this.slotsChanged(this);
|
||||
}
|
||||
@@ -47,7 +47,23 @@
|
||||
};
|
||||
this.random = RandomSource.create();
|
||||
this.enchantmentSeed = ContainerProperty.standalone();
|
||||
@@ -97,6 +123,9 @@
|
||||
@@ -55,13 +81,13 @@
|
||||
this.enchantClue = new int[]{-1, -1, -1};
|
||||
this.levelClue = new int[]{-1, -1, -1};
|
||||
this.access = containeraccess;
|
||||
- this.addSlot(new Slot(this, this.enchantSlots, 0, 15, 47) {
|
||||
+ this.addSlot(new Slot(this.enchantSlots, 0, 15, 47) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
- this.addSlot(new Slot(this, this.enchantSlots, 1, 35, 47) {
|
||||
+ this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.LAPIS_LAZULI);
|
||||
@@ -95,6 +121,9 @@
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 0));
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 1));
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 2));
|
||||
@@ -57,7 +73,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,7 +133,7 @@
|
||||
@@ -102,7 +131,7 @@
|
||||
if (iinventory == this.enchantSlots) {
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
|
||||
@@ -66,7 +82,7 @@
|
||||
this.access.execute((world, blockposition) -> {
|
||||
int i = 0;
|
||||
Iterator iterator = BlockEnchantmentTable.BOOKSHELF_OFFSETS.iterator();
|
||||
@@ -143,6 +172,41 @@
|
||||
@@ -141,6 +170,41 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +124,9 @@
|
||||
this.broadcastChanges();
|
||||
});
|
||||
} else {
|
||||
@@ -170,8 +234,25 @@
|
||||
@@ -168,21 +232,46 @@
|
||||
ItemStack itemstack2 = itemstack;
|
||||
List<WeightedRandomEnchant> list = this.getEnchantmentList(itemstack, i, this.costs[i]);
|
||||
List<WeightedRandomEnchant> list = this.getEnchantmentList(world.enabledFeatures(), itemstack, i, this.costs[i]);
|
||||
|
||||
- if (!list.isEmpty()) {
|
||||
- entityhuman.onEnchantmentPerformed(itemstack, j);
|
||||
@@ -133,10 +149,8 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag = itemstack.is(Items.BOOK);
|
||||
|
||||
if (flag) {
|
||||
@@ -185,18 +266,30 @@
|
||||
if (itemstack.is(Items.BOOK)) {
|
||||
itemstack2 = itemstack.transmuteCopy(Items.ENCHANTED_BOOK, 1);
|
||||
this.enchantSlots.setItem(0, itemstack2);
|
||||
}
|
||||
|
||||
@@ -146,36 +160,24 @@
|
||||
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) iterator.next();
|
||||
+ // CraftBukkit start
|
||||
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
|
||||
+ try {
|
||||
+ if (flag) {
|
||||
+ NamespacedKey enchantId = entry.getKey().getKey();
|
||||
+ Enchantment nms = BuiltInRegistries.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
|
||||
+ if (nms == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ NamespacedKey enchantId = entry.getKey().getKey();
|
||||
+ Enchantment nms = BuiltInRegistries.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
|
||||
+ if (nms == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- if (flag) {
|
||||
- ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
|
||||
- } else {
|
||||
- itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
|
||||
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
|
||||
+ ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
|
||||
+ } else {
|
||||
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
|
||||
+ }
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ /* Just swallow invalid enchantments */
|
||||
}
|
||||
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
|
||||
itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
|
||||
}
|
||||
|
||||
+ entityhuman.onEnchantmentPerformed(itemstack, j);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit - TODO: let plugins change this
|
||||
if (!entityhuman.getAbilities().instabuild) {
|
||||
if (!entityhuman.hasInfiniteMaterials()) {
|
||||
itemstack1.shrink(j);
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -259,6 +352,7 @@
|
||||
@@ -245,6 +334,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
@@ -183,7 +185,7 @@
|
||||
return stillValid(this.access, entityhuman, Blocks.ENCHANTING_TABLE);
|
||||
}
|
||||
|
||||
@@ -309,4 +403,17 @@
|
||||
@@ -295,4 +385,17 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
public static final int MAX_NAME_LENGTH = 35;
|
||||
public static final int INPUT_SLOT = 0;
|
||||
public static final int ADDITIONAL_SLOT = 1;
|
||||
@@ -46,6 +68,13 @@
|
||||
@@ -46,15 +68,22 @@
|
||||
super.setChanged();
|
||||
ContainerGrindstone.this.slotsChanged(this);
|
||||
}
|
||||
@@ -44,7 +44,18 @@
|
||||
+ // CraftBukkit end
|
||||
};
|
||||
this.access = containeraccess;
|
||||
this.addSlot(new Slot(this.repairSlots, 0, 49, 19) {
|
||||
- this.addSlot(new Slot(this, this.repairSlots, 0, 49, 19) {
|
||||
+ this.addSlot(new Slot(this.repairSlots, 0, 49, 19) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.isDamageableItem() || EnchantmentManager.hasAnyEnchantments(itemstack);
|
||||
}
|
||||
});
|
||||
- this.addSlot(new Slot(this, this.repairSlots, 1, 49, 40) {
|
||||
+ this.addSlot(new Slot(this.repairSlots, 1, 49, 40) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.isDamageableItem() || EnchantmentManager.hasAnyEnchantments(itemstack);
|
||||
@@ -124,6 +153,7 @@
|
||||
this.addSlot(new Slot(playerinventory, j, 8 + j * 18, 142));
|
||||
}
|
||||
@@ -53,50 +64,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,7 +175,7 @@
|
||||
boolean flag2 = !itemstack.isEmpty() && !itemstack.is(Items.ENCHANTED_BOOK) && !itemstack.isEnchanted() || !itemstack1.isEmpty() && !itemstack1.is(Items.ENCHANTED_BOOK) && !itemstack1.isEnchanted();
|
||||
|
||||
if (itemstack.getCount() > 1 || itemstack1.getCount() > 1 || !flag1 && flag2) {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
this.broadcastChanges();
|
||||
return;
|
||||
}
|
||||
@@ -156,7 +186,7 @@
|
||||
|
||||
if (flag1) {
|
||||
if (!itemstack.is(itemstack1.getItem())) {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
this.broadcastChanges();
|
||||
return;
|
||||
}
|
||||
@@ -170,7 +200,7 @@
|
||||
itemstack2 = this.mergeEnchants(itemstack, itemstack1);
|
||||
if (!itemstack2.isDamageableItem()) {
|
||||
if (!ItemStack.matches(itemstack, itemstack1)) {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
this.broadcastChanges();
|
||||
return;
|
||||
}
|
||||
@@ -183,12 +213,12 @@
|
||||
i = flag3 ? itemstack.getDamageValue() : itemstack1.getDamageValue();
|
||||
itemstack2 = flag3 ? itemstack : itemstack1;
|
||||
}
|
||||
-
|
||||
- this.resultSlots.setItem(0, this.removeNonCurses(itemstack2, i, b0));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), this.removeNonCurses(itemstack2, i, b0)); // CraftBukkit
|
||||
} else {
|
||||
- this.resultSlots.setItem(0, ItemStack.EMPTY);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
}
|
||||
@@ -136,7 +166,8 @@
|
||||
}
|
||||
|
||||
private void createResult() {
|
||||
- this.resultSlots.setItem(0, this.computeResult(this.repairSlots.getItem(0), this.repairSlots.getItem(1)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), this.computeResult(this.repairSlots.getItem(0), this.repairSlots.getItem(1))); // CraftBukkit
|
||||
+ sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client
|
||||
this.broadcastChanges();
|
||||
}
|
||||
|
||||
@@ -250,6 +280,7 @@
|
||||
@@ -238,6 +269,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerHorse.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerHorse.java
|
||||
@@ -8,13 +8,33 @@
|
||||
@@ -9,6 +9,11 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
public class ContainerHorse extends Container {
|
||||
|
||||
private final IInventory horseContainer;
|
||||
private final EntityHorseAbstract horse;
|
||||
@@ -17,8 +22,23 @@
|
||||
private static final int SLOT_BODY_ARMOR = 1;
|
||||
private static final int SLOT_HORSE_INVENTORY_START = 2;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity;
|
||||
@@ -32,5 +34,23 @@
|
||||
+ player = playerinventory;
|
||||
+ // CraftBukkit end
|
||||
this.horseContainer = iinventory;
|
||||
this.armorContainer = entityhorseabstract.getBodyArmorAccess();
|
||||
this.horse = entityhorseabstract;
|
||||
boolean flag = true;
|
||||
@@ -27,7 +47,7 @@
|
||||
iinventory.startOpen(playerinventory.player);
|
||||
boolean flag1 = true;
|
||||
|
||||
- this.addSlot(new Slot(this, iinventory, 0, 8, 18) {
|
||||
+ this.addSlot(new Slot(iinventory, 0, 8, 18) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.SADDLE) && !this.hasItem() && entityhorseabstract.isSaddleable();
|
||||
@@ -38,7 +58,7 @@
|
||||
return entityhorseabstract.isSaddleable();
|
||||
}
|
||||
});
|
||||
- this.addSlot(new Slot(this, this.armorContainer, 0, 8, 36) {
|
||||
+ this.addSlot(new Slot(this.armorContainer, 0, 8, 36) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return entityhorseabstract.isBodyArmorItem(itemstack);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerLoom.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerLoom.java
|
||||
@@ -24,8 +24,30 @@
|
||||
@@ -23,8 +23,30 @@
|
||||
import net.minecraft.world.level.block.entity.BannerPatternLayers;
|
||||
import net.minecraft.world.level.block.entity.EnumBannerPatternType;
|
||||
import net.minecraft.world.level.block.entity.TileEntityTypes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
@@ -45,7 +45,7 @@
|
||||
};
|
||||
this.outputContainer = new InventorySubcontainer(1) {
|
||||
@Override
|
||||
@@ -67,6 +96,13 @@
|
||||
@@ -67,21 +96,28 @@
|
||||
super.setChanged();
|
||||
ContainerLoom.this.slotUpdateListener.run();
|
||||
}
|
||||
@@ -58,11 +58,29 @@
|
||||
+ // CraftBukkit end
|
||||
};
|
||||
this.access = containeraccess;
|
||||
this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) {
|
||||
@@ -127,10 +163,12 @@
|
||||
}
|
||||
- this.bannerSlot = this.addSlot(new Slot(this, this.inputContainer, 0, 13, 26) {
|
||||
+ this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.getItem() instanceof ItemBanner;
|
||||
}
|
||||
});
|
||||
- this.dyeSlot = this.addSlot(new Slot(this, this.inputContainer, 1, 33, 26) {
|
||||
+ this.dyeSlot = this.addSlot(new Slot(this.inputContainer, 1, 33, 26) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.getItem() instanceof ItemDye;
|
||||
}
|
||||
});
|
||||
- this.patternSlot = this.addSlot(new Slot(this, this.inputContainer, 2, 23, 45) {
|
||||
+ this.patternSlot = this.addSlot(new Slot(this.inputContainer, 2, 23, 45) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.getItem() instanceof ItemBannerPattern;
|
||||
@@ -128,10 +164,12 @@
|
||||
|
||||
this.addDataSlot(this.selectedBannerPatternIndex);
|
||||
this.patternGetter = playerinventory.player.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN);
|
||||
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -72,15 +90,15 @@
|
||||
return stillValid(this.access, entityhuman, Blocks.LOOM);
|
||||
}
|
||||
|
||||
@@ -308,6 +346,11 @@
|
||||
@@ -306,6 +344,11 @@
|
||||
EnumColor enumcolor = ((ItemDye) itemstack1.getItem()).getDyeColor();
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("Patterns", 9)) {
|
||||
nbttaglist = nbttagcompound.getList("Patterns", 10);
|
||||
itemstack2.update(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY, (bannerpatternlayers) -> {
|
||||
+ // CraftBukkit start
|
||||
+ while (nbttaglist.size() > 20) {
|
||||
+ nbttaglist.remove(20);
|
||||
+ if (bannerpatternlayers.layers().size() > 20) {
|
||||
+ bannerpatternlayers = new BannerPatternLayers(List.copyOf(bannerpatternlayers.layers().subList(0, 20)));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
nbttaglist = new NBTTagList();
|
||||
if (nbttagcompound == null) {
|
||||
return (new BannerPatternLayers.a()).addAll(bannerpatternlayers).add(holder, enumcolor).build();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerMerchant.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerMerchant.java
|
||||
@@ -12,6 +12,8 @@
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.item.trading.MerchantRecipe;
|
||||
import net.minecraft.world.item.trading.MerchantRecipeList;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class ContainerMerchant extends Container {
|
||||
|
||||
protected static final int PAYMENT1_SLOT = 0;
|
||||
@@ -31,6 +33,19 @@
|
||||
@@ -32,6 +34,19 @@
|
||||
private boolean showProgressBar;
|
||||
private boolean canRestock;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
public ContainerMerchant(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, new MerchantWrapper(playerinventory.player));
|
||||
}
|
||||
@@ -42,6 +57,7 @@
|
||||
@@ -43,6 +58,7 @@
|
||||
this.addSlot(new Slot(this.tradeContainer, 0, 136, 37));
|
||||
this.addSlot(new Slot(this.tradeContainer, 1, 162, 37));
|
||||
this.addSlot(new SlotMerchantResult(playerinventory.player, imerchant, this.tradeContainer, 2, 220, 37));
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
int j;
|
||||
|
||||
@@ -154,7 +170,7 @@
|
||||
@@ -155,7 +171,7 @@
|
||||
}
|
||||
|
||||
private void playTradeSound() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class ContainerPlayer extends ContainerRecipeBook<InventoryCrafting> {
|
||||
|
||||
public static final int CONTAINER_ID = 0;
|
||||
@@ -34,15 +40,28 @@
|
||||
@@ -36,15 +42,28 @@
|
||||
public static final MinecraftKey EMPTY_ARMOR_SLOT_SHIELD = new MinecraftKey("item/empty_armor_slot_shield");
|
||||
static final MinecraftKey[] TEXTURE_EMPTY_SLOTS = new MinecraftKey[]{ContainerPlayer.EMPTY_ARMOR_SLOT_BOOTS, ContainerPlayer.EMPTY_ARMOR_SLOT_LEGGINGS, ContainerPlayer.EMPTY_ARMOR_SLOT_CHESTPLATE, ContainerPlayer.EMPTY_ARMOR_SLOT_HELMET};
|
||||
private static final EnumItemSlot[] SLOT_IDS = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
|
||||
@@ -44,7 +44,25 @@
|
||||
this.addSlot(new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 154, 28));
|
||||
|
||||
int i;
|
||||
@@ -259,4 +278,17 @@
|
||||
@@ -59,7 +78,7 @@
|
||||
for (i = 0; i < 4; ++i) {
|
||||
final EnumItemSlot enumitemslot = ContainerPlayer.SLOT_IDS[i];
|
||||
|
||||
- this.addSlot(new Slot(this, playerinventory, 39 - i, 8, 8 + i * 18) {
|
||||
+ this.addSlot(new Slot(playerinventory, 39 - i, 8, 8 + i * 18) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public void setByPlayer(ItemStack itemstack, ItemStack itemstack1) {
|
||||
ContainerPlayer.onEquipItem(entityhuman, enumitemslot, itemstack, itemstack1);
|
||||
@@ -100,7 +119,7 @@
|
||||
this.addSlot(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
- this.addSlot(new Slot(this, playerinventory, 40, 77, 62) {
|
||||
+ this.addSlot(new Slot(playerinventory, 40, 77, 62) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public void setByPlayer(ItemStack itemstack, ItemStack itemstack1) {
|
||||
ContainerPlayer.onEquipItem(entityhuman, EnumItemSlot.OFFHAND, itemstack, itemstack1);
|
||||
@@ -261,4 +280,17 @@
|
||||
public boolean shouldMoveToInventory(int i) {
|
||||
return i != this.getResultSlotIndex();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/CrafterMenu.java
|
||||
+++ b/net/minecraft/world/inventory/CrafterMenu.java
|
||||
@@ -8,8 +8,27 @@
|
||||
@@ -9,8 +9,27 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.CrafterBlock;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
protected static final int SLOT_COUNT = 9;
|
||||
private static final int INV_SLOT_START = 9;
|
||||
private static final int INV_SLOT_END = 36;
|
||||
@@ -116,6 +135,7 @@
|
||||
@@ -117,6 +136,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/InventoryEnderChest.java
|
||||
+++ b/net/minecraft/world/inventory/InventoryEnderChest.java
|
||||
@@ -8,13 +8,32 @@
|
||||
@@ -9,13 +9,32 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.TileEntityEnderChest;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/inventory/SlotFurnaceResult.java
|
||||
+++ b/net/minecraft/world/inventory/SlotFurnaceResult.java
|
||||
@@ -54,7 +54,7 @@
|
||||
if (iinventory instanceof TileEntityFurnace) {
|
||||
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) iinventory;
|
||||
@@ -51,7 +51,7 @@
|
||||
IInventory iinventory = this.container;
|
||||
|
||||
if (iinventory instanceof TileEntityFurnace tileentityfurnace) {
|
||||
- tileentityfurnace.awardUsedRecipesAndPopExperience(entityplayer);
|
||||
+ tileentityfurnace.awardUsedRecipesAndPopExperience(entityplayer, itemstack, this.removeCount); // CraftBukkit
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user