[CI-SKIP] Remove some unneeded patches from removed folder
illegal packet concept is gone hoppers was old version, newer version was under diff file name jungle appears completely different and inapplicable now invalid stats was already re-applied
This commit is contained in:
parent
7b466d5f83
commit
62a5faf378
4 changed files with 0 additions and 451 deletions
|
@ -1,57 +0,0 @@
|
|||
From aca58cb4ceffa038818092885a94f1d5ba41b5ca Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 20 Dec 2016 23:09:21 -0600
|
||||
Subject: [PATCH] Add option to remove invalid statistics
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 459c86bce..ea6fcb39f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -262,4 +262,13 @@ public class PaperConfig {
|
||||
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static boolean removeInvalidStatistics = false;
|
||||
+ private static void removeInvalidStatistics() {
|
||||
+ if (version < 12) {
|
||||
+ boolean oldValue = getBoolean("remove-invalid-statistics", false);
|
||||
+ set("settings.remove-invalid-statistics", oldValue);
|
||||
+ }
|
||||
+ removeInvalidStatistics = getBoolean("settings.remove-invalid-statistics", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
index 14af226f3..e3d2c0ff7 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
@@ -86,6 +86,7 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
JsonObject jsonobject = jsonelement.getAsJsonObject();
|
||||
HashMap hashmap = Maps.newHashMap();
|
||||
Iterator iterator = jsonobject.entrySet().iterator();
|
||||
+ java.util.List<String> invalidStats = com.google.common.collect.Lists.newArrayList(); // Paper
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entry entry = (Entry) iterator.next();
|
||||
@@ -119,9 +120,17 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
hashmap.put(statistic, statisticwrapper);
|
||||
} else {
|
||||
ServerStatisticManager.b.warn("Invalid statistic in {}: Don\'t know what {} is", this.d, entry.getKey());
|
||||
+ if (com.destroystokyo.paper.PaperConfig.removeInvalidStatistics) invalidStats.add((String) entry.getKey()); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Remove invalid statistics
|
||||
+ for (String invalid : invalidStats) {
|
||||
+ jsonobject.remove(invalid);
|
||||
+ ServerStatisticManager.b.info("Removing invalid statistic: " + invalid);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
return hashmap;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
From 95eb029855720de4240a9a73831f7c7ded796d98 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 23 Jun 2016 23:33:57 -0400
|
||||
Subject: [PATCH] IllegalPacketEvent
|
||||
|
||||
Fired for invalid data from players that represents hacking attempts
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 09f1ef560..cca1c6aa3 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
+import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
|
||||
import co.aikar.timings.MinecraftTimings; // Paper
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -2287,8 +2288,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
- PlayerConnection.LOGGER.error("Couldn\'t handle book info", exception);
|
||||
- this.disconnect("Invalid book data!"); // CraftBukkit
|
||||
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBookEdit", "Invalid book data!", exception); // Paper
|
||||
}
|
||||
} else {
|
||||
String s1;
|
||||
@@ -2337,8 +2337,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit
|
||||
}
|
||||
} catch (Exception exception1) {
|
||||
- PlayerConnection.LOGGER.error("Couldn\'t sign book", exception1);
|
||||
- this.disconnect("Invalid book data!"); // CraftBukkit
|
||||
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBookSign", "Invalid book data!", exception1); // Paper
|
||||
}
|
||||
} else if ("MC|TrSel".equals(s)) {
|
||||
try {
|
||||
@@ -2349,8 +2348,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
((ContainerMerchant) container).d(j);
|
||||
}
|
||||
} catch (Exception exception2) {
|
||||
- PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2);
|
||||
- this.disconnect("Invalid trade data!"); // CraftBukkit
|
||||
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidTrade", "Invalid trade data!", exception2); // Paper
|
||||
}
|
||||
} else {
|
||||
TileEntity tileentity;
|
||||
@@ -2491,8 +2489,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
iinventory.update();
|
||||
}
|
||||
} catch (Exception exception5) {
|
||||
- PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5);
|
||||
- this.disconnect("Invalid beacon data!"); // CraftBukkit
|
||||
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBeacon", "Invalid beacon data!", exception5); // Paper
|
||||
}
|
||||
}
|
||||
} else if ("MC|ItemName".equals(s)) {
|
||||
@@ -2591,8 +2588,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-2, k, this.player.inventory.getItem(k)));
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
|
||||
} catch (Exception exception7) {
|
||||
- PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7);
|
||||
- this.disconnect("Invalid pick item!"); // CraftBukkit
|
||||
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidPickItem", "Invalid PickItem", exception7); // Paper
|
||||
}
|
||||
}
|
||||
// CraftBukkit start
|
||||
--
|
||||
2.18.0
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
From 7b6363144fa307ab410333b3ad647b10ceb17aa9 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 23 Jan 2017 15:10:25 -0600
|
||||
Subject: [PATCH] Do not allow a zero max height in BiomeJungle
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeJungle.java b/src/main/java/net/minecraft/server/BiomeJungle.java
|
||||
index 8f67cb36c..8dc0b6238 100644
|
||||
--- a/src/main/java/net/minecraft/server/BiomeJungle.java
|
||||
+++ b/src/main/java/net/minecraft/server/BiomeJungle.java
|
||||
@@ -40,7 +40,11 @@ public class BiomeJungle extends BiomeBase {
|
||||
super.a(world, random, blockposition);
|
||||
int i = random.nextInt(16) + 8;
|
||||
int j = random.nextInt(16) + 8;
|
||||
- int k = random.nextInt(world.getHighestBlockYAt(blockposition.a(i, 0, j)).getY() * 2);
|
||||
+ // Paper start - Don't allow a 0 height
|
||||
+ int height = world.getHighestBlockYAt(blockposition.add(i, 0, j)).getY() * 2;
|
||||
+ if (height < 1) height = 1;
|
||||
+ int k = random.nextInt(height);
|
||||
+ // Paper end
|
||||
|
||||
(new WorldGenMelon()).generate(world, random, blockposition.a(i, k, j));
|
||||
WorldGenVines worldgenvines = new WorldGenVines();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 6a0b3a62d..38a7af58c 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -42,6 +42,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
|
||||
}
|
||||
|
||||
+ public BlockPosition add(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER
|
||||
public BlockPosition a(double d0, double d1, double d2) {
|
||||
return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2);
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
From ce497ce0dd8da9d9b5a3bbddf60f8bfcd70fd03e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 27 Apr 2016 22:09:52 -0400
|
||||
Subject: [PATCH] Optimize Hoppers
|
||||
|
||||
* Removes unnecessary extra calls to .update() that are very expensive
|
||||
* Lots of itemstack cloning removed. Only clone if the item is actually moved
|
||||
* Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items.
|
||||
However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on.
|
||||
* Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory
|
||||
* Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 9fd76dcc9..363e03b65 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -489,4 +489,12 @@ public class PaperWorldConfig {
|
||||
squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
|
||||
}
|
||||
|
||||
+ public boolean cooldownHopperWhenFull = true;
|
||||
+ public boolean disableHopperMoveEvents = false;
|
||||
+ private void hopperOptimizations() {
|
||||
+ cooldownHopperWhenFull = getBoolean("hopper.cooldown-when-full", cooldownHopperWhenFull);
|
||||
+ log("Cooldown Hoppers when Full: " + (cooldownHopperWhenFull ? "enabled" : "disabled"));
|
||||
+ disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents);
|
||||
+ log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index fcf6bac08..3092913f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -876,6 +876,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
||||
|
||||
// if (i == 0 || this.getAllowNether()) {
|
||||
WorldServer worldserver = this.worlds.get(i);
|
||||
+ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0;
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
return worldserver.getWorldData().getName();
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 5b5f102e2..3f6b34489 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -55,6 +55,7 @@ public abstract class TileEntity implements KeyedObject {
|
||||
return (MinecraftKey) TileEntity.f.b(oclass);
|
||||
}
|
||||
|
||||
+ static boolean IGNORE_TILE_UPDATES = false; // Paper
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
@@ -133,6 +134,7 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
||||
public void update() {
|
||||
if (this.world != null) {
|
||||
+ if (IGNORE_TILE_UPDATES) return; // Paper
|
||||
IBlockData iblockdata = this.world.getType(this.position);
|
||||
|
||||
this.g = iblockdata.getBlock().toLegacyData(iblockdata);
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
index e9315f2d5..5198a590a 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
@@ -196,6 +196,154 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Paper start - Optimize Hoppers
|
||||
+ private static boolean skipPullModeEventFire = false;
|
||||
+ private static boolean skipPushModeEventFire = false;
|
||||
+ static boolean skipHopperEvents = false;
|
||||
+
|
||||
+ private boolean hopperPush(IInventory iinventory, EnumDirection enumdirection) {
|
||||
+ skipPushModeEventFire = skipHopperEvents;
|
||||
+ boolean foundItem = false;
|
||||
+ for (int i = 0; i < this.getSize(); ++i) {
|
||||
+ if (!this.getItem(i).isEmpty()) {
|
||||
+ foundItem = true;
|
||||
+ ItemStack origItemStack = this.getItem(i);
|
||||
+ ItemStack itemstack = origItemStack;
|
||||
+
|
||||
+ final int origCount = origItemStack.getCount();
|
||||
+ final int moved = Math.min(world.spigotConfig.hopperAmount, origCount);
|
||||
+ origItemStack.setCount(moved);
|
||||
+
|
||||
+ // We only need to fire the event once to give protection plugins a chance to cancel this event
|
||||
+ // Because nothing uses getItem, every event call should end up the same result.
|
||||
+ if (!skipPushModeEventFire) {
|
||||
+ itemstack = callPushMoveEvent(iinventory, itemstack);
|
||||
+ if (itemstack == null) { // cancelled
|
||||
+ origItemStack.setCount(origCount);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ final ItemStack itemstack2 = addItem(this, iinventory, itemstack, enumdirection);
|
||||
+ final int remaining = itemstack2.getCount();
|
||||
+ if (remaining != moved) {
|
||||
+ origItemStack = origItemStack.cloneItemStack();
|
||||
+ origItemStack.setCount(origCount - moved + remaining);
|
||||
+ this.setItem(i, origItemStack);
|
||||
+ iinventory.update();
|
||||
+ return true;
|
||||
+ }
|
||||
+ origItemStack.setCount(origCount);
|
||||
+ }
|
||||
+ }
|
||||
+ if (foundItem && world.paperConfig.cooldownHopperWhenFull) { // Inventory was full - cooldown
|
||||
+ this.setCooldown(world.spigotConfig.hopperTransfer);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private static boolean hopperPull(IHopper ihopper, IInventory iinventory, int i) {
|
||||
+ ItemStack origItemStack = iinventory.getItem(i);
|
||||
+ ItemStack itemstack = origItemStack;
|
||||
+ final int origCount = origItemStack.getCount();
|
||||
+ final World world = ihopper.getWorld();
|
||||
+ final int moved = Math.min(world.spigotConfig.hopperAmount, origCount);
|
||||
+ itemstack.setCount(moved);
|
||||
+
|
||||
+ if (!skipPullModeEventFire) {
|
||||
+ itemstack = callPullMoveEvent(ihopper, iinventory, itemstack);
|
||||
+ if (itemstack == null) { // cancelled
|
||||
+ origItemStack.setCount(origCount);
|
||||
+ // Drastically improve performance by returning true.
|
||||
+ // No plugin could of relied on the behavior of false as the other call
|
||||
+ // site for IMIE did not exhibit the same behavior
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ final ItemStack itemstack2 = addItem(iinventory, ihopper, itemstack, null);
|
||||
+ final int remaining = itemstack2.getCount();
|
||||
+ if (remaining != moved) {
|
||||
+ origItemStack = origItemStack.cloneItemStack();
|
||||
+ origItemStack.setCount(origCount - moved + remaining);
|
||||
+ IGNORE_TILE_UPDATES = true;
|
||||
+ iinventory.setItem(i, origItemStack);
|
||||
+ IGNORE_TILE_UPDATES = false;
|
||||
+ iinventory.update();
|
||||
+ return true;
|
||||
+ }
|
||||
+ origItemStack.setCount(origCount);
|
||||
+
|
||||
+ if (world.paperConfig.cooldownHopperWhenFull) {
|
||||
+ cooldownHopper(ihopper);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private ItemStack callPushMoveEvent(IInventory iinventory, ItemStack itemstack) {
|
||||
+ Inventory destinationInventory = getInventory(iinventory);
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(this.getOwner(false).getInventory(),
|
||||
+ CraftItemStack.asCraftMirror(itemstack), destinationInventory, true);
|
||||
+ boolean result = event.callEvent();
|
||||
+ if (!event.calledGetItem && !event.calledSetItem) {
|
||||
+ skipPushModeEventFire = true;
|
||||
+ }
|
||||
+ if (!result) {
|
||||
+ cooldownHopper(this);
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ if (event.calledSetItem) {
|
||||
+ return CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ } else {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static ItemStack callPullMoveEvent(IHopper hopper, IInventory iinventory, ItemStack itemstack) {
|
||||
+ Inventory sourceInventory = getInventory(iinventory);
|
||||
+ Inventory destination = getInventory(hopper);
|
||||
+
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory,
|
||||
+ // Mirror is safe as we no plugins ever use this item
|
||||
+ CraftItemStack.asCraftMirror(itemstack), destination, false);
|
||||
+ boolean result = event.callEvent();
|
||||
+ if (!event.calledGetItem && !event.calledSetItem) {
|
||||
+ skipPullModeEventFire = true;
|
||||
+ }
|
||||
+ if (!result) {
|
||||
+ cooldownHopper(hopper);
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ if (event.calledSetItem) {
|
||||
+ return CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ } else {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static Inventory getInventory(IInventory iinventory) {
|
||||
+ Inventory sourceInventory;// Have to special case large chests as they work oddly
|
||||
+ if (iinventory instanceof InventoryLargeChest) {
|
||||
+ sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
|
||||
+ } else if (iinventory instanceof TileEntity) {
|
||||
+ sourceInventory = ((TileEntity) iinventory).getOwner(false).getInventory();
|
||||
+ } else {
|
||||
+ sourceInventory = iinventory.getOwner().getInventory();
|
||||
+ }
|
||||
+ return sourceInventory;
|
||||
+ }
|
||||
+
|
||||
+ private static void cooldownHopper(IHopper hopper) {
|
||||
+ if (hopper instanceof TileEntityHopper) {
|
||||
+ ((TileEntityHopper) hopper).setCooldown(hopper.getWorld().spigotConfig.hopperTransfer);
|
||||
+ } else if (hopper instanceof EntityMinecartHopper) {
|
||||
+ ((EntityMinecartHopper) hopper).setCooldown(hopper.getWorld().spigotConfig.hopperTransfer / 2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Paper end
|
||||
private boolean s() {
|
||||
IInventory iinventory = this.I();
|
||||
|
||||
@@ -207,6 +355,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
if (this.a(iinventory, enumdirection)) {
|
||||
return false;
|
||||
} else {
|
||||
+ return hopperPush(iinventory, enumdirection); /* // Paper - disable rest
|
||||
for (int i = 0; i < this.getSize(); ++i) {
|
||||
if (!this.getItem(i).isEmpty()) {
|
||||
ItemStack itemstack = this.getItem(i).cloneItemStack();
|
||||
@@ -248,7 +397,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
}
|
||||
}
|
||||
|
||||
- return false;
|
||||
+ return false;*/ // Paper - end commenting out replaced block for Hopper Optimizations
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,6 +475,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
if (b(iinventory, enumdirection)) {
|
||||
return false;
|
||||
}
|
||||
+ skipPullModeEventFire = skipHopperEvents; // Paper
|
||||
|
||||
if (iinventory instanceof IWorldInventory) {
|
||||
IWorldInventory iworldinventory = (IWorldInventory) iinventory;
|
||||
@@ -368,6 +518,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
ItemStack itemstack = iinventory.getItem(i);
|
||||
|
||||
if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) {
|
||||
+ return hopperPull(ihopper, iinventory, i); /* // Paper - disable rest
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
// ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.splitStack(i, 1), (EnumDirection) null);
|
||||
// CraftBukkit start - Call event on collection of items from inventories into the hopper
|
||||
@@ -408,7 +559,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
}
|
||||
|
||||
itemstack1.subtract(origCount - itemstack2.getCount()); // Spigot
|
||||
- iinventory.setItem(i, itemstack1);
|
||||
+ iinventory.setItem(i, itemstack1);*/ // Paper - end commenting out replaced block for Hopper Optimizations
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -422,7 +573,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
- InventoryPickupItemEvent event = new InventoryPickupItemEvent(iinventory1.getOwner().getInventory(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ InventoryPickupItemEvent event = new InventoryPickupItemEvent(getInventory(iinventory1), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); // Paper - avoid snapshot creation
|
||||
entityitem.world.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
@@ -477,7 +628,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
boolean flag1 = iinventory1.x_();
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
+ IGNORE_TILE_UPDATES = true; // Paper
|
||||
iinventory1.setItem(i, itemstack);
|
||||
+ IGNORE_TILE_UPDATES = false; // Paper
|
||||
itemstack = ItemStack.a;
|
||||
flag = true;
|
||||
} else if (a(itemstack1, itemstack)) {
|
||||
--
|
||||
2.18.0
|
||||
|
Loading…
Reference in a new issue