3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00

Merge branch 'master' into pre/1.13

* master:
  MC-135506: Experience should save as Integers
  Fix EXP orb merging causing values to go negative - Closes #1169
  Add "Safe Regen" Duplicate UUID resolver and make default
Dieser Commit ist enthalten in:
Aikar 2018-08-03 01:29:20 -04:00
Commit 0f479b740d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
13 geänderte Dateien mit 135 neuen und 87 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 6d0cbb0a82daf262ca29e25e37b2c002eec424c0 Mon Sep 17 00:00:00 2001
From 74c77acc857f97071521e3aa54a850b09074e6a0 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Nov 2017 23:03:12 -0500
Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 23cb3feef..1c642e636 100644
index 23cb3feef0..1c642e6364 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -362,4 +362,10 @@ public class PaperWorldConfig {
@ -20,16 +20,16 @@ index 23cb3feef..1c642e636 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 412300fbb..ffafaddba 100644
index ed21614e0b..0e7fa6a0f2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1005,16 +1005,30 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1005,16 +1005,31 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
double radius = spigotConfig.expMerge;
if (radius > 0) {
+ // Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics
+ final int maxValue = paperConfig.expMergeMaxValue;
+ final boolean mergeUnconditionally = maxValue <= 0;
+ final boolean mergeUnconditionally = paperConfig.expMergeMaxValue <= 0;
+ if (mergeUnconditionally || xp.value < maxValue) { // Paper - Skip iteration if unnecessary
+
List<Entity> entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius));
@ -37,16 +37,19 @@ index 412300fbb..ffafaddba 100644
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
- if (!loopItem.dead) {
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper
xp.value += loopItem.value;
+ // Paper start
+ if (!mergeUnconditionally && xp.value > maxValue) {
- xp.value += loopItem.value;
- loopItem.die();
+ // Paper start
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
+ long newTotal = (long)xp.value + (long)loopItem.value;
+ if (newTotal > (long)maxValue) {
+ loopItem.value = xp.value - maxValue;
+ xp.value = maxValue;
+ break;
+ } else {
+ xp.value += loopItem.value;
+ loopItem.die();
+ }
+ // Paper end
loopItem.die();
}
}
}

Datei anzeigen

