[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-19 22:13:42 +01:00
parent 1c956abfbc
commit 42e88a8b7b
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
87 changed files with 405 additions and 411 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..ab06c640cef1309ab44b0fae8d95df48cdc869a7 100644 index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..bfecd0633458586c0352eeb1a95bb57b12f9101e 100644
--- a/src/main/java/org/bukkit/entity/Item.java --- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java +++ b/src/main/java/org/bukkit/entity/Item.java
@@ -89,4 +89,20 @@ public interface Item extends Entity { @@ -89,4 +89,20 @@ public interface Item extends Entity {
@ -13,7 +13,7 @@ index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..ab06c640cef1309ab44b0fae8d95df48
@Nullable @Nullable
public UUID getThrower(); public UUID getThrower();
+ +
+ // Paper Start + // Paper start
+ /** + /**
+ * Gets if non-player entities can pick this Item up + * Gets if non-player entities can pick this Item up
+ * + *

View File

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac018185cd38 100644 index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b571998332090b785730 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull; @@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
@ -20,7 +20,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01
return remaining; return remaining;
} }
+ // Paper Start + // Paper start
+ /** + /**
+ * Set if the item will fly at the player + * Set if the item will fly at the player
+ * <p>Cancelling the event will set this value to false.</p> + * <p>Cancelling the event will set this value to false.</p>
@ -39,7 +39,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01
+ public boolean getFlyAtPlayer() { + public boolean getFlyAtPlayer() {
+ return flyAtPlayer; + return flyAtPlayer;
+ } + }
+ // Paper End + // Paper end
+ +
@Override @Override
public boolean isCancelled() { public boolean isCancelled() {

View File

@ -18,7 +18,7 @@ Y range: [0, 1023]
X, Z range: [-67 108 864, 67 108 863] X, Z range: [-67 108 864, 67 108 863]
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d7d05f938 100644 index 41125de49db8eafce4be59cc110ce5be06836a47..042d69e6d4584eb6d678b8ea13a3e4bea78703b8 100644
--- a/src/main/java/org/bukkit/Location.java --- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java
@@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable; @@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable;
@ -34,7 +34,7 @@ index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d
return blockLoc; return blockLoc;
} }
+ +
+ // Paper Start + // Paper start
+ /** + /**
+ * @return The block key for this location's block location. + * @return The block key for this location's block location.
+ * @see Block#getBlockKey(int, int, int) + * @see Block#getBlockKey(int, int, int)
@ -44,13 +44,13 @@ index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d
+ public long toBlockKey() { + public long toBlockKey() {
+ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ()); + return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ());
+ } + }
+ // Paper End + // Paper end
+ +
/** /**
* @return A new location where X/Y/Z are the center of the block * @return A new location where X/Y/Z are the center of the block
*/ */
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index be0e1ad34c526f2bd7b80f035c79b07e3b3ef5fb..55c0ad31ae8f1831c43404abb7e2e62da63885ce 100644 index f15e1a6a43c0353ac4834f74fffb9adc2049dfcb..d5ebfdefe015e5509f0ecf53accfee2afbd4aadd 100644
--- a/src/main/java/org/bukkit/World.java --- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java
@@ -97,6 +97,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -97,6 +97,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@ -96,14 +96,14 @@ index be0e1ad34c526f2bd7b80f035c79b07e3b3ef5fb..55c0ad31ae8f1831c43404abb7e2e62d
* Gets the highest non-empty (impassable) block at the given coordinates. * Gets the highest non-empty (impassable) block at the given coordinates.
* *
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..78f6cc1a8a8de05aec6f551f8a5f425944f0ffa3 100644 index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..f3a18e337a579b602b1289bccdf454334a663fcf 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable { @@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable {
*/ */
int getZ(); int getZ();
+ // Paper Start + // Paper start
+ /** + /**
+ * Returns this block's coordinates packed into a long value. + * Returns this block's coordinates packed into a long value.
+ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())} + * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())}
@ -177,7 +177,7 @@ index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..78f6cc1a8a8de05aec6f551f8a5f4259
+ public static int getBlockKeyZ(long packed) { + public static int getBlockKeyZ(long packed) {
+ return (int) ((packed << 10) >> 37); + return (int) ((packed << 10) >> 37);
+ } + }
+ // Paper End + // Paper end
+ +
/** /**
* Gets the Location of the block * Gets the Location of the block

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 3fd364e5875f95296e75dede4c610d3dd3e0038e..6de4c858ff6e542daa0879092e4f99a948225964 100644 index 689170a273ce68cf6fbd4659f3e08577c100535f..987dfdc9b09299e5ef3ae1fea2882ae56f8da38e 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr @@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
@ -21,6 +21,6 @@ index 3fd364e5875f95296e75dede4c610d3dd3e0038e..6de4c858ff6e542daa0879092e4f99a9
+ * @return whether the block will drop items + * @return whether the block will drop items
+ */ + */
+ boolean isValidTool(@NotNull ItemStack itemStack); + boolean isValidTool(@NotNull ItemStack itemStack);
// Paper End // Paper end
/** /**

View File

@ -310,7 +310,7 @@ index adb20a9abba33c32d553f620fa82b27dff64ab5f..1f6702b0de00b87dbed7f6d93e911655
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238194d5918 100644 index d1327761a4b95eba97877f1991fc19b298b48eaf..0534fbc228f64cf3b361ab097d9b88212bdb0f36 100644
--- a/src/main/java/org/bukkit/entity/Cat.java --- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java +++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -68,4 +68,36 @@ public interface Cat extends Tameable, Sittable { @@ -68,4 +68,36 @@ public interface Cat extends Tameable, Sittable {
@ -318,7 +318,7 @@ index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238
} }
} }
+ +
+ // Paper Start - More cat api + // Paper start - More cat api
+ /** + /**
+ * Sets if the cat is lying down. + * Sets if the cat is lying down.
+ * This is visual and does not affect the behaviour of the cat. + * This is visual and does not affect the behaviour of the cat.
@ -348,7 +348,7 @@ index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238
+ * @return head is up + * @return head is up
+ */ + */
+ public boolean isHeadUp(); + public boolean isHeadUp();
+ // Paper End - More cat api + // Paper end - More cat api
} }
diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java
index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79af8c040a7 100644 index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79af8c040a7 100644

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Stinger API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index adf2870ab81b6ff8f595e11b55f043c4fd51281e..3be060731b9b2df3408e8c5627a3640262cdc4d5 100644 index adf2870ab81b6ff8f595e11b55f043c4fd51281e..2976955607f9cbb9b552aa43f25b5b9d52f7437e 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java --- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -401,6 +401,36 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @@ -401,6 +401,36 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/ */
void setArrowsInBody(int count, boolean fireEvent); // Paper void setArrowsInBody(int count, boolean fireEvent); // Paper
+ // Paper Start - Bee Stinger API + // Paper start - Bee Stinger API
+ /** + /**
+ * Gets the time in ticks until the next bee stinger leaves the entity's body. + * Gets the time in ticks until the next bee stinger leaves the entity's body.
+ * + *
@ -40,7 +40,7 @@ index adf2870ab81b6ff8f595e11b55f043c4fd51281e..3be060731b9b2df3408e8c5627a36402
+ * @param count amount of bee stingers in entity's body + * @param count amount of bee stingers in entity's body
+ */ + */
+ public void setBeeStingersInBody(int count); + public void setBeeStingersInBody(int count);
+ // Paper End - Stinger API + // Paper end - Stinger API
+ +
/** /**
* Returns the living entity's current maximum no damage ticks. * Returns the living entity's current maximum no damage ticks.

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Freeze Tick Lock API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..953bb49b7079647450d3453356d1c8a91be94c01 100644 index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..f090368dbb5acf352e1bee34d78b55eb92373c6d 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -283,6 +283,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -283,6 +283,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/ */
boolean isFrozen(); boolean isFrozen();
+ // Paper Start - Freeze Tick Lock API + // Paper start - Freeze Tick Lock API
+ /** + /**
+ * Gets if the entity currently has its freeze ticks locked + * Gets if the entity currently has its freeze ticks locked
+ * to a set amount. + * to a set amount.
@ -30,7 +30,7 @@ index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..953bb49b7079647450d3453356d1c8a9
+ * @param locked prevent vanilla modification or not + * @param locked prevent vanilla modification or not
+ */ + */
+ void lockFreezeTicks(boolean locked); + void lockFreezeTicks(boolean locked);
+ // Paper End - Freeze Tick Lock API + // Paper end - Freeze Tick Lock API
+ +
/** /**
* Mark the entity's removal. * Mark the entity's removal.

View File

@ -45,7 +45,7 @@ index 86c7b4ba676f826344056b24b204b748cfce1580..0f60823426898974b7d61123fb848006
@Deprecated @Deprecated
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..a945e76dd61ef132ae3f3ee69635c927b1180523 100644 index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..7904c716a3b0869ebf2f9b416536c59121a539a8 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java --- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java +++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -26,6 +26,33 @@ public interface FallingBlock extends Entity { @@ -26,6 +26,33 @@ public interface FallingBlock extends Entity {
@ -86,7 +86,7 @@ index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..a945e76dd61ef132ae3f3ee69635c927
default org.bukkit.Location getSourceLoc() { default org.bukkit.Location getSourceLoc() {
return this.getOrigin(); return this.getOrigin();
} }
+ // Paper Start - Auto expire setting + // Paper start - Auto expire setting
+ /** + /**
+ * Sets if this falling block should expire after: + * Sets if this falling block should expire after:
+ * - 30 seconds + * - 30 seconds
@ -104,5 +104,5 @@ index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..a945e76dd61ef132ae3f3ee69635c927
+ * @param autoExpires if this behavior should occur + * @param autoExpires if this behavior should occur
+ */ + */
+ void shouldAutoExpire(boolean autoExpires); + void shouldAutoExpire(boolean autoExpires);
+ // Paper End - Auto expire setting + // Paper end - Auto expire setting
} }

View File

@ -25,7 +25,7 @@ index 44ee56a5956cc17194c767a0c1071a2abffe818a..43dd6c59cceba12f27e6b265acc3ad97
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 2ea66188468cf32bcaedc5167d4b9b0c6ea9b0b3..351a7d0aeab5d83564dd543935ba503ea0b68d60 100644 index 8322d22f34968d579b92c581b36544d42b7732cd..2a4ff1457a9b4aa17bf28083ed4c301467ae9735 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -971,4 +971,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -971,4 +971,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@ -33,7 +33,7 @@ index 2ea66188468cf32bcaedc5167d4b9b0c6ea9b0b3..351a7d0aeab5d83564dd543935ba503e
boolean isInPowderedSnow(); boolean isInPowderedSnow();
// Paper end // Paper end
+ +
+ // Paper Start - Collision API + // Paper start - Collision API
+ /** + /**
+ * Checks for any collisions with the entity's bounding box at the provided location. + * Checks for any collisions with the entity's bounding box at the provided location.
+ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. + * This will check for any colliding entities (boats, shulkers) / worldborder / blocks.
@ -53,5 +53,5 @@ index 2ea66188468cf32bcaedc5167d4b9b0c6ea9b0b3..351a7d0aeab5d83564dd543935ba503e
+ * @return collides or not + * @return collides or not
+ */ + */
+ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); + boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
+ // Paper End - Collision API + // Paper end - Collision API
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Entity Body Yaw API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index c9139bb7abc881fddd2d5610d9506cd4fce7eba3..bb1ed1e16bd17161bbf554acc03d1e32d3627a80 100644 index e5df511d962a59260207e8390d7da7782af5dc77..90c46483928e70f37a9900cada7dc67957a031d0 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -989,6 +989,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -989,6 +989,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@ -51,9 +51,9 @@ index c9139bb7abc881fddd2d5610d9506cd4fce7eba3..bb1ed1e16bd17161bbf554acc03d1e32
+ float getYaw(); + float getYaw();
// Paper end // Paper end
// Paper Start - Collision API // Paper start - Collision API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index b6df5fd8eda6a30c119b3fa3844e6bb0425e2f39..0b4cd106265c6c675bd27cd66a275a48217a7419 100644 index c1b7f021cd268a0d6da0f2759469b88fae638648..7f185102ba3a417670313e75ee174a1024a1d514 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java --- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1244,5 +1244,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @@ -1244,5 +1244,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View File

