mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 04:36:13 +00:00
85 lines
3.2 KiB
Diff
85 lines
3.2 KiB
Diff
--- a/net/minecraft/world/inventory/ContainerGrindstone.java
|
|
+++ b/net/minecraft/world/inventory/ContainerGrindstone.java
|
|
@@ -20,8 +20,30 @@
|
|
import net.minecraft.world.level.block.Blocks;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryGrindstone;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+import org.bukkit.entity.Player;
|
|
+// CraftBukkit end
|
|
+
|
|
public class ContainerGrindstone extends Container {
|
|
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private Player player;
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventoryGrindstone inventory = new CraftInventoryGrindstone(this.repairSlots, this.resultSlots);
|
|
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
public static final int MAX_NAME_LENGTH = 35;
|
|
public static final int INPUT_SLOT = 0;
|
|
public static final int ADDITIONAL_SLOT = 1;
|
|
@@ -47,15 +69,22 @@
|
|
super.setChanged();
|
|
ContainerGrindstone.this.slotsChanged(this);
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public Location getLocation() {
|
|
+ return containeraccess.getLocation();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
};
|
|
this.access = containeraccess;
|
|
- 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);
|
|
@@ -113,6 +142,7 @@
|
|
}
|
|
});
|
|
this.addStandardInventorySlots(playerinventory, 8, 84);
|
|
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
|
|
}
|
|
|
|
@Override
|
|
@@ -125,7 +155,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();
|
|
}
|
|
|
|
@@ -227,6 +258,7 @@
|
|
|
|
@Override
|
|
public boolean stillValid(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return stillValid(this.access, entityhuman, Blocks.GRINDSTONE);
|
|
}
|
|
|