@ -1,4 +1,4 @@
From c9bc942cb9de94f6ac94ffe2736290433283f15a Mon Sep 17 00:00:00 2001
From a52f0dc0ac68a35e4ba71589eeab5fe3e1e06e84 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:57:26 -0500
Subject: [PATCH] ExperienceOrbMergeEvent
@ -8,18 +8,18 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d3b64b741..a961705fb 100644
index d40725b17a..0f56969270 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1014,7 +1014,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
for (Entity e : entities) {
@@ -1015,7 +1015,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue) && new com.destroystokyo.paper.event.entity.ExperienceOrbMergeEvent((org.bukkit.entity.ExperienceOrb) entity.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) loopItem.getBukkitEntity()).callEvent()) { // Paper
xp.value += loopItem.value;
// Paper start
if (!mergeUnconditionally && xp.value > maxValue) {
// Paper start
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue) && new com.destroystokyo.paper.event.entity.ExperienceOrbMergeEvent((org.bukkit.entity.ExperienceOrb) entity.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) loopItem.getBukkitEntity()).callEvent()) {
long newTotal = (long)xp.value + (long)loopItem.value;
if (newTotal > (long)maxValue) {
loopItem.value = xp.value - maxValue;
--
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From 13a7093e1a97f051dff1b9f20e415d15a18f0fcf Mon Sep 17 00:00:00 2001
From 5141b8c2ab3839058f95e6bbc02d06eb04d48a54 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 03:39:51 -0400
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
@ -10,7 +10,7 @@ to the object directly on the Entity/TileEntity object we can directly grab.
Use that local value instead to reduce lookups in many hot places.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 8e6d32bd8..3ac115ff6 100644
index d2e87693fa..1997cbdc65 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -721,6 +721,7 @@ public class Chunk implements IChunkAccess {
@ -22,10 +22,10 @@ index 8e6d32bd8..3ac115ff6 100644
this.a(entity, entity.af);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a961705fb..8dc6ca207 100644
index 0f56969270..29678af2de 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1219,12 +1219,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1220,12 +1220,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
int j;
// Paper start - Set based removal lists
for (Entity e : this.g) {
@ -42,7 +42,7 @@ index a961705fb..8dc6ca207 100644
}
for (Entity e : this.g) {
@@ -1285,12 +1288,17 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1286,12 +1289,17 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.methodProfiler.e();
this.methodProfiler.a("remove");
if (entity.dead) {
@ -61,7 +61,7 @@ index a961705fb..8dc6ca207 100644
guardEntityList = false; // Spigot
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
@@ -1335,7 +1343,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1336,7 +1344,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
BlockPosition blockposition = tileentity.getPosition();
// Paper start - Skip ticking in chunks scheduled for unload
@ -70,7 +70,7 @@ index a961705fb..8dc6ca207 100644
boolean shouldTick = chunk != null;
if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
shouldTick = shouldTick && !chunk.isUnloading() && chunk.scheduledForUnload == null;
@@ -1371,8 +1379,11 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1372,8 +1380,11 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
//this.tileEntityList.remove(tileentity); // Paper - remove unused list

Datei anzeigen

@ -1,4 +1,4 @@
From 389db970dedee85efee0802e63c40bd36ca9d40b Mon Sep 17 00:00:00 2001
From 0df97ae8dc5deef81b75512e44b935f2e01404b7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 14:27:34 -0400
Subject: [PATCH] Duplicate UUID Resolve Option
@ -33,21 +33,25 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7bd7aa0d9..5d9bed3f1 100644
index 7bd7aa0d94..50d3483eb0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -430,4 +430,40 @@ public class PaperWorldConfig {
@@ -430,4 +430,44 @@ public class PaperWorldConfig {
log("Bed Search Radius: " + bedSearchRadius);
}
}
+
+ public enum DuplicateUUIDMode {
+ REGEN, DELETE, NOTHING, WARN
+ SAFE_REGEN, REGEN, DELETE, NOTHING, WARN
+ }
+ public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.REGEN;
+ public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN;
+ private void repairDuplicateUUID() {
+ String desiredMode = getString("duplicate-uuid-resolver", "regenerate").toLowerCase().trim();
+ String desiredMode = getString("duplicate-uuid-resolver", "saferegen").toLowerCase().trim();
+ switch (desiredMode.toLowerCase()) {
+ case "saferegen":
+ case "saferegenerate":
+ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN;
+ log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates)");
+ case "regen":
+ case "regenerate":
+ duplicateUUIDMode = DuplicateUUIDMode.REGEN;
@ -78,7 +82,7 @@ index 7bd7aa0d9..5d9bed3f1 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1997cbdc6..114a13b62 100644
index 1997cbdc65..2838f4e822 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,10 @@
@ -108,7 +112,7 @@ index 1997cbdc6..114a13b62 100644
}
int k = MathHelper.floor(entity.locY / 16.0D);
@@ -865,6 +872,39 @@ public class Chunk implements IChunkAccess {
@@ -865,6 +872,50 @@ public class Chunk implements IChunkAccess {
for (int j = 0; j < i; ++j) {
List entityslice = aentityslice[j]; // Spigot
@ -123,8 +127,19 @@ index 1997cbdc6..114a13b62 100644
+ if (other == null || other.dead || world.getEntityUnloadQueue().contains(other)) {
+ other = thisChunk.get(entity.uniqueID);
+ }
+
+ if (mode == DuplicateUUIDMode.SAFE_REGEN && other != null && !other.dead &&
+ !world.getEntityUnloadQueue().contains(other)
+ && java.util.Objects.equals(other.getSaveID(), entity.getSaveID())
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < 24
+ ) {
+ logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.die();
+ continue;
+ }
+ if (other != null && !other.dead) {
+ switch (mode) {
+ case SAFE_REGEN:
+ case REGEN: {
+ entity.setUUID(UUID.randomUUID());
+ logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
@ -149,7 +164,7 @@ index 1997cbdc6..114a13b62 100644
this.world.a((Collection) entityslice);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ff22feee4..9ab635058 100644
index ff22feee4d..9ab6350587 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2724,6 +2724,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -161,7 +176,7 @@ index ff22feee4..9ab635058 100644
this.uniqueID = uuid;
this.au = this.uniqueID.toString();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1295078cd..25362ff8e 100644
index 29678af2de..0de1847639 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -72,7 +72,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@ -174,7 +189,7 @@ index 1295078cd..25362ff8e 100644
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 747d99dbe..7a9f28421 100644
index 747d99dbe6..7a9f28421b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -40,7 +40,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -220,5 +235,5 @@ index 747d99dbe..7a9f28421 100644
logger.error("Overwrote an existing entity " + old + " with " + entity);
if (DEBUG_ENTITIES) {
--
2.17.1
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From 375fbe4d01f7278fb61f27a3047b7166af568025 Mon Sep 17 00:00:00 2001
From ed36f876be22fd9feaf46b86d2f69971d513158d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Apr 2018 11:21:48 -0400
Subject: [PATCH] Configurable Allowance of Permanent Chunk Loaders
@ -7,10 +7,10 @@ This disables the behavior that allows players to keep chunks permanently loaded
by default and allows server operators to enable it if they wish.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5d9bed3f1..9d3e6cc46 100644
index 50d3483eb0..5b14973810 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -466,4 +466,9 @@ public class PaperWorldConfig {
@@ -470,4 +470,9 @@ public class PaperWorldConfig {
break;
}
}
@ -21,7 +21,7 @@ index 5d9bed3f1..9d3e6cc46 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 497372124..0e0c7b1ab 100644
index 4973721243..0e0c7b1abe 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -111,7 +111,7 @@ public class ChunkProviderServer implements IChunkProvider {

Datei anzeigen

@ -1,11 +1,11 @@
From f3e80d88055dc83c911a8e814da000624e91006a Mon Sep 17 00:00:00 2001
From 25962f106f179d9d346451ce9c64d7279a590e06 Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 12:57:39 +0200
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 9d3e6cc46..5fb330096 100644
index 5b14973810..77fda4051e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -350,6 +350,11 @@ public class PaperWorldConfig {
@ -21,7 +21,7 @@ index 9d3e6cc46..5fb330096 100644
private void maxEntityCollision() {
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b7e92d70f..40943f809 100644
index 0de1847639..6f063dc935 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -11,6 +11,7 @@ import java.util.Iterator;
@ -32,7 +32,7 @@ index b7e92d70f..40943f809 100644
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
@@ -1573,6 +1574,14 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1574,6 +1575,14 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
}

Datei anzeigen

@ -1,11 +1,11 @@
From 26d01acf2550d31956c23abe48f53a3a84c18ce3 Mon Sep 17 00:00:00 2001
From aebc84bf99be4cd7ae93c2943ddd77d4766a6c7f Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 14:22:26 +0200
Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9ab635058..4315804dd 100644
index 9ab6350587..4315804ddb 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -93,7 +93,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -18,7 +18,7 @@ index 9ab635058..4315804dd 100644
protected int k;
private Entity ax;
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
index c8f305e6d..b57f6efb3 100644
index c8f305e6d6..b57f6efb3a 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -179,6 +179,7 @@ public interface IBlockData extends IBlockDataHolder<IBlockData> {
@ -30,7 +30,7 @@ index c8f305e6d..b57f6efb3 100644
return this.getBlock().f(this, iblockaccess, blockposition);
}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 1cecccef2..afc881d9a 100644
index 1cecccef23..afc881d9af 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -70,7 +70,8 @@ public class ItemBlock extends Item {
@ -44,7 +44,7 @@ index 1cecccef2..afc881d9a 100644
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), CraftBlockData.fromData(iblockdata), defaultReturn);
blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 53c9f2188..71e408432 100644
index 53c9f21887..71e4084320 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -22,6 +22,7 @@ public abstract class VoxelShape {
@ -64,10 +64,10 @@ index 53c9f2188..71e408432 100644
return this.a.a();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 47b9f1c47..52cf52ea7 100644
index 6f063dc935..94a4bf3c7a 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1556,6 +1556,37 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1557,6 +1557,37 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
}
@ -106,7 +106,7 @@ index 47b9f1c47..52cf52ea7 100644
if (voxelshape.b()) {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cf398cd25..140ddae0d 100644
index cf398cd250..140ddae0d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -804,6 +804,14 @@ public class CraftEventFactory {
@ -125,5 +125,5 @@ index cf398cd25..140ddae0d 100644
return event;
}
--
2.17.1
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From c77d662147a1ed8f12c92092b0fc71754f24430d Mon Sep 17 00:00:00 2001
From 7770668b1869f7a081c3e33a64e977d30f4d9237 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 92a3c8b5d..6d4b9adff 100644
index 2461b5cdd1..eb728f66aa 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -712,8 +712,33 @@ public class Chunk implements IChunkAccess {
@ -60,7 +60,7 @@ index 92a3c8b5d..6d4b9adff 100644
this.markDirty();
if (entity instanceof EntityItem) {
itemCounts[i]--;
@@ -968,6 +999,7 @@ public class Chunk implements IChunkAccess {
@@ -979,6 +1010,7 @@ public class Chunk implements IChunkAccess {
}
// Spigot End
entity.setCurrentChunk(null); // Paper
@ -69,7 +69,7 @@ index 92a3c8b5d..6d4b9adff 100644
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4315804dd..785c31089 100644
index 4315804ddb..785c31089e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -64,6 +64,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -81,5 +81,5 @@ index 4315804dd..785c31089 100644
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
--
2.17.1
2.18.0

Datei anzeigen

@ -1,4 +1,4 @@
From 586eacd69777a9e5e020fe3397b05fd6a55bd4bf Mon Sep 17 00:00:00 2001
From b8d0747c9e80896a7ecfe94b4cb3d1601229e5f0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 26 Jul 2018 00:11:12 -0400
Subject: [PATCH] Prevent Saving Bad entities to chunks
@ -57,10 +57,10 @@ index a97e024ec4..bd52bf6561 100644
nbttagcompound.set("Entities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 52cf52ea73..89d0127afd 100644
index 94a4bf3c7a..eb56940a18 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1064,7 +1064,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1065,7 +1065,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
this.getChunkAt(i, j).a(entity);

Datei anzeigen

@ -1,4 +1,4 @@
From 47975722cb4b98f424a68262b9275ac8f22b02fc Mon Sep 17 00:00:00 2001
From 41011bfa8744eec1ba2c81054d8e20cb2cf73e82 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:09:20 -0400
Subject: [PATCH] Always process chunk removal in removeEntity
@ -8,10 +8,10 @@ which can keep them in the chunk when they shouldnt be if done
during entity ticking.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 89d0127afd..f8458a2b49 100644
index eb56940a18..7f999cbd5b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1134,7 +1134,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1135,7 +1135,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.everyoneSleeping();
}
@ -20,7 +20,7 @@ index 89d0127afd..f8458a2b49 100644
int i = entity.ae;
int j = entity.ag;
@@ -1142,6 +1142,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1143,6 +1143,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.getChunkAt(i, j).b(entity);
}

Datei anzeigen

@ -1,4 +1,4 @@
From 121f02ef0dd8b89d16f5abef8e779bb658f98c10 Mon Sep 17 00:00:00 2001
From e22b56e894628cbeb7e529a3f81e4e56c45329ab Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since
they shouldn't of been in the list in the first place.
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index 7ff8e70b2..4e854c6db 100644
index 7ff8e70b24..4e854c6dbe 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -172,6 +172,7 @@ public class PaperCommand extends Command {
@ -23,7 +23,7 @@ index 7ff8e70b2..4e854c6db 100644
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 785c31089..6b0ca4eb9 100644
index 785c31089e..6b0ca4eb98 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -122,6 +122,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -35,10 +35,10 @@ index 785c31089..6b0ca4eb9 100644
public float length;
public float J;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f8458a2b4..60a2729ad 100644
index 7f999cbd5b..397915a553 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1076,6 +1076,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1077,6 +1077,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
entity.valid = true; // CraftBukkit
@ -46,7 +46,7 @@ index f8458a2b4..60a2729ad 100644
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
@@ -1141,6 +1142,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1142,6 +1143,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
this.getChunkAt(i, j).b(entity);
}
@ -54,7 +54,7 @@ index f8458a2b4..60a2729ad 100644
if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
@@ -2348,6 +2350,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2349,6 +2351,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -62,7 +62,7 @@ index f8458a2b4..60a2729ad 100644
if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) {
arraylist.add(entity);
@@ -2434,6 +2437,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2435,6 +2438,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -71,7 +71,7 @@ index f8458a2b4..60a2729ad 100644
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f4dc7e4ac..8923df898 100644
index f4dc7e4ac6..8923df898f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -660,6 +660,7 @@ public class CraftWorld implements World {
@ -107,5 +107,5 @@ index f4dc7e4ac..8923df898 100644
if (bukkitEntity == null) {
--
2.17.1
2.18.0

Datei anzeigen

@ -1,11 +1,11 @@
From c9e6dd33ed8c202f81aaddcfe777e9e7bfcaba3b Mon Sep 17 00:00:00 2001
From c5e45cdd1991ea4afb82da70fc11ca2c59f070b6 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 30 Jul 2018 02:42:49 -0400
Subject: [PATCH] World EntityHuman Lookup Optimizations
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 60a2729ad..c2b9d60f8 100644
index 397915a553..29877418c9 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -79,6 +79,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@ -16,7 +16,7 @@ index 60a2729ad..c2b9d60f8 100644
public final List<Entity> k = Lists.newArrayList();
protected final IntHashMap<Entity> entitiesById = new IntHashMap();
private final long G = 16777215L;
@@ -1060,6 +1061,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1061,6 +1062,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
EntityHuman entityhuman = (EntityHuman) entity;
this.players.add(entityhuman);
@ -25,7 +25,7 @@ index 60a2729ad..c2b9d60f8 100644
this.everyoneSleeping();
}
@@ -1102,6 +1105,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1103,6 +1106,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -33,7 +33,7 @@ index 60a2729ad..c2b9d60f8 100644
// Spigot start
for ( Object o : worldMaps.d )
{
@@ -1132,6 +1136,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -1133,6 +1137,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -41,7 +41,7 @@ index 60a2729ad..c2b9d60f8 100644
this.everyoneSleeping();
}
@@ -2660,6 +2665,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2661,6 +2666,8 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@Nullable
public EntityHuman a(String s) {
@ -50,7 +50,7 @@ index 60a2729ad..c2b9d60f8 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2669,10 +2676,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2670,10 +2677,15 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
return null;
@ -66,7 +66,7 @@ index 60a2729ad..c2b9d60f8 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2682,6 +2694,10 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
@@ -2683,6 +2695,10 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
}
return null;
@ -78,5 +78,5 @@ index 60a2729ad..c2b9d60f8 100644
public void checkSession() throws ExceptionWorldConflict {
--
2.17.1
2.18.0

Datei anzeigen

@ -0,0 +1,30 @@
From 59d357424f02eb0ccb9a600333fc477ee52fbe1f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 00:04:54 -0400
Subject: [PATCH] MC-135506: Experience should save as Integers
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index b8bfc75771..1cffc6f9a9 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -205,14 +205,14 @@ public class EntityExperienceOrb extends Entity {
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) this.d);
nbttagcompound.setShort("Age", (short) this.b);
- nbttagcompound.setShort("Value", (short) this.value);
+ nbttagcompound.setInt("Value", (short) this.value); // Paper - save as Integer
savePaperNBT(nbttagcompound); // Paper
}
public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.getShort("Health");
this.b = nbttagcompound.getShort("Age");
- this.value = nbttagcompound.getShort("Value");
+ this.value = nbttagcompound.getInt("Value"); // Paper - load as Integer
loadPaperNBT(nbttagcompound); // Paper
}
--
2.18.0