Fixes missing upstream

This commit is contained in:
Sotr
2018-07-15 21:58:30 +08:00
parent 3875266bb7
commit ff00b7556e
3 changed files with 10 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ package net.minecraft.server;
import com.destroystokyo.paper.exception.ServerInternalException; import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues; import com.google.common.collect.Queues;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@@ -681,7 +682,9 @@ public class Chunk {
entity.ac = k; entity.ac = k;
entity.ad = this.locZ; entity.ad = this.locZ;
this.entitySlices[k].add(entity); this.entitySlices[k].add(entity);
// Paper start - update count // Paper start
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
itemCounts[k]++; itemCounts[k]++;
} else if (entity instanceof IInventory) { } else if (entity instanceof IInventory) {
@@ -703,10 +706,6 @@ public class Chunk {
this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 ); this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 );
} }
} }
// Paper start
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
// Paper end
// Spigot end // Spigot end
} }
@@ -724,8 +723,10 @@ public class Chunk {
i = this.entitySlices.length - 1; i = this.entitySlices.length - 1;
} }
if (!this.entitySlices[i].remove(entity)) { return; } // Paper // Paper start
// Paper start - update counts if (!this.entitySlices[i].remove(entity)) { return; }
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
itemCounts[i]--; itemCounts[i]--;
} else if (entity instanceof IInventory) { } else if (entity instanceof IInventory) {
@@ -747,10 +748,6 @@ public class Chunk {
this.entityCount.adjustValue( creatureType.a(), -1 ); this.entityCount.adjustValue( creatureType.a(), -1 );
} }
} }
// Paper start
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
// Paper end
// Spigot end // Spigot end
} }

View File

@@ -1686,6 +1686,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
if (event.isCancelled()) { if (event.isCancelled()) {
this.player.updateInventory(this.player.activeContainer); // Paper - Refresh player inventory
return; return;
} }
// CraftBukkit end // CraftBukkit end