@ -769,13 +769,13 @@ index 75f2b46c4fc1e12d1d02cd60865a5b76b1c2de49..f8f0a2b7fdd51c739c3f55801037a417
+ // Paper end - Folia region threading API + // Paper end - Folia region threading API
} }
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index bb1ed1e16bd17161bbf554acc03d1e32d3627a80..b2f5be3227d5dad5b1ff0129930dcd1944c75cef 100644 index 90c46483928e70f37a9900cada7dc67957a031d0..3bf0c76ef830fa54d7695711cd7903dc64c619b1 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1049,4 +1049,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -1049,4 +1049,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/ */
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API // Paper end - Collision API
+ +
+ // Paper start - Folia schedulers + // Paper start - Folia schedulers
+ /** + /**

View File

@ -21,14 +21,14 @@ index fb529eac9..faf425588 100644
this.e.set(1, false); this.e.set(1, false);
this.b.seek(0L); this.b.seek(0L);
+ // Paper Start + // Paper start
+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192); + java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192);
+ while (header.hasRemaining()) { + while (header.hasRemaining()) {
+ if (this.getDataFile().getChannel().read(header) == -1) throw new java.io.EOFException(); + if (this.getDataFile().getChannel().read(header) == -1) throw new java.io.EOFException();
+ } + }
+ ((java.nio.Buffer) header).clear(); + ((java.nio.Buffer) header).clear();
+ java.nio.IntBuffer headerAsInts = header.asIntBuffer(); + java.nio.IntBuffer headerAsInts = header.asIntBuffer();
+ // Paper End + // Paper end
+ +
int k; int k;

View File

@ -123,7 +123,7 @@ index 21b3b06f53..8718811655 100644
+ public synchronized boolean hasRegionFile(File file, int i, int j) { + public synchronized boolean hasRegionFile(File file, int i, int j) {
+ return cache.containsKey(ChunkCoordIntPair.pair(i, j)); + return cache.containsKey(ChunkCoordIntPair.pair(i, j));
+ } + }
+ // Paper End + // Paper end
+ +
@Nullable @Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {

View File

@ -4976,7 +4976,7 @@ index 8318b4a56b4a0235a00caba9df4ba41c85eb13bc..b5256eefb64808ae15bd622a8eccbe13
world.serverLevelData.setDifficulty(config.difficulty); world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a7921cde2b6275d730879b2814cc5f430520b051..686d6376322dab126393198da87e02827ec0fda2 100644 index a7921cde2b6275d730879b2814cc5f430520b051..c8f0570b7d37a0c0bddb0a65c36fb32de584df8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -141,6 +141,19 @@ public class Main { @@ -141,6 +141,19 @@ public class Main {
@ -4984,7 +4984,7 @@ index a7921cde2b6275d730879b2814cc5f430520b051..686d6376322dab126393198da87e0282
.describedAs("Yml file"); .describedAs("Yml file");
// Spigot End // Spigot End
+ +
+ // Paper Start + // Paper start
+ acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings") + acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings")
+ .withRequiredArg() + .withRequiredArg()
+ .ofType(File.class) + .ofType(File.class)

View File

@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0c3a23502ab6cb9e1f027b1050dd6849ceb181d9..21fc0ce46567d7bd7f24759779f8586efe72fc9f 100644 index 0c3a23502ab6cb9e1f027b1050dd6849ceb181d9..6bc92eb33bc066c477d86d317cb445dd7f7884f5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -87,7 +87,7 @@ index 0c3a23502ab6cb9e1f027b1050dd6849ceb181d9..21fc0ce46567d7bd7f24759779f8586e
+ } + }
+ } + }
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL)); + private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
+ // Paper End + // Paper end
// Spigot End // Spigot End
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fbcf5ddb655e6d070f24d71bd076115739cf0254 100644 index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fa0e96fd884a0338b44f68506b1d3ee6c42f17b1 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -670,6 +670,11 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -670,6 +670,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
ItemEntity entityitem = (ItemEntity) iterator.next(); ItemEntity entityitem = (ItemEntity) iterator.next();
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
+ // Paper Start + // Paper start
+ if (!entityitem.canMobPickup) { + if (!entityitem.canMobPickup) {
+ continue; + continue;
+ } + }
+ // Paper End + // Paper end
this.pickUpItem(entityitem); this.pickUpItem(entityitem);
} }
} }
@ -33,14 +33,14 @@ index 5bb26ca5c81635d27ca59352d5184d8b4300e0b5..6905090f030c86f640e841e94c32ad90
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) { public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
super(type, world); super(type, world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index fb3738f4c558796f41e3327dd41b8aec68007a8a..4456b7c438cadb4bfabad030b6871b3a8a7fd439 100644 index fb3738f4c558796f41e3327dd41b8aec68007a8a..5620a0849fda49313c68edfd747fedd09641a3d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -63,6 +63,18 @@ public class CraftItem extends CraftEntity implements Item { @@ -63,6 +63,18 @@ public class CraftItem extends CraftEntity implements Item {
} }
} }
+ // Paper Start + // Paper start
+ @Override + @Override
+ public boolean canMobPickup() { + public boolean canMobPickup() {
+ return this.getHandle().canMobPickup; + return this.getHandle().canMobPickup;
@ -50,7 +50,7 @@ index fb3738f4c558796f41e3327dd41b8aec68007a8a..4456b7c438cadb4bfabad030b6871b3a
+ public void setCanMobPickup(boolean canMobPickup) { + public void setCanMobPickup(boolean canMobPickup) {
+ this.getHandle().canMobPickup = canMobPickup; + this.getHandle().canMobPickup = canMobPickup;
+ } + }
+ // Paper End + // Paper end
+ +
@Override @Override
public void setOwner(UUID uuid) { public void setOwner(UUID uuid) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 6905090f030c86f640e841e94c32ad90acb75d2a..6847d100a6fe2b57d7986b121f5ce0f981cfa415 100644 index 6905090f030c86f640e841e94c32ad90acb75d2a..afb01096f41ed76e431848466d02aaefdc0c69c7 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -423,6 +423,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -423,6 +423,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -23,11 +23,11 @@ index 6905090f030c86f640e841e94c32ad90acb75d2a..6847d100a6fe2b57d7986b121f5ce0f9
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper + flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
if (playerEvent.isCancelled()) { if (playerEvent.isCancelled()) {
itemstack.setCount(i); // SPIGOT-5294 - restore count itemstack.setCount(i); // SPIGOT-5294 - restore count
+ // Paper Start + // Paper start
+ if (flyAtPlayer) { + if (flyAtPlayer) {
+ player.take(this, i); + player.take(this, i);
+ } + }
+ // Paper End + // Paper end
return; return;
} }

View File

@ -31,7 +31,7 @@ index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2
Bootstrap.isBootstrapped = true; Bootstrap.isBootstrapped = true;
Instant instant = Instant.now(); Instant instant = Instant.now();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 9c24fdab1744a5af71d8dfb63736483272476f40..ebfebbb9b7de93dd43ee6d0531832a71f8556d33 100644 index 09164f4c446d3e80708f1bcb9da333821ee5733d..4d2ebb7af055d1c78a648914c5a1862fe9bc8b8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -258,10 +258,12 @@ public class Main { @@ -258,10 +258,12 @@ public class Main {
@ -46,7 +46,7 @@ index 9c24fdab1744a5af71d8dfb63736483272476f40..ebfebbb9b7de93dd43ee6d0531832a71
- Thread.sleep(TimeUnit.SECONDS.toMillis(20)); - Thread.sleep(TimeUnit.SECONDS.toMillis(20));
+ //System.err.println("*** Server will start in 20 seconds ***"); + //System.err.println("*** Server will start in 20 seconds ***");
+ //Thread.sleep(TimeUnit.SECONDS.toMillis(20)); + //Thread.sleep(TimeUnit.SECONDS.toMillis(20));
+ // Paper End + // Paper end
} }
} }

View File

@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer. at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 910b9a2918ec58ecb9fff77cca36abb48c7db7dd..cf81671a32874d89588a829e6ad6696e41e1cfa4 100644 index c08371fdf0c10135e235efa2b2c7e4819f3b19c2..494069d69d8d0f9f1b6700349310ec6d2031abdd 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -43,7 +43,7 @@ index 910b9a2918ec58ecb9fff77cca36abb48c7db7dd..cf81671a32874d89588a829e6ad6696e
- -
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit - if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
- if (this.keepAlivePending) { - if (this.keepAlivePending) {
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = Util.getMillis(); + long currentTime = Util.getMillis();
+ long elapsedTime = currentTime - this.keepAliveTime; + long elapsedTime = currentTime - this.keepAliveTime;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize BlockPosition helper methods
Resolves #1338 Resolves #1338
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 1834f3efb05fd70c8c1c67733bff514829ae1154..fbdbf61f49bd6867eea609d5572fb31ece094944 100644 index 2bb5e51f71cbf66819d198505aa4a5ecffd246c6..ef5f897164136767e9c6dd61b76c2a1dedd4f350 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -132,67 +132,84 @@ public class BlockPos extends Vec3i { @@ -132,67 +132,84 @@ public class BlockPos extends Vec3i {
@ -85,7 +85,7 @@ index 1834f3efb05fd70c8c1c67733bff514829ae1154..fbdbf61f49bd6867eea609d5572fb31e
@Override @Override
public BlockPos relative(Direction direction) { public BlockPos relative(Direction direction) {
+ // Paper Start - Optimize BlockPosition + // Paper start - Optimize BlockPosition
+ switch(direction) { + switch(direction) {
+ case UP: + case UP:
+ return new BlockPos(this.getX(), this.getY() + 1, this.getZ()); + return new BlockPos(this.getX(), this.getY() + 1, this.getZ());
@ -102,7 +102,7 @@ index 1834f3efb05fd70c8c1c67733bff514829ae1154..fbdbf61f49bd6867eea609d5572fb31e
+ default: + default:
return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ()); return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
+ } + }
+ // Paper End + // Paper end
} }
@Override @Override

View File

@ -141,7 +141,7 @@ index 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a20
private final ChunkPos pos; private final ChunkPos pos;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..c46320794e9673d7ff24aae5e9086cc90988791c 100644 index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c977f0a80 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -121,6 +121,71 @@ public class RegionFileStorage implements AutoCloseable { @@ -121,6 +121,71 @@ public class RegionFileStorage implements AutoCloseable {
@ -211,7 +211,7 @@ index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..c46320794e9673d7ff24aae5e9086cc9
+ } + }
+ } + }
+ +
+ // Paper End + // Paper end
+ +
@Nullable @Nullable
public CompoundTag read(ChunkPos pos) throws IOException { public CompoundTag read(ChunkPos pos) throws IOException {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Item no age & no player pickup
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index 4456b7c438cadb4bfabad030b6871b3a8a7fd439..cbdac5a439795d429a1364a7eafc4783cff51d54 100644 index 5620a0849fda49313c68edfd747fedd09641a3d5..4a15c3786edbfeae3367c0b20fb6aee11d62aea6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -9,6 +9,11 @@ import org.bukkit.inventory.ItemStack; @@ -9,6 +9,11 @@ import org.bukkit.inventory.ItemStack;
@ -44,6 +44,6 @@ index 4456b7c438cadb4bfabad030b6871b3a8a7fd439..cbdac5a439795d429a1364a7eafc4783
+ public void setWillAge(boolean willAge) { + public void setWillAge(boolean willAge) {
+ this.getHandle().age = willAge ? 0 : NO_AGE_TIME; + this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
+ } + }
// Paper End // Paper end
@Override @Override

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com> From: Madeline Miller <mnmiller1@me.com>
Date: Thu, 31 Dec 2020 12:48:19 +1000 Date: Thu, 31 Dec 2020 12:48:19 +1000
Subject: [PATCH] Implement API to get Material from Boats and Minecarts Subject: [PATCH] API to get Material from Boats and Minecarts
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Cache burn durations
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c 100644 index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..5c65be04ac88f1308eae6a8cde36d5f7e8aad879 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -18,7 +18,7 @@ index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e
+ if(cachedBurnDurations != null) { + if(cachedBurnDurations != null) {
+ return cachedBurnDurations; + return cachedBurnDurations;
+ } + }
+ // Paper end + // Paper end - cache burn durations
Map<Item, Integer> map = Maps.newLinkedHashMap(); Map<Item, Integer> map = Maps.newLinkedHashMap();
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000); AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
@ -30,7 +30,7 @@ index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e
+ // Paper start - cache burn durations + // Paper start - cache burn durations
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map); + cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
+ return cachedBurnDurations; + return cachedBurnDurations;
+ // Paper end + // Paper end - cache burn durations
} }
// CraftBukkit start - add fields and methods // CraftBukkit start - add fields and methods

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation
diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
index 8176b64e49166cc24ef7f011881fda38bc68c2a4..4f10f801dc126e9135432939b6663770c0e7a0bc 100644 index 8176b64e49166cc24ef7f011881fda38bc68c2a4..3bfbf7daa190b03f978b9fc72233c18c383b6659 100644
--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java --- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java
+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java +++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
@@ -63,6 +63,8 @@ public class SpawnEggItem extends Item { @@ -63,6 +63,8 @@ public class SpawnEggItem extends Item {
EntityType entitytypes; EntityType entitytypes;
if (tileentity instanceof Spawner) { if (tileentity instanceof Spawner) {
+ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper + if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation
+ +
Spawner spawner = (Spawner) tileentity; Spawner spawner = (Spawner) tileentity;

View File

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com> From: MisterVector <whizkid3000@hotmail.com>
Date: Tue, 13 Aug 2019 19:45:06 -0700 Date: Tue, 13 Aug 2019 19:45:06 -0700
Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9f73cef00 100644 index c450faf8c043665eab020141f3c27e3d9890cb86..8684b28a0aa4ec9b2a7f15d07410264cf030a19c 100644
--- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
@@ -66,6 +66,25 @@ public class FlowerPotBlock extends Block { @@ -66,6 +66,25 @@ public class FlowerPotBlock extends Block {
boolean bl = blockState.is(Blocks.AIR); boolean bl = blockState.is(Blocks.AIR);
boolean bl2 = this.isEmpty(); boolean bl2 = this.isEmpty();
if (bl != bl2) { if (bl != bl2) {
+ // Paper start + // Paper start - Add PlayerFlowerPotManipulateEvent
+ org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity(); + org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity();
+ boolean placing = bl2; + boolean placing = bl2;
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
@ -30,7 +30,7 @@ index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9
+ +
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
+ // Paper end + // Paper end - Add PlayerFlowerPotManipulateEvent
if (bl2) { if (bl2) {
world.setBlock(pos, blockState, 3); world.setBlock(pos, blockState, 3);
player.awardStat(Stats.POT_FLOWER); player.awardStat(Stats.POT_FLOWER);

View File

@ -11,7 +11,7 @@ Subject: [PATCH] Fix interact event not being called sometimes
Co-authored-by: Moulberry <james.jenour@protonmail.com> Co-authored-by: Moulberry <james.jenour@protonmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3683e3b56da96e5528d63319892b5ec76075d86c..48815e94a0eacbdd03ea8630ae4a53f1a4747520 100644 index 3683e3b56da96e5528d63319892b5ec76075d86c..046ee4ce24248d1b24ee4e731324f6d1d600da7e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1765,7 +1765,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1765,7 +1765,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -19,7 +19,7 @@ index 3683e3b56da96e5528d63319892b5ec76075d86c..48815e94a0eacbdd03ea8630ae4a53f1
this.player.sendSystemMessage(ichatmutablecomponent, true); this.player.sendSystemMessage(ichatmutablecomponent, true);
- } else if (enuminteractionresult.shouldSwing()) { - } else if (enuminteractionresult.shouldSwing()) {
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper + } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event
this.player.swing(enumhand, true); this.player.swing(enumhand, true);
} }
} }
@ -28,21 +28,21 @@ index 3683e3b56da96e5528d63319892b5ec76075d86c..48815e94a0eacbdd03ea8630ae4a53f1
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities
- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> { - org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> {
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - change raySize from 0.1 to 0.0 + org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - Call interact event; change raySize from 0.1 to 0.0
Entity handle = ((CraftEntity) entity).getHandle(); Entity handle = ((CraftEntity) entity).getHandle();
return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player); return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player);
}); });
if (result == null) { if (result == null) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
- } - }
+ } else { // Paper start - Fix interact event not being called sometimes + } else { // Paper start - Call interact event
+ GameType gameType = this.player.gameMode.getGameModeForPlayer(); + GameType gameType = this.player.gameMode.getGameModeForPlayer();
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) { + if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) { + } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ } + }
+ } // Paper end + } // Paper end - Call interact event
// Arm swing animation // Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Fix nerfed slime when splitting
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index fa014c04cc51a55345a1c50098f486161051741d..37724831ba9db2d0fb2e7756816e0355bc760815 100644 index fa014c04cc51a55345a1c50098f486161051741d..a89dec53d68579271d2a259e1a53537262bd0df6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -243,6 +243,7 @@ public class Slime extends Mob implements Enemy { @@ -243,6 +243,7 @@ public class Slime extends Mob implements Enemy {
entityslime.setPersistenceRequired(); entityslime.setPersistenceRequired();
} }
+ entityslime.aware = this.aware; // Paper + entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting
entityslime.setCustomName(ichatbasecomponent); entityslime.setCustomName(ichatbasecomponent);
entityslime.setNoAi(flag); entityslime.setNoAi(flag);
entityslime.setInvulnerable(this.isInvulnerable()); entityslime.setInvulnerable(this.isInvulnerable());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityLoadCrossbowEvent
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index ba570f1c9654e1004e068a1efe2118f36c954505..eede02c3f125d230af537bb67bebed9b88f7d1b4 100644 index ba570f1c9654e1004e068a1efe2118f36c954505..06689ee8799079510a1a4e7b68029b9629e318fb 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -89,7 +89,14 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { @@ -89,7 +89,14 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
@ -13,14 +13,14 @@ index ba570f1c9654e1004e068a1efe2118f36c954505..eede02c3f125d230af537bb67bebed9b
float f = CrossbowItem.getPowerForTime(j, stack); float f = CrossbowItem.getPowerForTime(j, stack);
- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) { - if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) {
+ // Paper start - EntityLoadCrossbowEvent + // Paper start - Add EntityLoadCrossbowEvent
+ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) { + if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) {
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND); + final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND);
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) { + if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) {
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote(); + if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Add EntityLoadCrossbowEvent
CrossbowItem.setCharged(stack, true); CrossbowItem.setCharged(stack, true);
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
@ -28,17 +28,17 @@ index ba570f1c9654e1004e068a1efe2118f36c954505..eede02c3f125d230af537bb67bebed9b
} }
+ @io.papermc.paper.annotation.DoNotUse // Paper + @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) { private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) {
+ // Paper start + // Paper start - Add EntityLoadCrossbowEvent
+ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true); + return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
+ } + }
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) { + private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
+ // Paper end + // Paper end - Add EntityLoadCrossbowEvent
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow); int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow);
int j = i == 0 ? 1 : 3; int j = i == 0 ? 1 : 3;
- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; - boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild;
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume + boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - Add EntityLoadCrossbowEvent
ItemStack itemstack1 = shooter.getProjectile(crossbow); ItemStack itemstack1 = shooter.getProjectile(crossbow);
ItemStack itemstack2 = itemstack1.copy(); ItemStack itemstack2 = itemstack1.copy();

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 20 Dec 2020 16:41:44 -0800 Date: Sun, 20 Dec 2020 16:41:44 -0800
Subject: [PATCH] Added WorldGameRuleChangeEvent Subject: [PATCH] Add WorldGameRuleChangeEvent
diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
index c8c358531dbc167e249bac2af246c5e34fbdd4df..307854468ac985560b4c63b6e9897c444a7b8a3a 100644 index c8c358531dbc167e249bac2af246c5e34fbdd4df..10c1790226e25da3b9b599c9a40de57d5727ddc4 100644
--- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java --- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
+++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
@@ -33,7 +33,7 @@ public class GameRuleCommand { @@ -33,7 +33,7 @@ public class GameRuleCommand {
@ -13,12 +13,12 @@ index c8c358531dbc167e249bac2af246c5e34fbdd4df..307854468ac985560b4c63b6e9897c44
T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
- t0.setFromArgument(context, "value"); - t0.setFromArgument(context, "value");
+ t0.setFromArgument(context, "value", key); // Paper + t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent
commandlistenerwrapper.sendSuccess(() -> { commandlistenerwrapper.sendSuccess(() -> {
return Component.translatable("commands.gamerule.set", key.getId(), t0.toString()); return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
}, true); }, true);
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c8e02debe 100644 index 334001cb749600c973c82391e1c11f0e40bd2dfb..f3cdf1fa7731eb7bb1cb89aa6a37204d81257cb0 100644
--- a/src/main/java/net/minecraft/world/level/GameRules.java --- a/src/main/java/net/minecraft/world/level/GameRules.java
+++ b/src/main/java/net/minecraft/world/level/GameRules.java +++ b/src/main/java/net/minecraft/world/level/GameRules.java
@@ -285,10 +285,10 @@ public class GameRules { @@ -285,10 +285,10 @@ public class GameRules {
@ -26,12 +26,12 @@ index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c
} }
- protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name); - protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name);
+ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper + protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
- public void setFromArgument(CommandContext<CommandSourceStack> context, String name) { - public void setFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.updateFromArgument(context, name); - this.updateFromArgument(context, name);
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper + public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
+ this.updateFromArgument(context, name, gameRuleKey); // Paper + this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
this.onChanged(((CommandSourceStack) context.getSource()).getServer()); this.onChanged(((CommandSourceStack) context.getSource()).getServer());
} }
@ -41,11 +41,11 @@ index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c
@Override @Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) { - protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.value = BoolArgumentType.getBool(context, name); - this.value = BoolArgumentType.getBool(context, name);
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start + protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name))); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name)));
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
+ this.value = Boolean.parseBoolean(event.getValue()); + this.value = Boolean.parseBoolean(event.getValue());
+ // Paper end + // Paper end - Add WorldGameRuleChangeEvent
} }
public boolean get() { public boolean get() {
@ -55,30 +55,30 @@ index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c
@Override @Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) { - protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.value = IntegerArgumentType.getInteger(context, name); - this.value = IntegerArgumentType.getInteger(context, name);
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start + protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name))); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name)));
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
+ this.value = Integer.parseInt(event.getValue()); + this.value = Integer.parseInt(event.getValue());
+ // Paper end + // Paper end - Add WorldGameRuleChangeEvent
} }
public int get() { public int get() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 6a6bdc23767d4b0413352eda860f3fd3076f492e..b70239ff42f5c7f4754bae311385e4804891fd86 100644 index 6a6bdc23767d4b0413352eda860f3fd3076f492e..a99d7a75ce12ffb49a6489044db74d18080b2b35 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1930,8 +1930,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1930,8 +1930,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!this.isGameRule(rule)) return false; if (!this.isGameRule(rule)) return false;
+ // Paper start + // Paper start - Add WorldGameRuleChangeEvent
+ GameRule<?> gameRule = GameRule.getByName(rule); + GameRule<?> gameRule = GameRule.getByName(rule);
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value);
+ if (!event.callEvent()) return false; + if (!event.callEvent()) return false;
+ // Paper end + // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
- handle.deserialize(value); - handle.deserialize(value);
+ handle.deserialize(event.getValue()); // Paper + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer()); handle.onChanged(this.getHandle().getServer());
return true; return true;
} }
@ -86,13 +86,13 @@ index 6a6bdc23767d4b0413352eda860f3fd3076f492e..b70239ff42f5c7f4754bae311385e480
if (!this.isGameRule(rule.getName())) return false; if (!this.isGameRule(rule.getName())) return false;
+ // Paper start + // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue)); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue));
+ if (!event.callEvent()) return false; + if (!event.callEvent()) return false;
+ // Paper end + // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
- handle.deserialize(newValue.toString()); - handle.deserialize(newValue.toString());
+ handle.deserialize(event.getValue()); // Paper + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer()); handle.onChanged(this.getHandle().getServer());
return true; return true;
} }

View File

@ -1,24 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 20:04:01 -0800 Date: Wed, 2 Dec 2020 20:04:01 -0800
Subject: [PATCH] Added ServerResourcesReloadedEvent Subject: [PATCH] Add ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6a23b1ad4c7fd9deaff05e8d00ad6a77a6ed0cec..a75c6825eaee07bbde9b7c81c4232bc982a98326 100644 index c0546f796cac661684e3fe394d93f1a7d2a55a74..8d3b3524a939d483aa4d451a8ca0fed3a9c87d26 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2094,7 +2094,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2094,7 +2094,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.functionManager; return this.functionManager;
} }
+ // Paper start - add cause + // Paper start - Add ServerResourcesReloadedEvent
+ @Deprecated @io.papermc.paper.annotation.DoNotUse + @Deprecated @io.papermc.paper.annotation.DoNotUse
public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) { public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) {
+ return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); + return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN);
+ } + }
+ public CompletableFuture<Void> reloadResources(Collection<String> dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { + public CompletableFuture<Void> reloadResources(Collection<String> dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) {
+ // Paper end + // Paper end - Add ServerResourcesReloadedEvent
RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> { CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error
@ -26,12 +26,12 @@ index 6a23b1ad4c7fd9deaff05e8d00ad6a77a6ed0cec..a75c6825eaee07bbde9b7c81c4232bc9
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here
+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - fire after everything has been reloaded + new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - Add ServerResourcesReloadedEvent; fire after everything has been reloaded
}, this); }, this);
if (this.isSameThread()) { if (this.isSameThread()) {
diff --git a/src/main/java/net/minecraft/server/commands/ReloadCommand.java b/src/main/java/net/minecraft/server/commands/ReloadCommand.java diff --git a/src/main/java/net/minecraft/server/commands/ReloadCommand.java b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3fc82d054 100644 index fa18d018a8458b30c0048f7e59aea39f928d974a..c020c86194723a5c89816f91e0b7c5eeaf132b7e 100644
--- a/src/main/java/net/minecraft/server/commands/ReloadCommand.java --- a/src/main/java/net/minecraft/server/commands/ReloadCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ReloadCommand.java +++ b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
@@ -20,7 +20,7 @@ public class ReloadCommand { @@ -20,7 +20,7 @@ public class ReloadCommand {
@ -39,7 +39,7 @@ index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3
public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) { public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) {
- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> { - source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> {
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { + source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper - Add ServerResourcesReloadedEvent
ReloadCommand.LOGGER.warn("Failed to execute reload", throwable); ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
source.sendFailure(Component.translatable("commands.reload.failure")); source.sendFailure(Component.translatable("commands.reload.failure"));
return null; return null;
@ -48,7 +48,7 @@ index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3
Collection<String> collection = resourcepackrepository.getSelectedIds(); Collection<String> collection = resourcepackrepository.getSelectedIds();
Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection); Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection);
- minecraftserver.reloadResources(collection1); - minecraftserver.reloadResources(collection1);
+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper + minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - Add ServerResourcesReloadedEvent
} }
// CraftBukkit end // CraftBukkit end

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 28 Nov 2020 18:43:52 -0800 Date: Sat, 28 Nov 2020 18:43:52 -0800
Subject: [PATCH] Added world settings for mobs picking up loot Subject: [PATCH] Add world settings for mobs picking up loot
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index dadb419a04b343d6ba59353c6caa1a50aa07b67f..6be9e8d693bbb084791d7b30a1891ddb803d6b02 100644 index dadb419a04b343d6ba59353c6caa1a50aa07b67f..117d466e1b4f545f6fd5006c3822c5586db96032 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -153,7 +153,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -153,7 +153,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@ -13,12 +13,12 @@ index dadb419a04b343d6ba59353c6caa1a50aa07b67f..6be9e8d693bbb084791d7b30a1891ddb
this.populateDefaultEquipmentEnchantments(randomsource, difficulty); this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
this.reassessWeaponGoal(); this.reassessWeaponGoal();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper + this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
LocalDate localdate = LocalDate.now(); LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH); int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..8d66d90973931575a6c071965d582da6a9d30b10 100644 index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..c635ca601a4f4a3c0684ab3b6c3a568c6b5515f7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -507,7 +507,7 @@ public class Zombie extends Monster { @@ -507,7 +507,7 @@ public class Zombie extends Monster {
@ -26,7 +26,7 @@ index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..8d66d90973931575a6c071965d582da6
float f = difficulty.getSpecialMultiplier(); float f = difficulty.getSpecialMultiplier();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f);
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper + this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper - Add world settings for mobs picking up loot
if (object == null) { if (object == null) {
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
} }

View File

@ -1,33 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com> From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
Date: Wed, 22 Apr 2020 09:40:38 +0200 Date: Wed, 22 Apr 2020 09:40:38 +0200
Subject: [PATCH] Implemented BlockFailedDispenseEvent Subject: [PATCH] Add BlockFailedDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index d77ca08832105e82cee265eea222e0d64a8876ef..21c37ad365e09a296c3e7a2d0cde7a29ced09c33 100644 index d77ca08832105e82cee265eea222e0d64a8876ef..5593a0aa9e618071b6521b213dde0f628348c3dc 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -95,8 +95,10 @@ public class DispenserBlock extends BaseEntityBlock { @@ -95,8 +95,10 @@ public class DispenserBlock extends BaseEntityBlock {
int i = tileentitydispenser.getRandomSlot(world.random); int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) { if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - BlockFailedDispenseEvent is called here + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - Add BlockFailedDispenseEvent
world.levelEvent(1001, pos, 0); world.levelEvent(1001, pos, 0);
world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper + } // Paper - Add BlockFailedDispenseEvent
} else { } else {
ItemStack itemstack = tileentitydispenser.getItem(i); ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
index 913ed110d8402d377152753325901eb7f3ac82d6..675644974ae6fb5380a6496a2ac3ec4d1ef7c924 100644 index 913ed110d8402d377152753325901eb7f3ac82d6..1d13f8a1009d6eda351c697052d499d594a6aaa8 100644
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java --- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
@@ -59,6 +59,7 @@ public class DropperBlock extends DispenserBlock { @@ -59,6 +59,7 @@ public class DropperBlock extends DispenserBlock {
int i = tileentitydispenser.getRandomSlot(world.random); int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) { if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - Add BlockFailedDispenseEvent
world.levelEvent(1001, pos, 0); world.levelEvent(1001, pos, 0);
} else { } else {
ItemStack itemstack = tileentitydispenser.getItem(i); ItemStack itemstack = tileentitydispenser.getItem(i);

View File

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 23 Nov 2020 12:58:51 -0800 Date: Mon, 23 Nov 2020 12:58:51 -0800
Subject: [PATCH] Added PlayerLecternPageChangeEvent Subject: [PATCH] Add PlayerLecternPageChangeEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..84795cd53720a618360644702b22abe8d015dadc 100644 index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..ccba06c419732c63f6b255f5f8c1f7a95f3ecbee 100644
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java --- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
@@ -64,6 +64,7 @@ public class LecternMenu extends AbstractContainerMenu { @@ -64,6 +64,7 @@ public class LecternMenu extends AbstractContainerMenu {
@Override @Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
int j; int j;
+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper + io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper - Add PlayerLecternPageChangeEvent
if (id >= 100) { if (id >= 100) {
j = id - 100; j = id - 100;
@ -21,26 +21,26 @@ index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..84795cd53720a618360644702b22abe8
case 1: case 1:
j = this.lecternData.get(0); j = this.lecternData.get(0);
- this.setData(0, j - 1); - this.setData(0, j - 1);
+ // Paper start + // Paper start - Add PlayerLecternPageChangeEvent
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); + bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1); + playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
+ if (!playerLecternPageChangeEvent.callEvent()) { + if (!playerLecternPageChangeEvent.callEvent()) {
+ return false; + return false;
+ } + }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage()); + this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end + // Paper end - Add PlayerLecternPageChangeEvent
return true; return true;
case 2: case 2:
j = this.lecternData.get(0); j = this.lecternData.get(0);
- this.setData(0, j + 1); - this.setData(0, j + 1);
+ // Paper start + // Paper start - Add PlayerLecternPageChangeEvent
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); + bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1); + playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
+ if (!playerLecternPageChangeEvent.callEvent()) { + if (!playerLecternPageChangeEvent.callEvent()) {
+ return false; + return false;
+ } + }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage()); + this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end + // Paper end - Add PlayerLecternPageChangeEvent
return true; return true;
case 3: case 3:
if (!player.mayBuild()) { if (!player.mayBuild()) {

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 25 Nov 2020 16:33:27 -0800 Date: Wed, 25 Nov 2020 16:33:27 -0800
Subject: [PATCH] Added PlayerLoomPatternSelectEvent Subject: [PATCH] Add PlayerLoomPatternSelectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f978017931 100644 index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..aee37b2fc205cef98d2ff0f42e9cba0a6de6bf45 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -173,8 +173,35 @@ public class LoomMenu extends AbstractContainerMenu { @@ -173,8 +173,35 @@ public class LoomMenu extends AbstractContainerMenu {
@ -14,7 +14,7 @@ index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f9
if (id >= 0 && id < this.selectablePatterns.size()) { if (id >= 0 && id < this.selectablePatterns.size()) {
- this.selectedBannerPatternIndex.set(id); - this.selectedBannerPatternIndex.set(id);
- this.setupResultSlot((Holder) this.selectablePatterns.get(id)); - this.setupResultSlot((Holder) this.selectablePatterns.get(id));
+ // Paper start + // Paper start - Add PlayerLoomPatternSelectEvent
+ int selectablePatternIndex = id; + int selectablePatternIndex = id;
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(this.selectablePatterns.get(selectablePatternIndex).value().getHashname())); + io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(this.selectablePatterns.get(selectablePatternIndex).value().getHashname()));
+ if (!event.callEvent()) { + if (!event.callEvent()) {
@ -42,7 +42,7 @@ index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f9
+ ((Player) player.getBukkitEntity()).updateInventory(); + ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedBannerPatternIndex.set(selectablePatternIndex); + this.selectedBannerPatternIndex.set(selectablePatternIndex);
+ this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected")); + this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected"));
+ // Paper end + // Paper end - Add PlayerLoomPatternSelectEvent
return true; return true;
} else { } else {
return false; return false;

View File

@ -10,7 +10,7 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE
Co-authored-by: Doc <nachito94@msn.com> Co-authored-by: Doc <nachito94@msn.com>
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..ad41bbbf5395ed18c2c9e1e692c7661a6e0cb98c 100644 index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..a6af5ac9d09834940d3dd4c80b16450b90484edb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager { @@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager {
@ -18,12 +18,12 @@ index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..ad41bbbf5395ed18c2c9e1e692c7661a
static class VindicatorBreakDoorGoal extends BreakDoorGoal { static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) { public VindicatorBreakDoorGoal(Mob mob) {
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE); - super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper + super(mob, 6, com.google.common.base.Predicates.in(mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper - Configurable door breaking difficulty
this.setFlags(EnumSet.of(Goal.Flag.MOVE)); this.setFlags(EnumSet.of(Goal.Flag.MOVE));
} }
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 8d66d90973931575a6c071965d582da6a9d30b10..b31f6b267693c409d58eee688a3b79a1cf14e391 100644 index c635ca601a4f4a3c0684ab3b6c3a568c6b5515f7..359319846c5f9c25e5e2b019777fd938165fd312 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -100,7 +100,7 @@ public class Zombie extends Monster { @@ -100,7 +100,7 @@ public class Zombie extends Monster {
@ -31,7 +31,7 @@ index 8d66d90973931575a6c071965d582da6a9d30b10..b31f6b267693c409d58eee688a3b79a1
public Zombie(EntityType<? extends Zombie> type, Level world) { public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world); super(type, world);
- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE); - this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE);
+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper + this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
} }
public Zombie(Level world) { public Zombie(Level world) {

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 902f3a7ae5ba9c15b634bb2f214be7d85c6d5a00..efbdcaff160e1c8e666d54a9babe35ac325ec8a5 100644 index 902f3a7ae5ba9c15b634bb2f214be7d85c6d5a00..7b76cba12680d7a8720c597b3a98b08ee5313f63 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2103,6 +2103,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2103,6 +2103,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}); });
optional1.ifPresent((holder) -> { optional1.ifPresent((holder) -> {
this.getServer().execute(() -> { this.getServer().execute(() -> {
+ // Paper start + // Paper start - Remove stale POIs
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) { + if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
+ this.getPoiManager().remove(blockposition1); + this.getPoiManager().remove(blockposition1);
+ } + }
+ // Paper end + // Paper end - Remove stale POIs
this.getPoiManager().add(blockposition1, holder); this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1); DebugPackets.sendPoiAddedPacket(this, blockposition1);
}); });

View File

@ -5,21 +5,21 @@ Subject: [PATCH] Fix villager boat exploit
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d727e401b311eea832315cc681fa7d73886c3f99..0c495698438e4dd29d4bcddb0c88978fc58db8f3 100644 index d727e401b311eea832315cc681fa7d73886c3f99..617f8776797e07b5d2ad632b5e049b287984d504 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -604,6 +604,14 @@ public abstract class PlayerList { @@ -604,6 +604,14 @@ public abstract class PlayerList {
PlayerList.LOGGER.debug("Removing player mount"); PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding(); entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> { entity.getPassengersAndSelf().forEach((entity1) -> {
+ // Paper start + // Paper start - Fix villager boat exploit
+ if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) { + if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer(); + final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
+ if (human != null) { + if (human != null) {
+ villager.setTradingPlayer(null); + villager.setTradingPlayer(null);
+ } + }
+ } + }
+ // Paper end + // Paper end - Fix villager boat exploit
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER); entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
}); });
} }

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0c495698438e4dd29d4bcddb0c88978fc58db8f3..3aeaf4cb425b141d1a90a40cdee95bc98b2aeb56 100644 index 617f8776797e07b5d2ad632b5e049b287984d504..d80b05fb33d1f519923f8ef189ff9025335d9390 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1103,6 +1103,11 @@ public abstract class PlayerList { @@ -1103,6 +1103,11 @@ public abstract class PlayerList {
} }
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
+ // Paper start - add recalculatePermissions parameter + // Paper start - Add sendOpLevel API
+ this.sendPlayerPermissionLevel(player, permissionLevel, true); + this.sendPlayerPermissionLevel(player, permissionLevel, true);
+ } + }
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) { + public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
+ // Paper end + // Paper end - Add sendOpLevel API
if (player.connection != null) { if (player.connection != null) {
byte b0; byte b0;
@ -24,29 +24,29 @@ index 0c495698438e4dd29d4bcddb0c88978fc58db8f3..3aeaf4cb425b141d1a90a40cdee95bc9
player.connection.send(new ClientboundEntityEventPacket(player, b0)); player.connection.send(new ClientboundEntityEventPacket(player, b0));
} }
+ if (recalculatePermissions) { // Paper + if (recalculatePermissions) { // Paper - Add sendOpLevel API
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player); this.server.getCommands().sendCommands(player);
+ } // Paper + } // Paper - Add sendOpLevel API
} }
public boolean isWhiteListed(GameProfile profile) { public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ba30c5e17a294cee9f408fdd4e31849c0e5d28ed..8a924ae677a93a177651aa1ec0728e3b8d5528a6 100644 index ba30c5e17a294cee9f408fdd4e31849c0e5d28ed..298380e217f41f01d0818767a6d8f1da5a004037 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -633,6 +633,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -633,6 +633,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end // Paper end
+ // Paper start - sendOpLevel API + // Paper start - Add sendOpLevel API
+ @Override + @Override
+ public void sendOpLevel(byte level) { + public void sendOpLevel(byte level) {
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]"); + Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
+ +
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false); + this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
+ } + }
+ // Paper end - sendOpLevel API + // Paper end - Add sendOpLevel API
+ +
@Override @Override
public void setCompassTarget(Location loc) { public void setCompassTarget(Location loc) {

View File

@ -5,38 +5,38 @@ Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5436949cd928303cf80b606c747f386f0189f774..025ec74fe0ada57e1809d7e16c27b3a08007ad78 100644 index 3a8572ded5c9bdf621a8c16123707da9ceb70d54..1249e086d022a68e1d27a7731c0aff92f1457e43 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1934,6 +1934,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1934,6 +1934,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void push(Entity entity) { public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) { if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) { if (!entity.noPhysics && !this.noPhysics) {
+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper + if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
double d0 = entity.getX() - this.getX(); double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1); double d2 = Mth.absMax(d0, d1);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 82ffd50017dc234a9718db551fca0e73a6deded0..9780232286052d2cbbd604e71caf47dfb81fc1dc 100644 index 82ffd50017dc234a9718db551fca0e73a6deded0..71361cc7339483936b18d2e0e938669bf08d68d2 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -792,6 +792,7 @@ public abstract class AbstractMinecart extends VehicleEntity { @@ -792,6 +792,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
public void push(Entity entity) { public void push(Entity entity) {
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) { if (!entity.noPhysics && !this.noPhysics) {
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper + if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
if (!this.hasPassenger(entity)) { if (!this.hasPassenger(entity)) {
// CraftBukkit start // CraftBukkit start
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 6b0ec9da5a368775924f5b97c74acc5bfd609fa1..8b0efc4d78a04effddae0799b7ee5759ed5c720f 100644 index 6b0ec9da5a368775924f5b97c74acc5bfd609fa1..8a1cd9227d6f889dd8036ec593ee48862966af75 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -207,6 +207,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> { @@ -207,6 +207,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@Override @Override
public void push(Entity entity) { public void push(Entity entity) {
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper + if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
if (entity instanceof Boat) { if (entity instanceof Boat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start // CraftBukkit start

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Return chat component with empty text instead of throwing
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index c6ac55cdece9e2901e5d17a23408171c6c49ff69..b22cf4636108794092d8e289368b72a10a16d3cd 100644 index c6ac55cdece9e2901e5d17a23408171c6c49ff69..d18c7ac003e8537b9bf389ad3ad58e80242ec502 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -89,7 +89,12 @@ public abstract class AbstractContainerMenu { @@ -89,7 +89,12 @@ public abstract class AbstractContainerMenu {
@ -16,10 +16,10 @@ index c6ac55cdece9e2901e5d17a23408171c6c49ff69..b22cf4636108794092d8e289368b72a1
- Preconditions.checkState(this.title != null, "Title not set"); - Preconditions.checkState(this.title != null, "Title not set");
+ // Paper start - return chat component with empty text instead of throwing error + // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set"); + // Preconditions.checkState(this.title != null, "Title not set");
+ if(this.title == null){ + if (this.title == null){
+ return Component.literal(""); + return Component.literal("");
+ } + }
+ // Paper end + // Paper end - return chat component with empty text instead of throwing error
return this.title; return this.title;
} }
public final void setTitle(Component title) { public final void setTitle(Component title) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Make schedule command per-world
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab586c17f4 100644 index 569b645c6d795401c974069d0be7195590cd354a..7b4ee914fb7681760446f864cf3f2f8cab180dd6 100644
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java --- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java +++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
@@ -30,7 +30,7 @@ public class ScheduleCommand { @@ -30,7 +30,7 @@ public class ScheduleCommand {
@ -13,7 +13,7 @@ index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab
}); });
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> { private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder); - return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper + return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper - Make schedule command per-world
}; };
public ScheduleCommand() {} public ScheduleCommand() {}
@ -22,7 +22,7 @@ index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException { private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName); - int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName);
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper + int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper - Make schedule command per-world
if (i == 0) { if (i == 0) {
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName); throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576c45a8045 100644 index b5964614823059261c28eb2e998ad54249f07e7b..08245016186c47077294f758409f8bf14398199f 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -56,7 +56,7 @@ public abstract class PathfinderMob extends Mob { @@ -56,7 +56,7 @@ public abstract class PathfinderMob extends Mob {
@ -13,7 +13,7 @@ index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
- if (f > 10.0F) { - if (f > 10.0F) {
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true); this.dropLeash(true, true);
} }
@ -22,7 +22,7 @@ index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576
this.onLeashDistance(f); this.onLeashDistance(f);
- if (f > 10.0F) { - if (f > 10.0F) {
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true); this.dropLeash(true, true);
this.goalSelector.disableControlFlag(Goal.Flag.MOVE); this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

View File

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com> From: Madeline Miller <mnmiller1@me.com>
Date: Sun, 17 Jan 2021 13:16:09 +1000 Date: Sun, 17 Jan 2021 13:16:09 +1000
Subject: [PATCH] Implement BlockPreDispenseEvent Subject: [PATCH] Add BlockPreDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index 21c37ad365e09a296c3e7a2d0cde7a29ced09c33..52e92ffd6bf5d3d721807a0b3a8e2d301951f934 100644 index 5593a0aa9e618071b6521b213dde0f628348c3dc..1ee863ec252872deb15a6b96f1d937c672ce5898 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -104,6 +104,7 @@ public class DispenserBlock extends BaseEntityBlock { @@ -104,6 +104,7 @@ public class DispenserBlock extends BaseEntityBlock {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != DispenseItemBehavior.NOOP) { if (idispensebehavior != DispenseItemBehavior.NOOP) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
DispenserBlock.eventFired = false; // CraftBukkit - reset event status DispenserBlock.eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
} }

View File

@ -1,40 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 24 Jun 2020 15:14:51 -0600 Date: Wed, 24 Jun 2020 15:14:51 -0600
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent Subject: [PATCH] Add PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index e6a4e8dcdbc49b427c2802f1a358f8f9ad04d0f0..685c35419de7e3c4e854a28118a243e65250ef59 100644 index e6a4e8dcdbc49b427c2802f1a358f8f9ad04d0f0..611cbe0e47474f94cd203ac86ca9e80cab621134 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -169,13 +169,27 @@ public class BeaconMenu extends AbstractContainerMenu { @@ -169,13 +169,26 @@ public class BeaconMenu extends AbstractContainerMenu {
public MobEffect getSecondaryEffect() { public MobEffect getSecondaryEffect() {
return BeaconMenu.decodeEffect(this.beaconData.get(2)); return BeaconMenu.decodeEffect(this.beaconData.get(2));
} }
+ // Paper start + // Paper start - Add PlayerChangeBeaconEffectEvent
+ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) { + private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) {
+ return effect.flatMap(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT::getResourceKey).map(key -> { + return effect.flatMap(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT::getResourceKey).map(key -> {
+ return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location())); + return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()));
+ }).orElse(null); + }).orElse(null);
+ } + }
+ // Paper end + // Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) { public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
if (this.paymentSlot.hasItem()) { if (this.paymentSlot.hasItem()) {
- this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error - this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error
- this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error - this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error
+ // Paper start + // Paper start - Add PlayerChangeBeaconEffectEvent
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); + io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
+ if (event.callEvent()) { + if (event.callEvent()) {
+ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary()))); + this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary())));
+ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary()))); + this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary())));
+ if (event.willConsumeItem()) { + if (event.willConsumeItem()) {
+ // Paper end
this.paymentSlot.remove(1); this.paymentSlot.remove(1);
+ } + }
this.access.execute(Level::blockEntityChanged); this.access.execute(Level::blockEntityChanged);
+ } // Paper end + } // Paper end - Add PlayerChangeBeaconEffectEvent
} }
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..99321471d2c8c154059ebf345c63f8918a4cd75a 100644 index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..3c5e18a5d136917c65bbfe1311c881d1b8bbd164 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -407,7 +407,7 @@ public class EndDragonFight { @@ -407,7 +407,7 @@ public class EndDragonFight {
@ -13,7 +13,7 @@ index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..99321471d2c8c154059ebf345c63f891
this.spawnExitPortal(true); this.spawnExitPortal(true);
this.spawnNewGateway(); this.spawnNewGateway();
- if (!this.previouslyKilled) { - if (!this.previouslyKilled) {
+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg + if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg
this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
} }

View File

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 27 Nov 2020 17:14:27 -0800 Date: Fri, 27 Nov 2020 17:14:27 -0800
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent Subject: [PATCH] Add PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger <admin@benndorf.dev> Co-Authored-By: MiniDigger <admin@benndorf.dev>
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114fe06242f 100644 index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..a5763abd3137e993ec856874b8fe7ef82dd6f570 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -63,7 +63,7 @@ public class StonecutterMenu extends AbstractContainerMenu { @@ -63,7 +63,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@ -14,7 +14,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) { public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
super(MenuType.STONECUTTER, syncId); super(MenuType.STONECUTTER, syncId);
- this.selectedRecipeIndex = DataSlot.standalone(); - this.selectedRecipeIndex = DataSlot.standalone();
+ this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - allow replication + this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - Add PlayerStonecutterRecipeSelectEvent
this.recipes = Lists.newArrayList(); this.recipes = Lists.newArrayList();
this.input = ItemStack.EMPTY; this.input = ItemStack.EMPTY;
this.slotUpdateListener = () -> { this.slotUpdateListener = () -> {
@ -23,7 +23,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (this.isValidRecipeIndex(id)) { if (this.isValidRecipeIndex(id)) {
- this.selectedRecipeIndex.set(id); - this.selectedRecipeIndex.set(id);
+ // Paper start + // Paper start - Add PlayerStonecutterRecipeSelectEvent
+ int recipeIndex = id; + int recipeIndex = id;
+ this.selectedRecipeIndex.set(recipeIndex); + this.selectedRecipeIndex.set(recipeIndex);
+ this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed + this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed
@ -45,7 +45,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
+ } + }
+ ((Player) player.getBukkitEntity()).updateInventory(); + ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it + this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it
+ // Paper end + // Paper end - Add PlayerStonecutterRecipeSelectEvent
this.setupResultSlot(); this.setupResultSlot();
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expand EntityUnleashEvent
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b8bbcdd15 100644 index 3da1debb3ad884d9ba2f8ebea52643e8fcb3a747..c64c8efc7fcf77a78c7807bf8def32cbd748b84d 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1305,12 +1305,15 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -1305,12 +1305,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -13,16 +13,16 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
} else if (this.getLeashHolder() == player) { } else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent // CraftBukkit start - fire PlayerUnleashEntityEvent
- if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand).isCancelled()) { - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand).isCancelled()) {
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild); + org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ // Paper end + // Paper end - Expand EntityUnleashEvent
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder()));
return InteractionResult.PASS; return InteractionResult.PASS;
} }
// CraftBukkit end // CraftBukkit end
- this.dropLeash(true, !player.getAbilities().instabuild); - this.dropLeash(true, !player.getAbilities().instabuild);
+ this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable + this.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent
this.gameEvent(GameEvent.ENTITY_INTERACT, player); this.gameEvent(GameEvent.ENTITY_INTERACT, player);
return InteractionResult.sidedSuccess(this.level().isClientSide); return InteractionResult.sidedSuccess(this.level().isClientSide);
} else { } else {
@ -32,11 +32,11 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
if (!this.isAlive() || !this.leashHolder.isAlive()) { if (!this.isAlive() || !this.leashHolder.isAlive()) {
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
- this.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin - this.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, !this.leashHolder.pluginRemoved); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, !this.leashHolder.pluginRemoved);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end - Expand EntityUnleashEvent
} }
} }
@ -46,11 +46,11 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, true); - this.dropLeash(true, true);
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ if (!event.callEvent()) { return flag1; } + if (!event.callEvent()) { return flag1; }
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end - Expand EntityUnleashEvent
} }
return flag1; return flag1;
@ -60,48 +60,48 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
super.removeAfterChangingDimensions(); super.removeAfterChangingDimensions();
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, false); - this.dropLeash(true, false);
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end - Expand EntityUnleashEvent
this.getAllSlots().forEach((itemstack) -> { this.getAllSlots().forEach((itemstack) -> {
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
itemstack.setCount(0); itemstack.setCount(0);
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 452f219fde958fb4dc775cd2c56c0576c45a8045..7ed610c67fcfa200c30e13a49146907f765bc5ed 100644 index 08245016186c47077294f758409f8bf14398199f..3d95257d2203fe40bb1fab58ad2a1f9e815184a9 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -57,8 +57,11 @@ public abstract class PathfinderMob extends Mob { @@ -57,8 +57,11 @@ public abstract class PathfinderMob extends Mob {
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true); - this.dropLeash(true, true);
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end - Expand EntityUnleashEvent
} }
return; return;
@@ -66,8 +69,11 @@ public abstract class PathfinderMob extends Mob { @@ -66,8 +69,11 @@ public abstract class PathfinderMob extends Mob {
this.onLeashDistance(f); this.onLeashDistance(f);
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true); - this.dropLeash(true, true);
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end - Expand EntityUnleashEvent
this.goalSelector.disableControlFlag(Goal.Flag.MOVE); this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
} else if (f > 6.0F) { } else if (f > 6.0F) {
double d0 = (entity.getX() - this.getX()) / (double) f; double d0 = (entity.getX() - this.getX()) / (double) f;
diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63659bc0ca 100644 index 16784fcc853e23689a854e7dc6c03ed8182a164e..006aba8bbb34a0d45ef626a1d299e81909cf9ba1 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
@@ -126,11 +126,14 @@ public class LeashFenceKnotEntity extends HangingEntity { @@ -126,11 +126,14 @@ public class LeashFenceKnotEntity extends HangingEntity {
@ -109,20 +109,20 @@ index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) { if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
// CraftBukkit start // CraftBukkit start
- if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand).isCancelled()) { - if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand).isCancelled()) {
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand, !player.getAbilities().instabuild); + org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand, !player.getAbilities().instabuild);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ // Paper end + // Paper end - Expand EntityUnleashEvent
die = false; die = false;
continue; continue;
} }
- entityinsentient1.dropLeash(true, !player.getAbilities().instabuild); // false -> survival mode boolean - entityinsentient1.dropLeash(true, !player.getAbilities().instabuild); // false -> survival mode boolean
+ entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - drop leash variable + entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent
// CraftBukkit end // CraftBukkit end
flag1 = true; flag1 = true;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 3fef79f0e3b8a05b11b77802b80acc8e5c584653..2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a 100644 index 3fef79f0e3b8a05b11b77802b80acc8e5c584653..8761bb7b61d322bc1e29d217631a9d2c70e5bcc4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1637,8 +1637,10 @@ public class CraftEventFactory { @@ -1637,8 +1637,10 @@ public class CraftEventFactory {
@ -131,10 +131,10 @@ index 3fef79f0e3b8a05b11b77802b80acc8e5c584653..2d9d6d735a13e0e0fc1f277f48c7bdb0
- public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand) { - public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand) {
- PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand)); - PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand));
+ // Paper start - drop leash variable + // Paper start - Expand EntityUnleashEvent
+ public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand, boolean dropLeash) { + public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand, boolean dropLeash) {
+ PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), dropLeash); + PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), dropLeash);
+ // Paper end + // Paper end - Expand EntityUnleashEvent
entity.level().getCraftServer().getPluginManager().callEvent(event); entity.level().getCraftServer().getPluginManager().callEvent(event);
return event; return event;
} }

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Reset shield blocking on dimension change
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ff75234d76e4f6a939841c982a6fc3e33b36ea61..33477a639304c1491b5eea8585051e266ec93bc7 100644 index ff75234d76e4f6a939841c982a6fc3e33b36ea61..468d96f4b1e83d81fec8997557964931c7512a35 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1247,6 +1247,11 @@ public class ServerPlayer extends Player { @@ -1247,6 +1247,11 @@ public class ServerPlayer extends Player {
this.level().getCraftServer().getPluginManager().callEvent(changeEvent); this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end // CraftBukkit end
} }
+ // Paper start + // Paper start - Reset shield blocking on dimension change
+ if (this.isBlocking()) { + if (this.isBlocking()) {
+ this.stopUsingItem(); + this.stopUsingItem();
+ } + }
+ // Paper end + // Paper end - Reset shield blocking on dimension change
return this; return this;
} }

View File

@ -1,35 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com> From: Trigary <trigary0@gmail.com>
Date: Mon, 25 Jan 2021 14:53:57 +0100 Date: Mon, 25 Jan 2021 14:53:57 +0100
Subject: [PATCH] add DragonEggFormEvent Subject: [PATCH] Add DragonEggFormEvent
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 99321471d2c8c154059ebf345c63f8918a4cd75a..c29ccc66c95faba425acb0ca06af15e2783b4bae 100644 index 3c5e18a5d136917c65bbfe1311c881d1b8bbd164..5ba7bf72f08980b1c16240a5376ad8c3c9379100 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -407,9 +407,23 @@ public class EndDragonFight { @@ -407,8 +407,22 @@ public class EndDragonFight {
this.dragonEvent.setVisible(false); this.dragonEvent.setVisible(false);
this.spawnExitPortal(true); this.spawnExitPortal(true);
this.spawnNewGateway(); this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent + // Paper start - Add DragonEggFormEvent
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)); + BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin));
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition); + org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState()); + eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState, + io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); + new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
+ // Paper end - DragonEggFormEvent + // Paper end - Add DragonEggFormEvent
if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); - this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ // Paper start - DragonEggFormEvent + // Paper start - Add DragonEggFormEvent
+ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); + // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ } else { + } else {
+ eggEvent.setCancelled(true); + eggEvent.setCancelled(true);
+ } + }
+ if (eggEvent.callEvent()) { + if (eggEvent.callEvent()) {
+ eggEvent.getNewState().update(true); + eggEvent.getNewState().update(true);
+ // Paper end - Add DragonEggFormEvent
} }
+ // Paper end - DragonEggFormEvent
this.previouslyKilled = true; this.previouslyKilled = true;
this.dragonKilled = true;

View File

@ -1,42 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com> From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 11 Feb 2020 21:56:48 -0600 Date: Tue, 11 Feb 2020 21:56:48 -0600
Subject: [PATCH] EntityMoveEvent Subject: [PATCH] Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a75c6825eaee07bbde9b7c81c4232bc982a98326..f89d2dc9ec8bfe0b401b96bffd59502bf903a24d 100644 index 8d3b3524a939d483aa4d451a8ca0fed3a9c87d26..37a5775a96a894a5419f01886fba471f0c62aba0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1584,6 +1584,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1584,6 +1584,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
this.profiler.push(() -> { this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location(); return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index efbdcaff160e1c8e666d54a9babe35ac325ec8a5..3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01 100644 index 7b76cba12680d7a8720c597b3a98b08ee5313f63..9f39445a78bfea25a12278b4410a44caf3cf929e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable; public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid; public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper public boolean hasPhysicsEvent = true; // Paper
+ public boolean hasEntityMoveEvent = false; // Paper + public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent
public static Throwable getAddToWorldStackTrace(Entity entity) { public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr); io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7d72477cdeaa8238da1291c0a902d090463b95c8..51916ff6f45090cf5e2da6b12640c130533fc4d9 100644 index 7d72477cdeaa8238da1291c0a902d090463b95c8..1681b63e49cb4f84b1caf0e1b02db19ede08ba13 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3361,6 +3361,20 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3361,6 +3361,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities(); this.pushEntities();
this.level().getProfiler().pop(); this.level().getProfiler().pop();
+ // Paper start + // Paper start - Add EntityMoveEvent
+ if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { + if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { + if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO); + Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
@ -49,7 +49,7 @@ index 7d72477cdeaa8238da1291c0a902d090463b95c8..51916ff6f45090cf5e2da6b12640c130
+ } + }
+ } + }
+ } + }
+ // Paper end + // Paper end - Add EntityMoveEvent
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F); this.hurt(this.damageSources().drown(), 1.0F);
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01..a3288d3cd160978e8bab4ca34d1fe6dbee042e28 100644 index 9f39445a78bfea25a12278b4410a44caf3cf929e..da32aad077fb36cc17f420cc445530eec173e110 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1677,6 +1677,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1677,6 +1677,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -20,7 +20,7 @@ index 3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01..a3288d3cd160978e8bab4ca34d1fe6db
} }
} }
+ } // Paper + } // Paper - option to disable pathfinding updates
} }
@Override @Override

View File

@ -7,18 +7,18 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is
critical section for much of the server, including the lighting engine. critical section for much of the server, including the lighting engine.
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267 100644 index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7eee91df1e7 100644
--- a/src/main/java/net/minecraft/core/Direction.java --- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java
@@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable { @@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable {
})).toArray((i) -> { })).toArray((i) -> {
return new Direction[i]; return new Direction[i];
}); });
+ // Paper start + // Paper start - Perf: Inline shift direction fields
+ private final int adjX; + private final int adjX;
+ private final int adjY; + private final int adjY;
+ private final int adjZ; + private final int adjZ;
+ // Paper end + // Paper end - Perf: Inline shift direction fields
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id; this.data3d = id;
@ -26,11 +26,11 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fd
this.axis = axis; this.axis = axis;
this.axisDirection = direction; this.axisDirection = direction;
this.normal = vector; this.normal = vector;
+ // Paper start + // Paper start - Perf: Inline shift direction fields
+ this.adjX = vector.getX(); + this.adjX = vector.getX();
+ this.adjY = vector.getY(); + this.adjY = vector.getY();
+ this.adjZ = vector.getZ(); + this.adjZ = vector.getZ();
+ // Paper end + // Paper end - Perf: Inline shift direction fields
} }
public static Direction[] orderedByNearest(Entity entity) { public static Direction[] orderedByNearest(Entity entity) {
@ -39,17 +39,17 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fd
public int getStepX() { public int getStepX() {
- return this.normal.getX(); - return this.normal.getX();
+ return this.adjX; // Paper + return this.adjX; // Paper - Perf: Inline shift direction fields
} }
public int getStepY() { public int getStepY() {
- return this.normal.getY(); - return this.normal.getY();
+ return this.adjY; // Paper + return this.adjY; // Paper - Perf: Inline shift direction fields
} }
public int getStepZ() { public int getStepZ() {
- return this.normal.getZ(); - return this.normal.getZ();
+ return this.adjZ; // Paper + return this.adjZ; // Paper - Perf: Inline shift direction fields
} }
public Vector3f step() { public Vector3f step() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3c78ffb12 100644 index 8761bb7b61d322bc1e29d217631a9d2c70e5bcc4..4caddfe884748543f1153dbf066bb2d3f4cd78d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -450,13 +450,30 @@ public class CraftEventFactory { @@ -450,13 +450,30 @@ public class CraftEventFactory {
@ -13,19 +13,19 @@ index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3
public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List<ItemEntity> items) { public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List<ItemEntity> items) {
- BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), Lists.transform(items, (item) -> (org.bukkit.entity.Item) item.getBukkitEntity())); - BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), Lists.transform(items, (item) -> (org.bukkit.entity.Item) item.getBukkitEntity()));
+ // Paper start + // Paper start - Allow adding items to BlockDropItemEvent
+ List<Item> list = new ArrayList<>(); + List<Item> list = new ArrayList<>();
+ for (ItemEntity item : items) { + for (ItemEntity item : items) {
+ list.add((Item) item.getBukkitEntity()); + list.add((Item) item.getBukkitEntity());
+ } + }
+ BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), list); + BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), list);
+ // Paper end + // Paper end - Allow adding items to BlockDropItemEvent
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
- for (ItemEntity item : items) { - for (ItemEntity item : items) {
- item.level().addFreshEntity(item); - item.level().addFreshEntity(item);
+ // Paper start + // Paper start - Allow adding items to BlockDropItemEvent
+ for (Item bukkit : list) { + for (Item bukkit : list) {
+ if (!bukkit.isValid()) { + if (!bukkit.isValid()) {
+ Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle(); + Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle();
@ -38,7 +38,7 @@ index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3
+ bukkit.remove(); + bukkit.remove();
+ } + }
} }
+ // Paper end + // Paper end - Allow adding items to BlockDropItemEvent
} }
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] living entity allow attribute registration
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index d5dfb08f550f5644ff5164170d6c16a3b25a3748..7204b973c3ad9239e82355513f6d538107102e48 100644 index d5dfb08f550f5644ff5164170d6c16a3b25a3748..897d7632ecfea40890433474870dd7a5e534d8ab 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -152,4 +152,12 @@ public class AttributeMap { @@ -152,4 +152,12 @@ public class AttributeMap {
@ -13,44 +13,44 @@ index d5dfb08f550f5644ff5164170d6c16a3b25a3748..7204b973c3ad9239e82355513f6d5381
} }
+ +
+ // Paper - start + // Paper - start - living entity allow attribute registration
+ public void registerAttribute(Attribute attributeBase) { + public void registerAttribute(Attribute attributeBase) {
+ AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute); + AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute);
+ attributes.put(attributeBase, attributeModifiable); + attributes.put(attributeBase, attributeModifiable);
+ } + }
+ // Paper - end + // Paper - end - living entity allow attribute registration
+ +
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
index ea48f1119a940056c37d1d203437bfbfdf13663b..a3f989fd1775adbb84d197c51e22c1889a2f8e18 100644 index ea48f1119a940056c37d1d203437bfbfdf13663b..8a678df56fcf30535957e111d81ad07be5b501ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@@ -35,4 +35,11 @@ public class CraftAttributeMap implements Attributable { @@ -35,4 +35,11 @@ public class CraftAttributeMap implements Attributable {
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute); return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
} }
+ // Paper start + // Paper start - living entity allow attribute registration
+ @Override + @Override
+ public void registerAttribute(Attribute attribute) { + public void registerAttribute(Attribute attribute) {
+ Preconditions.checkArgument(attribute != null, "attribute"); + Preconditions.checkArgument(attribute != null, "attribute");
+ handle.registerAttribute(CraftAttribute.bukkitToMinecraft(attribute)); + handle.registerAttribute(CraftAttribute.bukkitToMinecraft(attribute));
+ } + }
+ // Paper end + // Paper end - living entity allow attribute registration
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f108af0f9047ce8d0ee402838ecbf7840d55ba54..d3f97ba1b03e050b10553ea536bc26a7bfc5b976 100644 index f108af0f9047ce8d0ee402838ecbf7840d55ba54..f874712c1569a30c825c1a904a3bcfbe1085200b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -713,6 +713,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -713,6 +713,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().craftAttributes.getAttribute(attribute); return this.getHandle().craftAttributes.getAttribute(attribute);
} }
+ // Paper start + // Paper start - living entity allow attribute registration
+ @Override + @Override
+ public void registerAttribute(Attribute attribute) { + public void registerAttribute(Attribute attribute) {
+ getHandle().craftAttributes.registerAttribute(attribute); + getHandle().craftAttributes.registerAttribute(attribute);
+ } + }
+ // Paper end + // Paper end - living entity allow attribute registration
+ +
@Override @Override
public void setAI(boolean ai) { public void setAI(boolean ai) {

View File

@ -39,34 +39,34 @@ index 48e0b8a50090735ac44d03bdff22010c60b0d7e5..066b9e4c4f0e7773548eda045cdd1ca8
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 2e93eec8733c5b548a15269a322fe4dd1f189b7d..dd9f611efc95f7d06fd3011fedd5d0317b1d0a85 100644 index 2e93eec8733c5b548a15269a322fe4dd1f189b7d..69b18e312db984eaffa8bae2439c88f73b872c53 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -59,6 +59,15 @@ public class MinecraftServerGui extends JComponent { @@ -59,6 +59,15 @@ public class MinecraftServerGui extends JComponent {
jframe.pack(); jframe.pack();
jframe.setLocationRelativeTo((Component) null); jframe.setLocationRelativeTo((Component) null);
jframe.setVisible(true); jframe.setVisible(true);
+ jframe.setName("Minecraft server"); // Paper + jframe.setName("Minecraft server"); // Paper - Improve ServerGUI
+ +
+ // Paper start - Add logo as frame image + // Paper start - Improve ServerGUI
+ try { + try {
+ jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png")))); + jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
+ } catch (java.io.IOException ignore) { + } catch (java.io.IOException ignore) {
+ } + }
+ // Paper end + // Paper end - Improve ServerGUI
+ +
jframe.addWindowListener(new WindowAdapter() { jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) { public void windowClosing(WindowEvent windowevent) {
if (!servergui.isClosing.getAndSet(true)) { if (!servergui.isClosing.getAndSet(true)) {
diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java
index 7938029cb7aa6f09f78fb1c648357c36edb68510..4073484fefbf1ec6072013f6903f9237eb3ebfbc 100644 index 7938029cb7aa6f09f78fb1c648357c36edb68510..ed94bc86ed47719c2f6c338374edf741bd202c24 100644
--- a/src/main/java/net/minecraft/server/gui/StatsComponent.java --- a/src/main/java/net/minecraft/server/gui/StatsComponent.java
+++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java +++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java
@@ -36,8 +36,17 @@ public class StatsComponent extends JComponent { @@ -36,8 +36,17 @@ public class StatsComponent extends JComponent {
private void tick() { private void tick() {
long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ // Paper start - Add tps entry + // Paper start - Improve ServerGUI
+ double[] tps = org.bukkit.Bukkit.getTPS(); + double[] tps = org.bukkit.Bukkit.getTPS();
+ String[] tpsAvg = new String[tps.length]; + String[] tpsAvg = new String[tps.length];
+ +
@ -76,7 +76,7 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..4073484fefbf1ec6072013f6903f9237
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
+ this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg);
+ // Paper end + // Paper end - Improve ServerGUI
this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint(); this.repaint();
} }
@ -85,11 +85,11 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..4073484fefbf1ec6072013f6903f9237
this.timer.stop(); this.timer.stop();
} }
+ +
+ // Paper - start Add tps entry + // Paper - Improve ServerGUI
+ private static String format(double tps) { + private static String format(double tps) {
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise + return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ } + }
+ // Paper end + // Paper end - Improve ServerGUI
} }
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
new file mode 100644 new file mode 100644

View File

@ -5,35 +5,35 @@ Subject: [PATCH] fix converting txt to json file
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
index a20d47f54f12dfc0a5f76dd969238e34c958b618..935dac757280731bfeb0a8f033cbe315ecac46da 100644 index a20d47f54f12dfc0a5f76dd969238e34c958b618..1c9cf5e1c4ee05724ffcdbd77a19bca1ab2be4d3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
@@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList { @@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList {
this.setViewDistance(dedicatedServerProperties.viewDistance); this.setViewDistance(dedicatedServerProperties.viewDistance);
this.setSimulationDistance(dedicatedServerProperties.simulationDistance); this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get()); super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+ // Paper start - moved from constructor + // Paper start - fix converting txt to json file; moved from constructor
+ } + }
+ @Override + @Override
+ public void loadAndSaveFiles() { + public void loadAndSaveFiles() {
+ // Paper end + // Paper end - fix converting txt to json file
this.loadUserBanList(); this.loadUserBanList();
this.saveUserBanList(); this.saveUserBanList();
this.loadIpBanList(); this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 2d5e8d624b153f55e28d8a4e008dce11853179cf..b5acccc3339e3e2b817116ecf2af228cb641b175 100644 index 2d5e8d624b153f55e28d8a4e008dce11853179cf..f6da2fcc1709d0942ed8332b4f59c6b4131a0b78 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration // Paper end - initialize global and world-defaults configuration
+ // Paper start - convert old users earlier after PlayerList creation but before file load/save + // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
+ if (this.convertOldUsers()) { + if (this.convertOldUsers()) {
+ this.getProfileCache().save(false); // Paper + this.getProfileCache().save(false); // Paper
+ } + }
+ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames + this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
+ // Paper end - convert old users earlier after PlayerList creation but before file load/save + // Paper end - fix converting txt to json file
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@ -48,14 +48,14 @@ index 2d5e8d624b153f55e28d8a4e008dce11853179cf..b5acccc3339e3e2b817116ecf2af228c
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false; return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3aeaf4cb425b141d1a90a40cdee95bc98b2aeb56..72b9c50024e82356491a3d35bf248223f3088b5c 100644 index d80b05fb33d1f519923f8ef189ff9025335d9390..95c2dfe3d37e1fb7673b03089e53caf5fdfc9c0e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -176,6 +176,7 @@ public abstract class PlayerList { @@ -176,6 +176,7 @@ public abstract class PlayerList {
this.maxPlayers = maxPlayers; this.maxPlayers = maxPlayers;
this.playerIo = saveHandler; this.playerIo = saveHandler;
} }
+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor + abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
player.isRealPlayer = true; // Paper player.isRealPlayer = true; // Paper

View File

@ -5,21 +5,21 @@ Subject: [PATCH] Add worldborder events
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede88044b2f735a 100644 index dd74e8a034022fe72a1652f92712182b4910f651..8e441aafff788eab9e3d6d2fc7b70183d90b9ef4 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -123,6 +123,14 @@ public class WorldBorder { @@ -123,6 +123,14 @@ public class WorldBorder {
} }
public void setCenter(double x, double z) { public void setCenter(double x, double z) {
+ // Paper start + // Paper start - Add worldborder events
+ if (this.world != null) { + if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z)); + io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z));
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
+ x = event.getNewCenter().getX(); + x = event.getNewCenter().getX();
+ z = event.getNewCenter().getZ(); + z = event.getNewCenter().getZ();
+ } + }
+ // Paper end + // Paper end - Add worldborder events
this.centerX = x; this.centerX = x;
this.centerZ = z; this.centerZ = z;
this.extent.onCenterChange(); this.extent.onCenterChange();
@ -27,7 +27,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
} }
public void setSize(double size) { public void setSize(double size) {
+ // Paper start + // Paper start - Add worldborder events
+ if (this.world != null) { + if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0); + io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0);
+ if (!event.callEvent()) return; + if (!event.callEvent()) return;
@ -37,7 +37,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
+ } + }
+ size = event.getNewSize(); + size = event.getNewSize();
+ } + }
+ // Paper end + // Paper end - Add worldborder events
this.extent = new WorldBorder.StaticBorderExtent(size); this.extent = new WorldBorder.StaticBorderExtent(size);
Iterator iterator = this.getListeners().iterator(); Iterator iterator = this.getListeners().iterator();
@ -45,7 +45,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
} }
public void lerpSizeBetween(double fromSize, double toSize, long time) { public void lerpSizeBetween(double fromSize, double toSize, long time) {
+ // Paper start + // Paper start - Add worldborder events
+ if (this.world != null) { + if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type; + io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type;
+ if (fromSize == toSize) { // new size = old size + if (fromSize == toSize) { // new size = old size
@ -58,7 +58,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
+ toSize = event.getNewSize(); + toSize = event.getNewSize();
+ time = event.getDuration(); + time = event.getDuration();
+ } + }
+ // Paper end + // Paper end - Add worldborder events
this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time)); this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time));
Iterator iterator = this.getListeners().iterator(); Iterator iterator = this.getListeners().iterator();
@ -66,7 +66,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
@Override @Override
public WorldBorder.BorderExtent update() { public WorldBorder.BorderExtent update() {
+ if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper + if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper - Add worldborder events
return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this); return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this);
} }

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 5 Jul 2020 00:33:54 -0700 Date: Sun, 5 Jul 2020 00:33:54 -0700
Subject: [PATCH] added PlayerNameEntityEvent Subject: [PATCH] Add PlayerNameEntityEvent
diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java
index af072de68435d1678651bdf2fa13b314ca9c9d58..2941c16ef486345b57ab2dfcd26f0272285d3b5a 100644 index af072de68435d1678651bdf2fa13b314ca9c9d58..d12b3fb8b5e28ba4524d163878be978b1b42d019 100644
--- a/src/main/java/net/minecraft/world/item/NameTagItem.java --- a/src/main/java/net/minecraft/world/item/NameTagItem.java
+++ b/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java
@@ -15,9 +15,14 @@ public class NameTagItem extends Item { @@ -15,9 +15,14 @@ public class NameTagItem extends Item {
@ -15,14 +15,14 @@ index af072de68435d1678651bdf2fa13b314ca9c9d58..2941c16ef486345b57ab2dfcd26f0272
- entity.setCustomName(stack.getHoverName()); - entity.setCustomName(stack.getHoverName());
- if (entity instanceof Mob) { - if (entity instanceof Mob) {
- ((Mob)entity).setPersistenceRequired(); - ((Mob)entity).setPersistenceRequired();
+ // Paper start + // Paper start - Add PlayerNameEntityEvent
+ io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true); + io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true);
+ if (!event.callEvent()) return InteractionResult.PASS; + if (!event.callEvent()) return InteractionResult.PASS;
+ LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle(); + LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle();
+ newEntityLiving.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null); + newEntityLiving.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null);
+ if (event.isPersistent() && newEntityLiving instanceof Mob) { + if (event.isPersistent() && newEntityLiving instanceof Mob) {
+ ((Mob) newEntityLiving).setPersistenceRequired(); + ((Mob) newEntityLiving).setPersistenceRequired();
+ // Paper end + // Paper end - Add PlayerNameEntityEvent
} }
stack.shrink(1); stack.shrink(1);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent grindstones from overstacking items
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 811d7415ae843347da374d73b4edfe89642d518a..24187a7ce812cb83a9a736bec8dce9e68ccc0798 100644 index 811d7415ae843347da374d73b4edfe89642d518a..0ebd139f2f51730c190570dc4abb5ff2f2ed2cfa 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@ -20,7 +20,7 @@ index 811d7415ae843347da374d73b4edfe89642d518a..24187a7ce812cb83a9a736bec8dce9e6
} }
- b0 = 2; - b0 = 2;
+ b0 = 2; // Paper - the problem line for above change, causing over-stacking + b0 = 2; // Paper - add max stack size check & config value; the problem line for above change, causing over-stacking
} }
} else { } else {
boolean flag3 = !itemstack.isEmpty(); boolean flag3 = !itemstack.isEmpty();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add recipe to cook events
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c..97b8dc205fb22e17ab457e8d1f4d73a7b2f8cc47 100644 index 5c65be04ac88f1308eae6a8cde36d5f7e8aad879..14406c07dc505525ddcd257ca7e3779c1338eb05 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -438,7 +438,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -438,7 +438,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -13,33 +13,32 @@ index 7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c..97b8dc205fb22e17ab457e8d1f4d73a7
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
- FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result); - FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result);
+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper + FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper - Add recipe to cook events
world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent); world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled()) { if (furnaceSmeltEvent.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index f706c787f7608f7440a5f5e05e7e9c4cb582368c..f776289eea00bd741ad55bb9bc338dd2c05c8b39 100644 index f706c787f7608f7440a5f5e05e7e9c4cb582368c..daeced350310020b99ab0244daf7f7a69c29b069 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -63,8 +63,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -63,7 +63,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> { - ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> {
- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess()); + // Paper start - Add recipe to cook events; re-use recipeHolderOptional below
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world); + Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor(inventorysubcontainer, world);
+ ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> { + ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> {
+ // Paper end + // Paper end - Add recipe to cook events
+ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess()); return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
}).orElse(itemstack); }).orElse(itemstack);
if (itemstack1.isItemEnabled(world.enabledFeatures())) { @@ -72,7 +75,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -72,7 +74,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result); - BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper + BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper - Add recipe to cook events
world.getCraftServer().getPluginManager().callEvent(blockCookEvent); world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
if (blockCookEvent.isCancelled()) { if (blockCookEvent.isCancelled()) {

View File

@ -208,7 +208,7 @@ index 0000000000000000000000000000000000000000..dd9d77d7c7f1a5a130a1f4c15e5b1e68
+ public void setErrorIndex(final int errorIndex) {} + public void setErrorIndex(final int errorIndex) {}
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index b5acccc3339e3e2b817116ecf2af228cb641b175..d0551eb2aae8a26222827fdd7c1b7ee81c8c95b9 100644 index f6da2fcc1709d0942ed8332b4f59c6b4131a0b78..6d3468cc85b8eb7f44994f0c8365cb63e1cede0d 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -222,7 +222,7 @@ index b5acccc3339e3e2b817116ecf2af228cb641b175..d0551eb2aae8a26222827fdd7c1b7ee8
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@@ -206,6 +206,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -206,6 +206,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
// Paper end - convert old users earlier after PlayerList creation but before file load/save // Paper end - fix converting txt to json file
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
+ thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized + thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command

View File

@ -212,21 +212,21 @@ index 71a08510a928d4570822282bb31f14013ec3834a..4aeab90e778629c355189dfe79c39c4b
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index a13a1725356ca4430f1f0a6d121fc08679de62db..bd0165d9ca52665a52fbd9678ed895bf4bed2fe7 100644 index a13a1725356ca4430f1f0a6d121fc08679de62db..7a990fb47f39da00026d3005d5bb11d3abd14026 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -695,6 +695,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @@ -695,6 +695,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
} }
+ // Paper Start - Horse API + // Paper start - Horse API
+ public void setMouthOpen(boolean open) { + public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open); + this.setFlag(FLAG_OPEN_MOUTH, open);
+ } + }
+ public boolean isMouthOpen() { + public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH); + return this.getFlag(FLAG_OPEN_MOUTH);
+ } + }
+ // Paper End - Horse API + // Paper end - Horse API
+ +
@Override @Override
public InteractionResult mobInteract(Player player, InteractionHand hand) { public InteractionResult mobInteract(Player player, InteractionHand hand) {
@ -235,11 +235,11 @@ index a13a1725356ca4430f1f0a6d121fc08679de62db..bd0165d9ca52665a52fbd9678ed895bf
this.setFlag(16, eatingGrass); this.setFlag(16, eatingGrass);
} }
+ // Paper Start - Horse API + // Paper start - Horse API
+ public void setForceStanding(boolean standing) { + public void setForceStanding(boolean standing) {
+ this.setFlag(FLAG_STANDING, standing); + this.setFlag(FLAG_STANDING, standing);
+ } + }
+ // Paper End - Horse API + // Paper end - Horse API
public void setStanding(boolean angry) { public void setStanding(boolean angry) {
if (angry) { if (angry) {
this.setEating(false); this.setEating(false);
@ -511,7 +511,7 @@ index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed603
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..0ccc20157fb9fdb9c99b942dcb4675db5f928b23 100644 index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..42342628227742aa7ee6b84caa0e1f13b498babe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -66,4 +66,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat { @@ -66,4 +66,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
@ -519,7 +519,7 @@ index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..0ccc20157fb9fdb9c99b942dcb4675db
} }
} }
+ +
+ // Paper Start - More cat api + // Paper start - More cat api
+ @Override + @Override
+ public void setLyingDown(boolean lyingDown) { + public void setLyingDown(boolean lyingDown) {
+ this.getHandle().setLying(lyingDown); + this.getHandle().setLying(lyingDown);
@ -539,7 +539,7 @@ index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..0ccc20157fb9fdb9c99b942dcb4675db
+ public boolean isHeadUp() { + public boolean isHeadUp() {
+ return this.getHandle().isRelaxStateOne(); + return this.getHandle().isRelaxStateOne();
+ } + }
+ // Paper End - More cat api + // Paper end - More cat api
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
index 64b75682a936e071353707f7615d6ff512fd617d..96f6e2fd9c6b20d34122abfe5c7fba732502d5a0 100644 index 64b75682a936e071353707f7615d6ff512fd617d..96f6e2fd9c6b20d34122abfe5c7fba732502d5a0 100644
@ -748,7 +748,7 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 1d94e8276b49de47cdd7570774c7bb13f757d966..db846e623bdf8231991d30c88dcf858d66836ca4 100644 index 7ff701f2421ca766cc35580f1c93b24f8c843f10..796412196f26f22b639b82192a3288a81ebd10b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -887,6 +887,22 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -887,6 +887,22 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Add PlayerArmSwingEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b502b3bf5f4f0a820b75434e8f620b3df01e18e2..17cf920cc7bbd662a08b075466b8c534f0493802 100644 index 7e4868e776c95820385d31aaccb9b821f9d62403..bf93470be313017c125e58fdb24a0d6a14e2bb33 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2333,7 +2333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2333,7 +2333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} // Paper end } // Paper end - Call interact event
// Arm swing animation // Arm swing animation
- PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); - PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Stinger API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index db846e623bdf8231991d30c88dcf858d66836ca4..bd5e80a04a035f670160a5eef94805ab90372cf6 100644 index 796412196f26f22b639b82192a3288a81ebd10b4..711f4ca8ee42a14e40af86d93a9685b4b9a2ba99 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -337,7 +337,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -337,7 +337,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
// Paper end // Paper end
} }
+ // Paper Start - Bee Stinger API + // Paper start - Bee Stinger API
+ @Override + @Override
+ public int getBeeStingerCooldown() { + public int getBeeStingerCooldown() {
+ return getHandle().removeStingerTime; + return getHandle().removeStingerTime;
@ -33,7 +33,7 @@ index db846e623bdf8231991d30c88dcf858d66836ca4..bd5e80a04a035f670160a5eef94805ab
+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0"); + Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
+ getHandle().setStingerCount(count); + getHandle().setStingerCount(count);
+ } + }
+ // Paper End - Bee Stinger API + // Paper end - Bee Stinger API
@Override @Override
public void damage(double amount) { public void damage(double amount) {
this.damage(amount, null); this.damage(amount, null);

View File

@ -86,7 +86,7 @@ index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..a3686cede266c0205247abcec3ce082a
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..ced6dc7db823ecabe91d438dbcbd78f5a4bbdcae 100644 index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..3301711afbcf39a5db15d9a7b37bbd95a63dd375 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
@@ -12,12 +12,17 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem @@ -12,12 +12,17 @@ public class CraftSmithingTransformRecipe extends SmithingTransformRecipe implem
@ -97,7 +97,7 @@ index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..ced6dc7db823ecabe91d438dbcbd78f5
+ public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) { + public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, result, template, base, addition, copyNbt); + super(key, result, template, base, addition, copyNbt);
+ } + }
+ // Paper endv + // Paper end - Option to prevent NBT copy
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) { public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
if (recipe instanceof CraftSmithingTransformRecipe) { if (recipe instanceof CraftSmithingTransformRecipe) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Manually inline methods in BlockPosition
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index e5dfc4009cb06e500c6b54ee4228117061758b53..3a9715a81a8551c07ba61850e82b1ccb8a324c80 100644 index 2e5678554313d0e14d2d855a24c71acce1e1a155..0e75ee7dbb601b795cdbf6079992b4dbfc3cd4ce 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -515,9 +515,9 @@ public class BlockPos extends Vec3i { @@ -515,9 +515,9 @@ public class BlockPos extends Vec3i {
@ -15,9 +15,9 @@ index e5dfc4009cb06e500c6b54ee4228117061758b53..3a9715a81a8551c07ba61850e82b1ccb
- this.setX(x); - this.setX(x);
- this.setY(y); - this.setY(y);
- this.setZ(z); - this.setZ(z);
+ this.x = x; // Paper - force inline + this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
+ this.y = y; // Paper - force inline + this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
+ this.z = z; // Paper - force inline + this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
return this; return this;
} }
@ -26,26 +26,26 @@ index e5dfc4009cb06e500c6b54ee4228117061758b53..3a9715a81a8551c07ba61850e82b1ccb
@Override @Override
public BlockPos.MutableBlockPos setX(int i) { public BlockPos.MutableBlockPos setX(int i) {
- super.setX(i); - super.setX(i);
+ this.x = i; // Paper - force line + this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
return this; return this;
} }
@Override @Override
public BlockPos.MutableBlockPos setY(int i) { public BlockPos.MutableBlockPos setY(int i) {
- super.setY(i); - super.setY(i);
+ this.y = i; // Paper - force line + this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
return this; return this;
} }
@Override @Override
public BlockPos.MutableBlockPos setZ(int i) { public BlockPos.MutableBlockPos setZ(int i) {
- super.setZ(i); - super.setZ(i);
+ this.z = i; // Paper - force line + this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
return this; return this;
} }
diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java
index e87ef99260bff134529e00b9a75381cecaec01a4..0f8766ea9dc1893f88c5b1e7d6e2a474100efcbb 100644 index e87ef99260bff134529e00b9a75381cecaec01a4..f14cc137fc0a56495487d64542074b31746b965a 100644
--- a/src/main/java/net/minecraft/core/Vec3i.java --- a/src/main/java/net/minecraft/core/Vec3i.java
+++ b/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java
@@ -19,9 +19,9 @@ public class Vec3i implements Comparable<Vec3i> { @@ -19,9 +19,9 @@ public class Vec3i implements Comparable<Vec3i> {
@ -55,9 +55,9 @@ index e87ef99260bff134529e00b9a75381cecaec01a4..0f8766ea9dc1893f88c5b1e7d6e2a474
- private int x; - private int x;
- private int y; - private int y;
- private int z; - private int z;
+ protected int x; // Paper - force line; protected + protected int x; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int y; // Paper - force line; protected + protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int z; // Paper - force line; protected + protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected
public static Codec<Vec3i> offsetCodec(int maxAbsValue) { public static Codec<Vec3i> offsetCodec(int maxAbsValue) {
return ExtraCodecs.validate(CODEC, (vec) -> { return ExtraCodecs.validate(CODEC, (vec) -> {

View File

@ -13,7 +13,7 @@ Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
index 95f897b9ef73c880aff1cfe35fe490683badfd44..788d8a04398482fdfd0fe89e519b2a6c57410ec3 100644 index 95f897b9ef73c880aff1cfe35fe490683badfd44..1ec8c2d24ec8468d20f322d67143b9454ff266eb 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java --- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl @@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl

View File

@ -2153,19 +2153,19 @@ index 0000000000000000000000000000000000000000..1f42bdfdb052056e62a939ab0d1944f8
+ +
+} +}
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d39f6e9c86 100644 index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9b02ac74f 100644
--- a/src/main/java/net/minecraft/core/Direction.java --- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java
@@ -57,6 +57,21 @@ public enum Direction implements StringRepresentable { @@ -57,6 +57,21 @@ public enum Direction implements StringRepresentable {
private final int adjY; private final int adjY;
private final int adjZ; private final int adjZ;
// Paper end // Paper end - Perf: Inline shift direction fields
+ // Paper start - optimise collisions + // Paper start - optimise collisions
+ private static final int RANDOM_OFFSET = 2017601568; + private static final int RANDOM_OFFSET = 2017601568;
+ private Direction opposite; + private Direction opposite;
+ static { + static {
+ for (final Direction direction : VALUES) { + for (final Direction direction : VALUES) {
+ direction.opposite = from3DDataValue(direction.oppositeIndex);; + direction.opposite = from3DDataValue(direction.oppositeIndex);
+ } + }
+ } + }
+ +
@ -2179,7 +2179,7 @@ index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d3
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id; this.data3d = id;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6571692d00f88947316454e2f10cac30e3756ac0..0492704f7f365310d7ea930c30330a468a39c0de 100644 index f35bd06e3ae16922dfde76abda5b6f938f5b50f7..cb18d1a0ad8c06336d4bfe53b5231fdb9164ae60 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -469,7 +469,7 @@ public class ServerPlayer extends Player { @@ -469,7 +469,7 @@ public class ServerPlayer extends Player {
@ -2201,7 +2201,7 @@ index 6571692d00f88947316454e2f10cac30e3756ac0..0492704f7f365310d7ea930c30330a46
} }
} }
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1bbcae2411205799b00dba7ee82c3ceb461289cf..5921b4c5c38354c4782783d0debddb8bf4e356c7 100644 index 91fa10899f7f10dc056b4668c1f9758a8de09b9b..81303bc614b47fdd6db90ad1fbdaf9fed65b6cf3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -909,7 +909,7 @@ public abstract class PlayerList { @@ -909,7 +909,7 @@ public abstract class PlayerList {
@ -2214,7 +2214,7 @@ index 1bbcae2411205799b00dba7ee82c3ceb461289cf..5921b4c5c38354c4782783d0debddb8b
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
} }
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3086ded2c65b2d623a50401fb0a1612d073da450..5be92231bf62285f29dcf32b2ef65baaf5755804 100644 index 9b9c09f57905d52721e9ab911dbb4df67d235ea7..e19204ff0d29d522ae653805429dc76f628f2ebc 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1217,9 +1217,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1217,9 +1217,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more Campfire API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd89649539cc1012 100644 index daeced350310020b99ab0244daf7f7a69c29b069..6b4ced63bf489a02b1e11ab9b1dd768e2ea0861d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@ -34,7 +34,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd896495
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@@ -171,6 +175,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -172,6 +176,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length)); System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
} }
@ -51,7 +51,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd896495
} }
@Override @Override
@@ -179,6 +193,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -180,6 +194,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true); ContainerHelper.saveAllItems(nbt, this.items, true);
nbt.putIntArray("CookingTimes", this.cookingProgress); nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime); nbt.putIntArray("CookingTotalTimes", this.cookingTime);

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add API for item entity health
public net.minecraft.world.entity.item.ItemEntity health public net.minecraft.world.entity.item.ItemEntity health
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index cbdac5a439795d429a1364a7eafc4783cff51d54..b1bbab951ef9a3d2bd98cc54665ba824263542eb 100644 index 4a15c3786edbfeae3367c0b20fb6aee11d62aea6..cbfd4cf1d7d32757cf124d1aaa4b83d8a155868f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -98,6 +98,21 @@ public class CraftItem extends CraftEntity implements Item { @@ -98,6 +98,21 @@ public class CraftItem extends CraftEntity implements Item {
@ -29,6 +29,6 @@ index cbdac5a439795d429a1364a7eafc4783cff51d54..b1bbab951ef9a3d2bd98cc54665ba824
+ this.getHandle().health = health; + this.getHandle().health = health;
+ } + }
+ } + }
// Paper End // Paper end
@Override @Override

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable height for slime spawn
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 37724831ba9db2d0fb2e7756816e0355bc760815..0ce75b221241b412fe7d8873bdc4a49370b6410b 100644 index a89dec53d68579271d2a259e1a53537262bd0df6..c3dc61f096c0c27c83c34e023994a65dc82706bc 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -336,7 +336,11 @@ public class Slime extends Mob implements Enemy { @@ -336,7 +336,11 @@ public class Slime extends Mob implements Enemy {
@ -29,7 +29,7 @@ index 37724831ba9db2d0fb2e7756816e0355bc760815..0ce75b221241b412fe7d8873bdc4a493
+ // Paper start - Replace rules for Height in Slime Chunks + // Paper start - Replace rules for Height in Slime Chunks
+ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; + final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum;
+ if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { + if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) {
+ // Paper end - Replace rules for Height in Swamp Biome + // Paper end - Replace rules for Height in Slime Chunks
return checkMobSpawnRules(type, world, spawnReason, pos, random); return checkMobSpawnRules(type, world, spawnReason, pos, random);
} }
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a5820d750e88918ef819be0d0896e31b628ab302..e61cb14e9451b242c8324d81b462e80832ef73aa 100644 index f3cb6eac54b245ff6cbe3a1659ac9b7a1b0856a0..276c7dd6af228f404cec7aeb58dad10f2a23a18b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -409,6 +409,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -409,6 +409,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -46,7 +46,7 @@ index a5820d750e88918ef819be0d0896e31b628ab302..e61cb14e9451b242c8324d81b462e808
} catch (Throwable throwable) { } catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d3a1fcd144f513d20fbc9a5688a45fa750f512ae..9561bbe37c57f36edee9f77d69fff363db886b2d 100644 index 95442c5e5abfd916a1b0add6381a8f57b36125e7..13b4a2eae01ee51546e6e5e3c4093e5389971d7d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3452,7 +3452,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3452,7 +3452,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -59,14 +59,14 @@ index d3a1fcd144f513d20fbc9a5688a45fa750f512ae..9561bbe37c57f36edee9f77d69fff363
if (this.isInPowderSnow && this.canFreeze()) { if (this.isInPowderSnow && this.canFreeze()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 47be73dbb0dd1b6cef0113042be6a80cb6209252..1879ec9e275194cb83f30ec47930a3814fbe1da3 100644 index 47be73dbb0dd1b6cef0113042be6a80cb6209252..b7df71633527dce2e4f954caee249e3b31b82226 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -320,6 +320,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -320,6 +320,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.getHandle().isFullyFrozen(); return this.getHandle().isFullyFrozen();
} }
+ // Paper Start - Freeze Tick Lock API + // Paper start - Freeze Tick Lock API
+ @Override + @Override
+ public boolean isFreezeTickingLocked() { + public boolean isFreezeTickingLocked() {
+ return this.entity.freezeLocked; + return this.entity.freezeLocked;

View File

@ -213,7 +213,7 @@ index 73cb7aa01af3eed71b05b1a539f082b26dcd8d60..2783e218d5e5c24787429237974e1967
@Override @Override
public Vector getDirection() { public Vector getDirection() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe2db51720 100644 index c9e15a9d82dee935293b2e7e233f5b9b2d822448..fedbfbac02b73382aacc69f8a1e5a3e746c55ea2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -15,24 +15,26 @@ import org.bukkit.inventory.meta.FireworkMeta; @@ -15,24 +15,26 @@ import org.bukkit.inventory.meta.FireworkMeta;
@ -239,7 +239,7 @@ index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe
- if (this.item.getType() != Material.FIREWORK_ROCKET) { - if (this.item.getType() != Material.FIREWORK_ROCKET) {
- this.item.setType(Material.FIREWORK_ROCKET); - this.item.setType(Material.FIREWORK_ROCKET);
- } - }
+// Paper Start - Expose firework item directly +// Paper start - Expose firework item directly
+// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM); +// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM);
+// +//
+// if (item.isEmpty()) { +// if (item.isEmpty()) {
@ -253,7 +253,7 @@ index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe
+// if (this.item.getType() != Material.FIREWORK_ROCKET) { +// if (this.item.getType() != Material.FIREWORK_ROCKET) {
+// this.item.setType(Material.FIREWORK_ROCKET); +// this.item.setType(Material.FIREWORK_ROCKET);
+// } +// }
+ // Paper End - Expose firework item directly + // Paper end - Expose firework item directly
} }
@Override @Override
@ -509,7 +509,7 @@ index 20f9735c7cb76024e15dbdca7684f5c560876175..8a6af0db8e0aa0cffbf19584be747076
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1894fddf867df210d041307d72118eacde9fe5cb..de35569880efc2267e17c44b5011533fd348c2f3 100644 index 22125565e647f1eb0dd99493b2b33090a8335541..bd453bdcf44f94fea312b58282bb0e8c23ea7189 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -831,19 +831,19 @@ public class CraftEventFactory { @@ -831,19 +831,19 @@ public class CraftEventFactory {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Pass ServerLevel for gamerule callbacks
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 753bec96a829a153dc54b5e1013359b86f1776b3..d721c96b2b76209176f295896bff3bd03c241c4f 100644 index 3fb0d020493db8e5bde9f6fc76637c74b80fd791..0f562a8e0c5d4b2907174c9409977570869bd331 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -304,7 +304,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -304,7 +304,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -18,7 +18,7 @@ index 753bec96a829a153dc54b5e1013359b86f1776b3..d721c96b2b76209176f295896bff3bd0
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5e0466b0522ea325b2c37e3d4c80f3d61c1816fe..5433681fc3765d744193556217169995fbbb3c7d 100644 index 7eba2244e1e92dec7b81dea44b05d5e59887d242..2301445fb77cb8777632d81b60cbc04a42d86533 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -31,7 +31,7 @@ index 5e0466b0522ea325b2c37e3d4c80f3d61c1816fe..5433681fc3765d744193556217169995
} }
break; break;
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c3180a22ec4f 100644 index f3cdf1fa7731eb7bb1cb89aa6a37204d81257cb0..0112ef51815c4fab38b95d5e917d335eeaaa21cd 100644
--- a/src/main/java/net/minecraft/world/level/GameRules.java --- a/src/main/java/net/minecraft/world/level/GameRules.java
+++ b/src/main/java/net/minecraft/world/level/GameRules.java +++ b/src/main/java/net/minecraft/world/level/GameRules.java
@@ -52,7 +52,7 @@ public class GameRules { @@ -52,7 +52,7 @@ public class GameRules {
@ -92,8 +92,8 @@ index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c318
this.callback = changeCallback; this.callback = changeCallback;
@@ -289,10 +289,10 @@ public class GameRules { @@ -289,10 +289,10 @@ public class GameRules {
public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
this.updateFromArgument(context, name, gameRuleKey); // Paper this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
- this.onChanged(((CommandSourceStack) context.getSource()).getServer()); - this.onChanged(((CommandSourceStack) context.getSource()).getServer());
+ this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // Paper - Pass ServerLevel for gamerule callbacks + this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // Paper - Pass ServerLevel for gamerule callbacks
} }
@ -167,22 +167,22 @@ index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c318
this.onChanged(server); this.onChanged(server);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cd7367672b91829d1ffef73e32062af730df7d95..19f91e08664c996b540447a46cc79e89c8e55023 100644 index f41d56da115c14d22d7256be6f16409fdf0e49cd..6b40538ecf9b42473114c3f2acfff5ff0bcf2167 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2038,7 +2038,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2038,7 +2038,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
handle.deserialize(event.getValue()); // Paper handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer()); - handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks + handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true; return true;
} }
@@ -2079,7 +2079,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2079,7 +2079,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
handle.deserialize(event.getValue()); // Paper handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer()); - handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks + handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true; return true;

View File

@ -7,7 +7,7 @@ Also don't fire level events or game events if stalactite
drip is cancelled drip is cancelled
diff --git a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java diff --git a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1b6cfd6eb 100644 index 4c9334dde0734a3550a810845cee53f474e9c96b..50fd3e43b4971cd72efd1f609f0cdc4b0f57bed4 100644
--- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java --- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
+++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java
@@ -80,7 +80,7 @@ public interface CauldronInteraction { @@ -80,7 +80,7 @@ public interface CauldronInteraction {
@ -15,7 +15,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) { if (!world.isClientSide) {
// CraftBukkit start // CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { - if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange + if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
// CraftBukkit end // CraftBukkit end
@ -24,7 +24,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) { if (!world.isClientSide) {
// CraftBukkit start // CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { - if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange + if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
// CraftBukkit end // CraftBukkit end
@ -33,7 +33,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) { if (!world.isClientSide) {
// CraftBukkit start // CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { - if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChange + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
// CraftBukkit end // CraftBukkit end
@ -42,12 +42,12 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) { if (!world.isClientSide) {
// CraftBukkit start // CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) { - if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChange + if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8097f2b62 100644 index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..47b6b83842201620bd6620f5acf11bb14334e35d 100644
--- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java --- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
@@ -43,10 +43,18 @@ public class CauldronBlock extends AbstractCauldronBlock { @@ -43,10 +43,18 @@ public class CauldronBlock extends AbstractCauldronBlock {
@ -55,19 +55,19 @@ index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8
if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) { if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) {
if (precipitation == Biome.Precipitation.RAIN) { if (precipitation == Biome.Precipitation.RAIN) {
- world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); - world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState());
+ // Paper start - Call CauldronLevelChange + // Paper start - Call CauldronLevelChangeEvent
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
+ return; + return;
+ } + }
+ // Paper end - Call CauldronLevelChange + // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
} else if (precipitation == Biome.Precipitation.SNOW) { } else if (precipitation == Biome.Precipitation.SNOW) {
- world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState()); - world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState());
+ // Paper start - Call CauldronLevelChange + // Paper start - Call CauldronLevelChangeEvent
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
+ return; + return;
+ } + }
+ // Paper end - Call CauldronLevelChange + // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
} }
@ -76,25 +76,25 @@ index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8
if (fluid == Fluids.WATER) { if (fluid == Fluids.WATER) {
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState(); iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit - LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled + // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit + if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return; + return;
+ } + }
+ // Paper end - Call CauldronLevelChange + // Paper end - Call CauldronLevelChangeEvent
world.levelEvent(1047, pos, 0); world.levelEvent(1047, pos, 0);
} else if (fluid == Fluids.LAVA) { } else if (fluid == Fluids.LAVA) {
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState(); iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit - LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled + // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit + if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return; + return;
+ } + }
+ // Paper end - Call CauldronLevelChange + // Paper end - Call CauldronLevelChangeEvent
world.levelEvent(1046, pos, 0); world.levelEvent(1046, pos, 0);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1fe6a23d3d 100644 index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..542bc6be48d5c53eee988156e7aa6ecfccb51069 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java --- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -101,7 +101,13 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { @@ -101,7 +101,13 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@ -102,13 +102,13 @@ index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1f
// CraftBukkit start // CraftBukkit start
- public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { - public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
+ // Paper start - Call CauldronLevelChange + // Paper start - Call CauldronLevelChangeEvent
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable + public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable
+ return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true); + return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true);
+ } + }
+ +
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable + public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable
+ // Paper end - Call CauldronLevelChange + // Paper end - Call CauldronLevelChangeEvent
CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition); CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition);
newState.setData(newBlock); newState.setData(newBlock);
@ -117,7 +117,7 @@ index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1f
} }
newState.update(true); newState.update(true);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); - world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock));
+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChange + if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent
return true; return true;
} }
// CraftBukkit end // CraftBukkit end

View File

@ -54,7 +54,7 @@ index fc33d05cf1a3cceb220dab1ee1da33ffe37834db..21a4669b01e9c57100224e20500bc23f
public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) { public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd4defdef4 100644 index a7a3f74b846112d752fe04162b30805961457b11..1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
@@ -33,6 +33,31 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock { @@ -33,6 +33,31 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
@ -93,7 +93,7 @@ index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd
this.setHurtEntities(true); this.setHurtEntities(true);
} }
} }
+ // Paper Start - Expand FallingBlock API + // Paper start - Expand FallingBlock API
+ @Override + @Override
+ public boolean doesAutoExpire() { + public boolean doesAutoExpire() {
+ return this.getHandle().autoExpire; + return this.getHandle().autoExpire;
@ -103,5 +103,5 @@ index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd
+ public void shouldAutoExpire(boolean autoExpires) { + public void shouldAutoExpire(boolean autoExpires) {
+ this.getHandle().autoExpire = autoExpires; + this.getHandle().autoExpire = autoExpires;
+ } + }
+ // Paper End - Expand FallingBlock API + // Paper end - Expand FallingBlock API
} }

View File

@ -2008,13 +2008,13 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index cb2f5d727971c809bcb3eea0db04de4fa91459fb..17f753ac54e73f3644d71c3ef5cbdfb850f5766c 100644 index cd20322f88c2952b451b226c4c5c3f41879d0305..092be422770ceb11446b99f6e2d746d1c9ce4f88 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -223,6 +223,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -223,6 +223,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid; public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper public boolean hasPhysicsEvent = true; // Paper
public boolean hasEntityMoveEvent = false; // Paper public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent
+ private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) + private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
public static Throwable getAddToWorldStackTrace(Entity entity) { public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Custom Chat Completion Suggestions API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8850e7af1bc3668a7bec95ffc8c25053cfb07f21..80856e4dc50bbcc3b210a6599f12a85f64865bba 100644 index 0de707a3400d42249b49e8f1899879d7e361b2a8..fe87c5ad1f206c71088342ca8f3865a0fdbdc2fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -647,6 +647,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -647,6 +647,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end - sendOpLevel API // Paper end - Add sendOpLevel API
+ // Paper start - custom chat completions API + // Paper start - custom chat completions API
+ @Override + @Override

View File

@ -22,14 +22,14 @@ index 42def68f0c682afe7628ff0b9a537e74d77e558c..884343c4ecdecdecb4117ce61d14e057
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 027fa02e855e14b1554ddd141d0a937a64ec99e0..763462e4cf8abdd654b582150fab09f05e64f990 100644 index ee1dc74b2f48bf8d684562de895ab631cf792a30..dab7108644aefe69448b5e361099d97354c8db1a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1124,4 +1124,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1124,4 +1124,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed. return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
} }
// Paper end // Paper end
+ // Paper Start - Collision API + // Paper start - Collision API
+ @Override + @Override
+ public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) { + public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
+ net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ()); + net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ());
@ -43,5 +43,5 @@ index 027fa02e855e14b1554ddd141d0a937a64ec99e0..763462e4cf8abdd654b582150fab09f0
+ +
+ return !this.getHandle().level().noCollision(this.getHandle(), aabb); + return !this.getHandle().level().noCollision(this.getHandle(), aabb);
+ } + }
+ // Paper End - Collision API + // Paper end - Collision API
} }

View File

@ -67,9 +67,6 @@ https://bugs.mojang.com/browse/MC-200092
https://bugs.mojang.com/browse/MC-158900 https://bugs.mojang.com/browse/MC-158900
Fix error when joining after tempban expired Fix error when joining after tempban expired
https://bugs.mojang.com/browse/MC-259571
Fix last gamemode not being saved on death or reload
== AT == == AT ==
public net/minecraft/world/entity/Mob leashInfoTag public net/minecraft/world/entity/Mob leashInfoTag
@ -129,7 +126,7 @@ index 534493aaddced9200e1618d5eabf2b176a1f35b6..a58c47b16254262ec705a8f986ef42c7
return this.anyPlayerCloseEnoughForSpawning(pos, false); return this.anyPlayerCloseEnoughForSpawning(pos, false);
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1089c0ad619784d25b1384db2f09eebb53fa4536..4ffb462f051744d5f7f7b4cf0c49f5d1533d1d53 100644 index 82a71a150c555dd4dfe0ce03a3addba53fda5387..9ef3445aadf98d205a60803f459d07c4ac820ba9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1032,7 +1032,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1032,7 +1032,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -142,7 +139,7 @@ index 1089c0ad619784d25b1384db2f09eebb53fa4536..4ffb462f051744d5f7f7b4cf0c49f5d1
if (!list.isEmpty()) { if (!list.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c03ea45afb5537058cdeecc654184338b9aa0bd8..6251e68eff87a0b26d6123fdb658749e90fcfc42 100644 index d27793e21f9352896a96d5ccfdd0281b0b102a03..6cf989b4827b78d25bcb0ad4b683b6b1569e12dd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -468,14 +468,14 @@ public class ServerPlayer extends Player { @@ -468,14 +468,14 @@ public class ServerPlayer extends Player {
@ -176,7 +173,7 @@ index c14ab35c4336c025c242e8a350ac4b8d1b1d5c78..15f6bd2e61c02392e8383dc93d734990
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList(); this.level.updateSleepingPlayerList();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6e47d01db9e7f8519e560681922a0f15980d6acc..cd0f6f3c1cf2a4004e238d0e23104209d6384c4e 100644 index 92b88e82e9a49a0e967a7e694f1d2f4ade8adbf1..fbf388fe93383daf5e87e54a8a413a2239bfdc69 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -711,8 +711,10 @@ public abstract class PlayerList { @@ -711,8 +711,10 @@ public abstract class PlayerList {
@ -301,7 +298,7 @@ index 110dd5418b0512a2f27f0c4d5a5f1812356a6a12..5d247ac38fe8a61603b3d934f3000bcd
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index bd0165d9ca52665a52fbd9678ed895bf4bed2fe7..8fe5a4ccf474c094b8081828c93e8973cdabb6ed 100644 index 7a990fb47f39da00026d3005d5bb11d3abd14026..ea5fffa7e045d854ce9522f00246e3746f40f028 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -252,7 +252,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @@ -252,7 +252,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@ -375,11 +372,11 @@ index 4a0f4c83228187a2082ad029680056b1801f77bd..31831811ce16265e9828fa34d9e67d8a
player.awardStat(Stats.RAID_TRIGGER); player.awardStat(Stats.RAID_TRIGGER);
CriteriaTriggers.BAD_OMEN.trigger(player); CriteriaTriggers.BAD_OMEN.trigger(player);
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index 685c35419de7e3c4e854a28118a243e65250ef59..0b1a0be964d799f1706c273092dc653fa04e8014 100644 index 611cbe0e47474f94cd203ac86ca9e80cab621134..de919d72e6e3ef160c7d22ca6a4e9f79a1fe493e 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -178,6 +178,11 @@ public class BeaconMenu extends AbstractContainerMenu { @@ -178,6 +178,11 @@ public class BeaconMenu extends AbstractContainerMenu {
// Paper end // Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) { public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
+ // Paper start - fix MC-174630 - validate secondary power + // Paper start - fix MC-174630 - validate secondary power
@ -388,7 +385,7 @@ index 685c35419de7e3c4e854a28118a243e65250ef59..0b1a0be964d799f1706c273092dc653f
+ } + }
+ // Paper end + // Paper end
if (this.paymentSlot.hasItem()) { if (this.paymentSlot.hasItem()) {
// Paper start // Paper start - Add PlayerChangeBeaconEffectEvent
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java
index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449558d42f8 100644 index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449558d42f8 100644
@ -442,7 +439,7 @@ index 6e45582f8ea7dd2a46f58369c5581764538bff0d..3ecc92439fc85d224ff52f41c5e34079
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 5199ad9ca36ccd18eb2ff191feaf4331404049d2..f41ffeb9062b661c2b8cf09c0d6848550591eaa7 100644 index 333cc37e4f3ca3ea95191dcaafda6be59ef79b96..91071fa934222c9246547c788e3e6cb18fcaa990 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java --- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -68,7 +68,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { @@ -68,7 +68,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@ -455,7 +452,7 @@ index 5199ad9ca36ccd18eb2ff191feaf4331404049d2..f41ffeb9062b661c2b8cf09c0d684855
return; return;
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index b7760cc0f85b5db37d5a309aae3c26a00a65e32e..d493136283ae5100c0dc22f8da5f7e5b64fdc5f5 100644 index 0813e7510c43ed6916e83635f2be6d39ce2feb5b..137ee0271f1d7adbf3c463b96e9c4627fd5ca74b 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -675,13 +675,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -675,13 +675,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Entity Body Yaw API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 75d24e0d9f3c84f436d967415ee469e5969d3368..e7f967e8f88e6fc5bcfdc033d14bb2b65dda3e67 100644 index 35b6aa33b7715032686acdfd8e5b07d63729593b..e1a3d047743befa9fbc26e7491cb982df19b2f0c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1139,6 +1139,31 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1139,6 +1139,31 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -38,10 +38,10 @@ index 75d24e0d9f3c84f436d967415ee469e5969d3368..e7f967e8f88e6fc5bcfdc033d14bb2b6
+ return this.entity.getBukkitYaw(); + return this.entity.getBukkitYaw();
+ } + }
// Paper end // Paper end
// Paper Start - Collision API // Paper start - Collision API
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 45ebd9ffc37163e3a11c80c15b41c5aeed2b6983..33e977f87e06c4f022b913006c20ac53eb28f172 100644 index 97c7bb2032584847f2f8a946c1f8d13fef908edf..310ce32708601d95cda2647e101d02d48ccdbb77 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1075,6 +1075,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -1075,6 +1075,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..5c42823726e70ce6c9d0121d07431548
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bb8381c51bc6b37111b837710da7e1ccbca6df5d..5868f13fa3a3791704ba8e344b9c51d88786f41b 100644 index 44ca57d91c64a062c379de38c2a5af2d6fae1af3..e9ec17c4dfb44f6f562dedd20d123064492ef736 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1672,6 +1672,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1672,6 +1672,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -58,7 +58,7 @@ index bb8381c51bc6b37111b837710da7e1ccbca6df5d..5868f13fa3a3791704ba8e344b9c51d8
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
this.profiler.push(() -> { this.profiler.push(() -> {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Make Amethyst throw both Spread and Grow Events
diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
index 79f1fb45447350b5bedee8ce3efe6c150aa9772c..617c35f8e2877be193693548b5af17c50d013e47 100644 index 79f1fb45447350b5bedee8ce3efe6c150aa9772c..7f58c9f5935cd14ea1096de14633f653eb486d7e 100644
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java --- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -45,7 +45,13 @@ public class BuddingAmethystBlock extends AmethystBlock { @@ -45,7 +45,13 @@ public class BuddingAmethystBlock extends AmethystBlock {
if (block != null) { if (block != null) {
BlockState iblockdata2 = (BlockState) ((BlockState) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER); BlockState iblockdata2 = (BlockState) ((BlockState) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER);
+ // Paper Start - Have Amethyst throw both spread and grow events + // Paper start - Have Amethyst throw both spread and grow events
+ if (block == Blocks.SMALL_AMETHYST_BUD) { + if (block == Blocks.SMALL_AMETHYST_BUD) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit
+ } else { + } else {

View File

@ -7,13 +7,13 @@ Was obtainable through different methods, but you had to use different
methods depending on the implementation of Entity you were working with. methods depending on the implementation of Entity you were working with.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index e20aa42c570185566577e6b72547e416ac23240d..875f6380a03f030a45f63dbb3e1a2a3bbcbb9b6f 100644 index a7ae0e0c69a4b78bcef746763a208897f7678a94..7abc465b815ed645e84fa6fdd8eda7f4ba87b104 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1195,4 +1195,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1195,4 +1195,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !this.getHandle().level().noCollision(this.getHandle(), aabb); return !this.getHandle().level().noCollision(this.getHandle(), aabb);
} }
// Paper End - Collision API // Paper end - Collision API
+ +
+ // Paper start - entity scoreboard name + // Paper start - entity scoreboard name
+ @Override + @Override

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone unhandled nbt tags
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..baf31c109ee8b5e59acd7ff5fc537ea46f27d164 100644 index b7c0c9a40dac3e828f880ef928ca34206a898cb9..678cebb12e290a9a3967177d97a67bebb9116104 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -13,7 +13,7 @@ index b7c0c9a40dac3e828f880ef928ca34206a898cb9..baf31c109ee8b5e59acd7ff5fc537ea4
private CompoundTag internalTag; private CompoundTag internalTag;
- final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper - final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper // Paper - Deep clone unhandled nbt tags; remove final + Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper & Deep clone unhandled nbt tags; remove final
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY); private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only

View File

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items - Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2344efd039773a0b3052d6e08ba204b1efe8963c..712708f62fadb6698c4231f38deeb39bed91e529 100644 index ffb87573b1c5df4e6f4d36d0331738da221e0f38..947190e48a05f1212c85a507e52a7f56618efaf6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -28,9 +28,9 @@ index 2344efd039773a0b3052d6e08ba204b1efe8963c..712708f62fadb6698c4231f38deeb39b
+ worldserver.updateLagCompensationTick(); // Paper - lag compensation + worldserver.updateLagCompensationTick(); // Paper - lag compensation
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index df40ffecfa6d34aa3cdffbbec03e049a271364ab..048bcbd730ee87cf2f040bda1080ae1f6e4ef414 100644 index f66857ee0cdb3b110a0c3afedbc1c70bb3357a81..24145582ceb89406deb3d7fc3dfbe473c3d85229 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -65,7 +65,7 @@ index 27d22a6aef3f71179ea102062f1338cce5d46fea..52aadf7336c1486ccf0d192e27b742f9
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e9839d0dc8339ce62a6eb01c7094a2a3cf0fa816..f9de831797bff3707115f03c24bdca78889003a3 100644 index 768f1cb6b9a5f234be02f07a7ba84156e629fa03..5b2169737f831ba57ce7925cbe9a82c3cd712974 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable {