Skip to content

Commit

Permalink
Updated Upstream (Bukkit/CraftBukkit)
Browse files Browse the repository at this point in the history
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54 SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20 PR-1303: Create registry for banner pattern and cat type
4642dd5 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
  • Loading branch information
Machine-Maker committed Dec 8, 2023
1 parent f9edc4b commit 2f92d4e
Show file tree
Hide file tree
Showing 146 changed files with 141 additions and 223 deletions.
6 changes: 3 additions & 3 deletions patches/api/0173-Fix-Spigot-annotation-mistakes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,10 @@ index 26d02aa5da444112f8fa84c07e3080bb669983a1..0cb15350704955f4a1aeff184a8b60d9

private final NamespacedKey key;
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 3be4214348e72e90f8b59225b3e31db0e6ba7e09..79d1ed1750d9ed843da128a0d047ae455f12ae38 100644
index 6455163261082c444985bc58b188d224517d4529..613cd9c2e91a851c86e339d2be86981b57669311 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -184,14 +184,14 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -198,14 +198,14 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see TrimMaterial
*/
Expand All @@ -494,7 +494,7 @@ index 3be4214348e72e90f8b59225b3e31db0e6ba7e09..79d1ed1750d9ed843da128a0d047ae45
Registry<TrimPattern> TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class);
/**
* Villager profession.
@@ -273,8 +273,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -287,8 +287,11 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @param input non-null input
* @return registered object or null if does not exist
Expand Down
4 changes: 2 additions & 2 deletions patches/api/0247-Add-StructuresLocateEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 79d1ed1750d9ed843da128a0d047ae455f12ae38..4a9c196a2caeb7f1b180347b480ed48056ad6a00 100644
index 613cd9c2e91a851c86e339d2be86981b57669311..4331acfc9efd08011e339a1bc0a5190abc197506 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -248,6 +248,17 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -262,6 +262,17 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see GameEvent
*/
Registry<GameEvent> GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug.");
Expand Down
8 changes: 4 additions & 4 deletions patches/api/0300-Missing-Entity-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ index adb20a9abba33c32d553f620fa82b27dff64ab5f..1f6702b0de00b87dbed7f6d93e911655
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index c2a566b864c82ffb094b7334d9e6e25a1bfc87d1..c340fecb61bac66baf0f44189d21bc85289b1269 100644
index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238194d5918 100644
--- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -54,4 +54,36 @@ public interface Cat extends Tameable, Sittable {
JELLIE,
ALL_BLACK;
@@ -68,4 +68,36 @@ public interface Cat extends Tameable, Sittable {
return key;
}
}
+
+ // Paper Start - More cat api
Expand Down

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] More PotionEffectType API


diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 4a9c196a2caeb7f1b180347b480ed48056ad6a00..7eef8ba452c7a35d70d07782f288d51b061a2d03 100644
index 4331acfc9efd08011e339a1bc0a5190abc197506..800d23bb249e19d5cf924e7ba36684068624da02 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -257,6 +257,31 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -271,6 +271,31 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*/
@Deprecated(forRemoval = true)
Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ index 0000000000000000000000000000000000000000..aefbaccd32f1ab25a4da63bdc878922e
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index c340fecb61bac66baf0f44189d21bc85289b1269..97b0d8ccd3fd3a711ec5fa4ce3d8703515895081 100644
index 9bc385682472418c787481bbc809f238194d5918..4ea1027c8540cdba82acf829d0720846b3a13e3e 100644
--- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Meow.
*/
Expand All @@ -129,15 +129,15 @@ index c340fecb61bac66baf0f44189d21bc85289b1269..97b0d8ccd3fd3a711ec5fa4ce3d87035

/**
* Gets the current type of this cat.
@@ -29,6 +29,7 @@ public interface Cat extends Tameable, Sittable {
@@ -31,6 +31,7 @@ public interface Cat extends Tameable, Sittable {
* @return the color of the collar
*/
@NotNull
+ @Override // Paper
public DyeColor getCollarColor();

/**
@@ -36,6 +37,7 @@ public interface Cat extends Tameable, Sittable {
@@ -38,6 +39,7 @@ public interface Cat extends Tameable, Sittable {
*
* @param color the color to apply
*/
Expand Down
40 changes: 0 additions & 40 deletions patches/api/0365-Keyed-Cat-Type.patch

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ Subject: [PATCH] Added byte array serialization/deserialization for


diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
index eebb3da156e2d95efbe22d4afa470b977ce19f10..57609b7793122e135fa0c3b926500849379637b2 100644
index 6c156faf0148da13a44dabba7a807f68b3d50a36..da59e75267f43581bec6df73dda9f889347617d4 100644
--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java
@@ -164,5 +164,38 @@ public interface PersistentDataContainer {
* @throws NullPointerException if the key to look up is null
@@ -184,4 +184,39 @@ public interface PersistentDataContainer {
*/
boolean has(@NotNull NamespacedKey key);
@NotNull
PersistentDataAdapterContext getAdapterContext();
+
+ // Paper start - byte array serialization
+ /**
+ * Serialize this {@link PersistentDataContainer} instance to a
+ * byte array.
Expand Down Expand Up @@ -43,8 +44,8 @@ index eebb3da156e2d95efbe22d4afa470b977ce19f10..57609b7793122e135fa0c3b926500849
+ * @param bytes the byte array to read from
+ * @throws java.io.IOException if the byte array has an invalid format
+ */
+ default void readFromBytes(byte @NotNull [] bytes) throws java.io.IOException {
+ default void readFromBytes(final byte @NotNull [] bytes) throws java.io.IOException {
+ this.readFromBytes(bytes, true);
+ }
// Paper end
+ // Paper end - byte array serialization
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions patches/server/0018-Rewrite-chunk-system.patch
Original file line number Diff line number Diff line change
Expand Up @@ -19532,7 +19532,7 @@ index 5cd680d2ed47aadb5e65a775d70bc662a92e3d7a..1ad6b62ee53e2ee4a710211dfc750780
}

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3e363197f 100644
index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29db076b86 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -196,7 +196,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
Expand Down Expand Up @@ -19988,7 +19988,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
return false;
} else {
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
@@ -1736,7 +1970,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1746,7 +1980,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}

Expand All @@ -19997,7 +19997,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
@@ -1785,7 +2019,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1795,7 +2029,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);

try {
Expand All @@ -20006,7 +20006,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
} catch (Throwable throwable4) {
if (bufferedwriter2 != null) {
try {
@@ -1806,7 +2040,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1816,7 +2050,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);

try {
Expand All @@ -20015,7 +20015,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
} catch (Throwable throwable6) {
if (bufferedwriter3 != null) {
try {
@@ -1948,7 +2182,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1958,7 +2192,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

@VisibleForTesting
public String getWatchdogStats() {
Expand All @@ -20024,7 +20024,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
}
@@ -2008,15 +2242,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2018,15 +2252,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public LevelEntityGetter<Entity> getEntities() {
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
Expand All @@ -20045,7 +20045,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
}

public void startTickingChunk(LevelChunk chunk) {
@@ -2032,34 +2266,49 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2042,34 +2276,49 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public void close() throws IOException {
super.close();
Expand Down Expand Up @@ -20102,7 +20102,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3
}

@Override
@@ -2080,7 +2329,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2090,7 +2339,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);

crashreportsystemdetails.setDetail("Loaded entity count", () -> {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0033-Entity-Origin-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9969b66e39fb6ce8a9ba24ccbd7ef5d3e363197f..363f94a2fb54b7a55f392cc65a6e4d68f313fb07 100644
index 0653b5abc89d0c5a54566e3e518cfd29db076b86..bc2111031f277dc27b8ae673259a10999df1ec43 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2389,6 +2389,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2399,6 +2399,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.inWorld = true; // CraftBukkit - Mark entity as in world
entity.valid = true; // CraftBukkit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f9e9348a897d8f8bd5eb5bd951c6e2416e73562d..16abfc81d054cdc983500d3e498533ea8e8cc0be 100644
index 9ac9f250d2f9b29ce520da93a9398113b2ff3e50..0523b0e70c10f7f02551be90cd02b6d8dabde673 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2401,6 +2401,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2411,6 +2411,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.setOrigin(entity.getOriginVector().toLocation(getWorld()));
}
// Paper end
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}

public void onTrackingEnd(Entity entity) {
@@ -2476,6 +2477,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2486,6 +2487,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// CraftBukkit end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6baf4caafbb4f7a09fe3a806bbff17c9f6105fbd..97554ab72743cf2b8e87c7f3c35579f669c2308a 100644
index 4d89f0c8ba1454aedb759c367009ec25931b66d5..cc3a34afddac429b1ce75e54fdb284d7683a4310 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2422,6 +2422,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2432,6 +2432,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
{
if ( iter.next().player == entity )
{
Expand Down
18 changes: 9 additions & 9 deletions patches/server/0123-PlayerTeleportEndGatewayEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Allows you to access the Gateway being used in a teleport event
Fix the offset used for player teleportation

diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 97c57619ebcf31f17f8430ffb68043771d1377f9..020314dded2c6305bd5e9013b108bc74be25ccc1 100644
index 8e63135d42d1a06cc7741e33eb3e057321ea53bc..8ae723c6500bb92f937a27730c2a5ec912247c0a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -207,11 +207,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
// CraftBukkit start - Fire PlayerTeleportEvent
// CraftBukkit start - Fire PlayerTeleportEvent/EntityTeleportEvent
if (entity1 instanceof ServerPlayer) {
org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
- org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
Expand All @@ -24,12 +24,12 @@ index 97c57619ebcf31f17f8430ffb68043771d1377f9..020314dded2c6305bd5e9013b108bc74
Bukkit.getPluginManager().callEvent(teleEvent);
if (teleEvent.isCancelled()) {
return;
@@ -226,7 +226,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
// CraftBukkit end
@@ -224,7 +224,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

entity1.setPortalCooldown();
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
+ entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); // Paper - diff on change
}
}

TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity);
- org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5);
+ org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5); // Paper - diff on change
if (teleEvent.isCancelled()) {
return;
}
Loading

0 comments on commit 2f92d4e

Please sign in to comment.