Update to Minecraft 1.14-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-04-23 12:00:00 +10:00
parent 0e98365784
commit a0f2b74c8d
560 changed files with 10642 additions and 10867 deletions

View File

@@ -1,48 +1,78 @@
--- a/net/minecraft/server/ContainerWorkbench.java
+++ b/net/minecraft/server/ContainerWorkbench.java
@@ -1,14 +1,29 @@
@@ -1,6 +1,10 @@
package net.minecraft.server;
import java.util.Optional;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class ContainerWorkbench extends ContainerRecipeBook {
- public InventoryCrafting craftInventory = new InventoryCrafting(this, 3, 3);
- public InventoryCraftResult resultInventory = new InventoryCraftResult();
+ public InventoryCrafting craftInventory; // CraftBukkit - move initialization into constructor
+ public InventoryCraftResult resultInventory; // CraftBukkit - move initialization into constructor
private final World g;
private final BlockPosition h;
private final EntityHuman i;
public class ContainerWorkbench extends ContainerRecipeBook<InventoryCrafting> {
@@ -8,6 +12,10 @@
private final InventoryCraftResult resultInventory;
private final ContainerAccess e;
private final EntityHuman f;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+ // CraftBukkit end
public ContainerWorkbench(PlayerInventory playerinventory, World world, BlockPosition blockposition) {
public ContainerWorkbench(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -15,8 +23,12 @@
public ContainerWorkbench(int i, PlayerInventory playerinventory, ContainerAccess containeraccess) {
super(Containers.CRAFTING, i);
- this.craftInventory = new InventoryCrafting(this, 3, 3);
+ // CraftBukkit start - Switched order of IInventory construction and stored player
+ this.resultInventory = new InventoryCraftResult();
this.resultInventory = new InventoryCraftResult();
+ this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
+ this.craftInventory.resultInventory = this.resultInventory;
+ this.player = playerinventory;
+ // CraftBukkit end
this.g = world;
this.h = blockposition;
this.i = playerinventory.player;
@@ -60,6 +75,7 @@
this.e = containeraccess;
this.f = playerinventory.player;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
@@ -42,7 +54,7 @@
}
- protected static void a(int i, World world, EntityHuman entityhuman, InventoryCrafting inventorycrafting, InventoryCraftResult inventorycraftresult) {
+ protected static void a(int i, World world, EntityHuman entityhuman, InventoryCrafting inventorycrafting, InventoryCraftResult inventorycraftresult, Container container) { // CraftBukkit
if (!world.isClientSide) {
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
ItemStack itemstack = ItemStack.a;
@@ -55,6 +67,7 @@
itemstack = recipecrafting.a(inventorycrafting);
}
}
+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), false); // CraftBukkit
inventorycraftresult.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(i, 0, itemstack));
@@ -64,7 +77,7 @@
@Override
public void a(IInventory iinventory) {
this.e.a((world, blockposition) -> {
- a(this.windowId, world, this.f, this.craftInventory, this.resultInventory);
+ a(this.windowId, world, this.f, this.craftInventory, this.resultInventory, this); // CraftBukkit
});
}
@@ -94,6 +107,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.g.getType(this.h).getBlock() != Blocks.CRAFTING_TABLE ? false : entityhuman.d((double) this.h.getX() + 0.5D, (double) this.h.getY() + 0.5D, (double) this.h.getZ() + 0.5D) <= 64.0D;
return a(this.e, entityhuman, Blocks.CRAFTING_TABLE);
}
@@ -125,4 +141,17 @@
public int g() {
return this.craftInventory.n();
@@ -166,4 +180,17 @@
public int h() {
return this.craftInventory.f();
}
+
+ // CraftBukkit start