Archiviert
13
0

[ci skip] Add more identifying patch comments

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-19 22:13:42 +01:00
Ursprung 1c956abfbc
Commit 42e88a8b7b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
87 geänderte Dateien mit 405 neuen und 411 gelöschten Zeilen

Datei anzeigen

@ -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
index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..ab06c640cef1309ab44b0fae8d95df48cdc869a7 100644
index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..bfecd0633458586c0352eeb1a95bb57b12f9101e 100644
--- a/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 {
@ -13,7 +13,7 @@ index 65dd4554c6cc0801fcbc0ef6809b794dcebd1124..ab06c640cef1309ab44b0fae8d95df48
@Nullable
public UUID getThrower();
+
+ // Paper Start
+ // Paper start
+ /**
+ * Gets if non-player entities can pick this Item up
+ *

Datei anzeigen

@ -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
index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac018185cd38 100644
index 951ea2cc763973655beedcba3c75332d3f297313..26383597cb0bdcf81035b571998332090b785730 100644
--- a/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;
@ -20,7 +20,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01
return remaining;
}
+ // Paper Start
+ // Paper start
+ /**
+ * Set if the item will fly at the player
+ * <p>Cancelling the event will set this value to false.</p>
@ -39,7 +39,7 @@ index 951ea2cc763973655beedcba3c75332d3f297313..18d82c111f30e0279c10a174a51bac01
+ public boolean getFlyAtPlayer() {
+ return flyAtPlayer;
+ }
+ // Paper End
+ // Paper end
+
@Override
public boolean isCancelled() {

Datei anzeigen

@ -18,7 +18,7 @@ Y range: [0, 1023]
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
index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d7d05f938 100644
index 41125de49db8eafce4be59cc110ce5be06836a47..042d69e6d4584eb6d678b8ea13a3e4bea78703b8 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable;
@ -34,7 +34,7 @@ index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d
return blockLoc;
}
+
+ // Paper Start
+ // Paper start
+ /**
+ * @return The block key for this location's block location.
+ * @see Block#getBlockKey(int, int, int)
@ -44,13 +44,13 @@ index 41125de49db8eafce4be59cc110ce5be06836a47..34eeed3ec165bee9d9172ea636b1cc2d
+ public long toBlockKey() {
+ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ());
+ }
+ // Paper End
+ // Paper end
+
/**
* @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
index be0e1ad34c526f2bd7b80f035c79b07e3b3ef5fb..55c0ad31ae8f1831c43404abb7e2e62da63885ce 100644
index f15e1a6a43c0353ac4834f74fffb9adc2049dfcb..d5ebfdefe015e5509f0ecf53accfee2afbd4aadd 100644
--- a/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
@ -96,14 +96,14 @@ index be0e1ad34c526f2bd7b80f035c79b07e3b3ef5fb..55c0ad31ae8f1831c43404abb7e2e62d
* 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
index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..78f6cc1a8a8de05aec6f551f8a5f425944f0ffa3 100644
index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..f3a18e337a579b602b1289bccdf454334a663fcf 100644
--- a/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 {
*/
int getZ();
+ // Paper Start
+ // Paper start
+ /**
+ * Returns this block's coordinates packed into a long value.
+ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())}
@ -177,7 +177,7 @@ index 9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd..78f6cc1a8a8de05aec6f551f8a5f4259
+ public static int getBlockKeyZ(long packed) {
+ return (int) ((packed << 10) >> 37);
+ }
+ // Paper End
+ // Paper end
+
/**
* Gets the Location of the block

Datei anzeigen

@ -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
index 3fd364e5875f95296e75dede4c610d3dd3e0038e..6de4c858ff6e542daa0879092e4f99a948225964 100644
index 689170a273ce68cf6fbd4659f3e08577c100535f..987dfdc9b09299e5ef3ae1fea2882ae56f8da38e 100644
--- a/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
@ -21,6 +21,6 @@ index 3fd364e5875f95296e75dede4c610d3dd3e0038e..6de4c858ff6e542daa0879092e4f99a9
+ * @return whether the block will drop items
+ */
+ boolean isValidTool(@NotNull ItemStack itemStack);
// Paper End
// Paper end
/**

Datei anzeigen

@ -310,7 +310,7 @@ index adb20a9abba33c32d553f620fa82b27dff64ab5f..1f6702b0de00b87dbed7f6d93e911655
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238194d5918 100644
index d1327761a4b95eba97877f1991fc19b298b48eaf..0534fbc228f64cf3b361ab097d9b88212bdb0f36 100644
--- a/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 {
@ -318,7 +318,7 @@ index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238
}
}
+
+ // Paper Start - More cat api
+ // Paper start - More cat api
+ /**
+ * Sets if the cat is lying down.
+ * This is visual and does not affect the behaviour of the cat.
@ -348,7 +348,7 @@ index d1327761a4b95eba97877f1991fc19b298b48eaf..9bc385682472418c787481bbc809f238
+ * @return head is up
+ */
+ 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
index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79af8c040a7 100644

Datei anzeigen

@ -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
index adf2870ab81b6ff8f595e11b55f043c4fd51281e..3be060731b9b2df3408e8c5627a3640262cdc4d5 100644
index adf2870ab81b6ff8f595e11b55f043c4fd51281e..2976955607f9cbb9b552aa43f25b5b9d52f7437e 100644
--- a/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
*/
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.
+ *
@ -40,7 +40,7 @@ index adf2870ab81b6ff8f595e11b55f043c4fd51281e..3be060731b9b2df3408e8c5627a36402
+ * @param count amount of bee stingers in entity's body
+ */
+ public void setBeeStingersInBody(int count);
+ // Paper End - Stinger API
+ // Paper end - Stinger API
+
/**
* Returns the living entity's current maximum no damage ticks.

Datei anzeigen

@ -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
index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..953bb49b7079647450d3453356d1c8a91be94c01 100644
index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..f090368dbb5acf352e1bee34d78b55eb92373c6d 100644
--- a/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
*/
boolean isFrozen();
+ // Paper Start - Freeze Tick Lock API
+ // Paper start - Freeze Tick Lock API
+ /**
+ * Gets if the entity currently has its freeze ticks locked
+ * to a set amount.
@ -30,7 +30,7 @@ index 6456f7bfc8aa8cb5c9aaf0c06f9130242003ee3e..953bb49b7079647450d3453356d1c8a9
+ * @param locked prevent vanilla modification or not
+ */
+ void lockFreezeTicks(boolean locked);
+ // Paper End - Freeze Tick Lock API
+ // Paper end - Freeze Tick Lock API
+
/**
* Mark the entity's removal.

Datei anzeigen

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

Datei anzeigen

@ -25,7 +25,7 @@ index 44ee56a5956cc17194c767a0c1071a2abffe818a..43dd6c59cceba12f27e6b265acc3ad97
// Paper end
}
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
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -971,4 +971,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@ -33,7 +33,7 @@ index 2ea66188468cf32bcaedc5167d4b9b0c6ea9b0b3..351a7d0aeab5d83564dd543935ba503e
boolean isInPowderedSnow();
// Paper end
+
+ // Paper Start - Collision API
+ // Paper start - Collision API
+ /**
+ * 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.
@ -53,5 +53,5 @@ index 2ea66188468cf32bcaedc5167d4b9b0c6ea9b0b3..351a7d0aeab5d83564dd543935ba503e
+ * @return collides or not
+ */
+ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
+ // Paper End - Collision API
+ // Paper end - Collision API
}

Datei anzeigen

@ -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
index c9139bb7abc881fddd2d5610d9506cd4fce7eba3..bb1ed1e16bd17161bbf554acc03d1e32d3627a80 100644
index e5df511d962a59260207e8390d7da7782af5dc77..90c46483928e70f37a9900cada7dc67957a031d0 100644
--- a/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
@ -51,9 +51,9 @@ index c9139bb7abc881fddd2d5610d9506cd4fce7eba3..bb1ed1e16bd17161bbf554acc03d1e32
+ float getYaw();
// 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
index b6df5fd8eda6a30c119b3fa3844e6bb0425e2f39..0b4cd106265c6c675bd27cd66a275a48217a7419 100644
index c1b7f021cd268a0d6da0f2759469b88fae638648..7f185102ba3a417670313e75ee174a1024a1d514 100644
--- a/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

Datei anzeigen

@ -769,13 +769,13 @@ index 75f2b46c4fc1e12d1d02cd60865a5b76b1c2de49..f8f0a2b7fdd51c739c3f55801037a417
+ // 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
index bb1ed1e16bd17161bbf554acc03d1e32d3627a80..b2f5be3227d5dad5b1ff0129930dcd1944c75cef 100644
index 90c46483928e70f37a9900cada7dc67957a031d0..3bf0c76ef830fa54d7695711cd7903dc64c619b1 100644
--- a/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
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API
// Paper end - Collision API
+
+ // Paper start - Folia schedulers
+ /**

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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
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
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -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));
+ // Paper End
+ // Paper end
// Spigot End
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system

Datei anzeigen

@ -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
index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fbcf5ddb655e6d070f24d71bd076115739cf0254 100644
index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fa0e96fd884a0338b44f68506b1d3ee6c42f17b1 100644
--- a/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 {
ItemEntity entityitem = (ItemEntity) iterator.next();
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
+ // Paper Start
+ // Paper start
+ if (!entityitem.canMobPickup) {
+ continue;
+ }
+ // Paper End
+ // Paper end
this.pickUpItem(entityitem);
}
}
@ -33,14 +33,14 @@ index 5bb26ca5c81635d27ca59352d5184d8b4300e0b5..6905090f030c86f640e841e94c32ad90
public ItemEntity(EntityType<? extends ItemEntity> type, Level 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
index fb3738f4c558796f41e3327dd41b8aec68007a8a..4456b7c438cadb4bfabad030b6871b3a8a7fd439 100644
index fb3738f4c558796f41e3327dd41b8aec68007a8a..5620a0849fda49313c68edfd747fedd09641a3d5 100644
--- a/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 {
}
}
+ // Paper Start
+ // Paper start
+ @Override
+ public boolean canMobPickup() {
+ return this.getHandle().canMobPickup;
@ -50,7 +50,7 @@ index fb3738f4c558796f41e3327dd41b8aec68007a8a..4456b7c438cadb4bfabad030b6871b3a
+ public void setCanMobPickup(boolean canMobPickup) {
+ this.getHandle().canMobPickup = canMobPickup;
+ }
+ // Paper End
+ // Paper end
+
@Override
public void setOwner(UUID uuid) {

Datei anzeigen

@ -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
index 6905090f030c86f640e841e94c32ad90acb75d2a..6847d100a6fe2b57d7986b121f5ce0f981cfa415 100644
index 6905090f030c86f640e841e94c32ad90acb75d2a..afb01096f41ed76e431848466d02aaefdc0c69c7 100644
--- a/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 {
@ -23,11 +23,11 @@ index 6905090f030c86f640e841e94c32ad90acb75d2a..6847d100a6fe2b57d7986b121f5ce0f9
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
if (playerEvent.isCancelled()) {
itemstack.setCount(i); // SPIGOT-5294 - restore count
+ // Paper Start
+ // Paper start
+ if (flyAtPlayer) {
+ player.take(this, i);
+ }
+ // Paper End
+ // Paper end
return;
}

Datei anzeigen

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

Datei anzeigen

@ -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.
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
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -43,7 +43,7 @@ index 910b9a2918ec58ecb9fff77cca36abb48c7db7dd..cf81671a32874d89588a829e6ad6696e
-
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
- 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
+ long currentTime = Util.getMillis();
+ long elapsedTime = currentTime - this.keepAliveTime;

Datei anzeigen

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

Datei anzeigen

@ -141,7 +141,7 @@ index 2a7f17726a161ddbcd0397fb4332de6980199c38..72dacdc271325c814fb43cd6daaf3a20
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
index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..c46320794e9673d7ff24aae5e9086cc90988791c 100644
index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..2ab7060f5c9a54bc7beb819f381a202c977f0a80 100644
--- a/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 {
@ -211,7 +211,7 @@ index 465ad0bae446a20e941e8f2dbf2d85f2627482b9..c46320794e9673d7ff24aae5e9086cc9
+ }
+ }
+
+ // Paper End
+ // Paper end
+
@Nullable
public CompoundTag read(ChunkPos pos) throws IOException {

Datei anzeigen

@ -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
index 4456b7c438cadb4bfabad030b6871b3a8a7fd439..cbdac5a439795d429a1364a7eafc4783cff51d54 100644
index 5620a0849fda49313c68edfd747fedd09641a3d5..4a15c3786edbfeae3367c0b20fb6aee11d62aea6 100644
--- a/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;
@ -44,6 +44,6 @@ index 4456b7c438cadb4bfabad030b6871b3a8a7fd439..cbdac5a439795d429a1364a7eafc4783
+ public void setWillAge(boolean willAge) {
+ this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
+ }
// Paper End
// Paper end
@Override

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com>
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

Datei anzeigen

@ -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
index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c 100644
index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..5c65be04ac88f1308eae6a8cde36d5f7e8aad879 100644
--- a/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
@ -18,7 +18,7 @@ index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e
+ if(cachedBurnDurations != null) {
+ return cachedBurnDurations;
+ }
+ // Paper end
+ // Paper end - cache burn durations
Map<Item, Integer> map = Maps.newLinkedHashMap();
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
@ -30,7 +30,7 @@ index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..7bcc4ede30f9cd1af2b0560bd3eca18e
+ // Paper start - cache burn durations
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
+ return cachedBurnDurations;
+ // Paper end
+ // Paper end - cache burn durations
}
// CraftBukkit start - add fields and methods

Datei anzeigen

@ -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
index 8176b64e49166cc24ef7f011881fda38bc68c2a4..4f10f801dc126e9135432939b6663770c0e7a0bc 100644
index 8176b64e49166cc24ef7f011881fda38bc68c2a4..3bfbf7daa190b03f978b9fc72233c18c383b6659 100644
--- a/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 {
EntityType entitytypes;
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;

Datei anzeigen

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
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
index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9f73cef00 100644
index c450faf8c043665eab020141f3c27e3d9890cb86..8684b28a0aa4ec9b2a7f15d07410264cf030a19c 100644
--- a/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 {
boolean bl = blockState.is(Blocks.AIR);
boolean bl2 = this.isEmpty();
if (bl != bl2) {
+ // Paper start
+ // Paper start - Add PlayerFlowerPotManipulateEvent
+ org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity();
+ boolean placing = bl2;
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
@ -30,7 +30,7 @@ index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9
+
+ return InteractionResult.PASS;
+ }
+ // Paper end
+ // Paper end - Add PlayerFlowerPotManipulateEvent
if (bl2) {
world.setBlock(pos, blockState, 3);
player.awardStat(Stats.POT_FLOWER);

Datei anzeigen

@ -11,7 +11,7 @@ Subject: [PATCH] Fix interact event not being called sometimes
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
index 3683e3b56da96e5528d63319892b5ec76075d86c..48815e94a0eacbdd03ea8630ae4a53f1a4747520 100644
index 3683e3b56da96e5528d63319892b5ec76075d86c..046ee4ce24248d1b24ee4e731324f6d1d600da7e 100644
--- a/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
@ -19,7 +19,7 @@ index 3683e3b56da96e5528d63319892b5ec76075d86c..48815e94a0eacbdd03ea8630ae4a53f1
this.player.sendSystemMessage(ichatmutablecomponent, true);
- } 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);
}
}
@ -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-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.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();
return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player);
});
if (result == null) {
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();
+ 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);
+ } 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);
+ }
+ } // Paper end
+ } // Paper end - Call interact event
// Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

Datei anzeigen

@ -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
index fa014c04cc51a55345a1c50098f486161051741d..37724831ba9db2d0fb2e7756816e0355bc760815 100644
index fa014c04cc51a55345a1c50098f486161051741d..a89dec53d68579271d2a259e1a53537262bd0df6 100644
--- a/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 {
entityslime.setPersistenceRequired();
}
+ entityslime.aware = this.aware; // Paper
+ entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting
entityslime.setCustomName(ichatbasecomponent);
entityslime.setNoAi(flag);
entityslime.setInvulnerable(this.isInvulnerable());

Datei anzeigen

@ -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
index ba570f1c9654e1004e068a1efe2118f36c954505..eede02c3f125d230af537bb67bebed9b88f7d1b4 100644
index ba570f1c9654e1004e068a1efe2118f36c954505..06689ee8799079510a1a4e7b68029b9629e318fb 100644
--- a/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 {
@ -13,14 +13,14 @@ index ba570f1c9654e1004e068a1efe2118f36c954505..eede02c3f125d230af537bb67bebed9b
float f = CrossbowItem.getPowerForTime(j, 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)*/) {
+ 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 (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
+ return;
+ }
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
CrossbowItem.setCharged(stack, true);
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) {
+ // Paper start
+ // Paper start - Add EntityLoadCrossbowEvent
+ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
+ }
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow);
int j = i == 0 ? 1 : 3;
- 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 itemstack2 = itemstack1.copy();

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index c8c358531dbc167e249bac2af246c5e34fbdd4df..307854468ac985560b4c63b6e9897c444a7b8a3a 100644
index c8c358531dbc167e249bac2af246c5e34fbdd4df..10c1790226e25da3b9b599c9a40de57d5727ddc4 100644
--- a/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 {
@ -13,12 +13,12 @@ index c8c358531dbc167e249bac2af246c5e34fbdd4df..307854468ac985560b4c63b6e9897c44
T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
- t0.setFromArgument(context, "value");
+ t0.setFromArgument(context, "value", key); // Paper
+ t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent
commandlistenerwrapper.sendSuccess(() -> {
return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
}, true);
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
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
@@ -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, 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) {
- this.updateFromArgument(context, name);
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper
+ this.updateFromArgument(context, name, gameRuleKey); // Paper
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
+ this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
this.onChanged(((CommandSourceStack) context.getSource()).getServer());
}
@ -41,11 +41,11 @@ index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c
@Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String 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)));
+ if (!event.callEvent()) return;
+ this.value = Boolean.parseBoolean(event.getValue());
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
}
public boolean get() {
@ -55,30 +55,30 @@ index 334001cb749600c973c82391e1c11f0e40bd2dfb..2a480026c3bfb06e6556fe5b11d9712c
@Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String 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)));
+ if (!event.callEvent()) return;
+ this.value = Integer.parseInt(event.getValue());
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
}
public int get() {
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
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1930,8 +1930,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!this.isGameRule(rule)) return false;
+ // Paper start
+ // Paper start - Add WorldGameRuleChangeEvent
+ GameRule<?> gameRule = GameRule.getByName(rule);
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value);
+ if (!event.callEvent()) return false;
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
- handle.deserialize(value);
+ handle.deserialize(event.getValue()); // Paper
+ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer());
return true;
}
@ -86,13 +86,13 @@ index 6a6bdc23767d4b0413352eda860f3fd3076f492e..b70239ff42f5c7f4754bae311385e480
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));
+ if (!event.callEvent()) return false;
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
- handle.deserialize(newValue.toString());
+ handle.deserialize(event.getValue()); // Paper
+ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer());
return true;
}

Datei anzeigen

@ -1,24 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index 6a23b1ad4c7fd9deaff05e8d00ad6a77a6ed0cec..a75c6825eaee07bbde9b7c81c4232bc982a98326 100644
index c0546f796cac661684e3fe394d93f1a7d2a55a74..8d3b3524a939d483aa4d451a8ca0fed3a9c87d26 100644
--- a/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
return this.functionManager;
}
+ // Paper start - add cause
+ // Paper start - Add ServerResourcesReloadedEvent
+ @Deprecated @io.papermc.paper.annotation.DoNotUse
public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) {
+ 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) {
+ // Paper end
+ // Paper end - Add ServerResourcesReloadedEvent
RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error
@ -26,12 +26,12 @@ index 6a23b1ad4c7fd9deaff05e8d00ad6a77a6ed0cec..a75c6825eaee07bbde9b7c81c4232bc9
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
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
+ 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);
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
index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3fc82d054 100644
index fa18d018a8458b30c0048f7e59aea39f928d974a..c020c86194723a5c89816f91e0b7c5eeaf132b7e 100644
--- a/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 {
@ -39,7 +39,7 @@ index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3
public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) {
- 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);
source.sendFailure(Component.translatable("commands.reload.failure"));
return null;
@ -48,7 +48,7 @@ index fa18d018a8458b30c0048f7e59aea39f928d974a..87d32af973b84fbbea5dcdb34273f3b3
Collection<String> collection = resourcepackrepository.getSelectedIds();
Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection);
- 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

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index dadb419a04b343d6ba59353c6caa1a50aa07b67f..6be9e8d693bbb084791d7b30a1891ddb803d6b02 100644
index dadb419a04b343d6ba59353c6caa1a50aa07b67f..117d466e1b4f545f6fd5006c3822c5586db96032 100644
--- a/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
@ -13,12 +13,12 @@ index dadb419a04b343d6ba59353c6caa1a50aa07b67f..6be9e8d693bbb084791d7b30a1891ddb
this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
this.reassessWeaponGoal();
- 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()) {
LocalDate localdate = LocalDate.now();
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
index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..8d66d90973931575a6c071965d582da6a9d30b10 100644
index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..c635ca601a4f4a3c0684ab3b6c3a568c6b5515f7 100644
--- a/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 {
@ -26,7 +26,7 @@ index c82730d52f2ec6cb4a5e17fa512be6497f3ab6dc..8d66d90973931575a6c071965d582da6
float f = difficulty.getSpecialMultiplier();
- 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) {
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
}

Datei anzeigen

@ -1,33 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
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
index d77ca08832105e82cee265eea222e0d64a8876ef..21c37ad365e09a296c3e7a2d0cde7a29ced09c33 100644
index d77ca08832105e82cee265eea222e0d64a8876ef..5593a0aa9e618071b6521b213dde0f628348c3dc 100644
--- a/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 {
int i = tileentitydispenser.getRandomSlot(world.random);
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.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper
+ } // Paper - Add BlockFailedDispenseEvent
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
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
index 913ed110d8402d377152753325901eb7f3ac82d6..675644974ae6fb5380a6496a2ac3ec4d1ef7c924 100644
index 913ed110d8402d377152753325901eb7f3ac82d6..1d13f8a1009d6eda351c697052d499d594a6aaa8 100644
--- a/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 {
int i = tileentitydispenser.getRandomSlot(world.random);
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);
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);

Datei anzeigen

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..84795cd53720a618360644702b22abe8d015dadc 100644
index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..ccba06c419732c63f6b255f5f8c1f7a95f3ecbee 100644
--- a/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 {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
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) {
j = id - 100;
@ -21,26 +21,26 @@ index 19858ecd7cfaaf0fb09552292bf573bb02b3a6ec..84795cd53720a618360644702b22abe8
case 1:
j = this.lecternData.get(0);
- this.setData(0, j - 1);
+ // Paper start
+ // Paper start - Add PlayerLecternPageChangeEvent
+ 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);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
+ // Paper end - Add PlayerLecternPageChangeEvent
return true;
case 2:
j = this.lecternData.get(0);
- this.setData(0, j + 1);
+ // Paper start
+ // Paper start - Add PlayerLecternPageChangeEvent
+ 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);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
+ // Paper end - Add PlayerLecternPageChangeEvent
return true;
case 3:
if (!player.mayBuild()) {

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f978017931 100644
index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..aee37b2fc205cef98d2ff0f42e9cba0a6de6bf45 100644
--- a/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 {
@ -14,7 +14,7 @@ index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f9
if (id >= 0 && id < this.selectablePatterns.size()) {
- this.selectedBannerPatternIndex.set(id);
- this.setupResultSlot((Holder) this.selectablePatterns.get(id));
+ // Paper start
+ // Paper start - Add PlayerLoomPatternSelectEvent
+ 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()));
+ if (!event.callEvent()) {
@ -42,7 +42,7 @@ index 757ee83a0ec5d381eb328f31f3bef636a9b72d57..e28c1cdf4763e9db3e29b3c0f08d65f9
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedBannerPatternIndex.set(selectablePatternIndex);
+ this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected"));
+ // Paper end
+ // Paper end - Add PlayerLoomPatternSelectEvent
return true;
} else {
return false;

Datei anzeigen

@ -10,7 +10,7 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE
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
index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..ad41bbbf5395ed18c2c9e1e692c7661a6e0cb98c 100644
index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..a6af5ac9d09834940d3dd4c80b16450b90484edb 100644
--- a/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 {
@ -18,12 +18,12 @@ index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..ad41bbbf5395ed18c2c9e1e692c7661a
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {
- 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));
}
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
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -100,7 +100,7 @@ public class Zombie extends Monster {
@ -31,7 +31,7 @@ index 8d66d90973931575a6c071965d582da6a9d30b10..b31f6b267693c409d58eee688a3b79a1
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);
- 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) {

Datei anzeigen

@ -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
index 902f3a7ae5ba9c15b634bb2f214be7d85c6d5a00..efbdcaff160e1c8e666d54a9babe35ac325ec8a5 100644
index 902f3a7ae5ba9c15b634bb2f214be7d85c6d5a00..7b76cba12680d7a8720c597b3a98b08ee5313f63 100644
--- a/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 {
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {
+ // Paper start
+ // Paper start - Remove stale POIs
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
+ this.getPoiManager().remove(blockposition1);
+ }
+ // Paper end
+ // Paper end - Remove stale POIs
this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1);
});

Datei anzeigen

@ -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
index d727e401b311eea832315cc681fa7d73886c3f99..0c495698438e4dd29d4bcddb0c88978fc58db8f3 100644
index d727e401b311eea832315cc681fa7d73886c3f99..617f8776797e07b5d2ad632b5e049b287984d504 100644
--- a/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 {
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {
+ // Paper start
+ // Paper start - Fix villager boat exploit
+ if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
+ if (human != null) {
+ villager.setTradingPlayer(null);
+ }
+ }
+ // Paper end
+ // Paper end - Fix villager boat exploit
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
});
}

Datei anzeigen

@ -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
index 0c495698438e4dd29d4bcddb0c88978fc58db8f3..3aeaf4cb425b141d1a90a40cdee95bc98b2aeb56 100644
index 617f8776797e07b5d2ad632b5e049b287984d504..d80b05fb33d1f519923f8ef189ff9025335d9390 100644
--- a/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 {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
+ // Paper start - add recalculatePermissions parameter
+ // Paper start - Add sendOpLevel API
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
+ }
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
+ // Paper end
+ // Paper end - Add sendOpLevel API
if (player.connection != null) {
byte b0;
@ -24,29 +24,29 @@ index 0c495698438e4dd29d4bcddb0c88978fc58db8f3..3aeaf4cb425b141d1a90a40cdee95bc9
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
+ if (recalculatePermissions) { // Paper
+ if (recalculatePermissions) { // Paper - Add sendOpLevel API
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
+ } // Paper
+ } // Paper - Add sendOpLevel API
}
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
index ba30c5e17a294cee9f408fdd4e31849c0e5d28ed..8a924ae677a93a177651aa1ec0728e3b8d5528a6 100644
index ba30c5e17a294cee9f408fdd4e31849c0e5d28ed..298380e217f41f01d0818767a6d8f1da5a004037 100644
--- a/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 {
}
// Paper end
+ // Paper start - sendOpLevel API
+ // Paper start - Add sendOpLevel API
+ @Override
+ public void sendOpLevel(byte level) {
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
+
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
+ }
+ // Paper end - sendOpLevel API
+ // Paper end - Add sendOpLevel API
+
@Override
public void setCompassTarget(Location loc) {

Datei anzeigen

@ -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
index 5436949cd928303cf80b606c747f386f0189f774..025ec74fe0ada57e1809d7e16c27b3a08007ad78 100644
index 3a8572ded5c9bdf621a8c16123707da9ceb70d54..1249e086d022a68e1d27a7731c0aff92f1457e43 100644
--- a/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
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
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 d1 = entity.getZ() - this.getZ();
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
index 82ffd50017dc234a9718db551fca0e73a6deded0..9780232286052d2cbbd604e71caf47dfb81fc1dc 100644
index 82ffd50017dc234a9718db551fca0e73a6deded0..71361cc7339483936b18d2e0e938669bf08d68d2 100644
--- a/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 {
public void push(Entity entity) {
if (!this.level().isClientSide) {
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)) {
// CraftBukkit start
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
index 6b0ec9da5a368775924f5b97c74acc5bfd609fa1..8b0efc4d78a04effddae0799b7ee5759ed5c720f 100644
index 6b0ec9da5a368775924f5b97c74acc5bfd609fa1..8a1cd9227d6f889dd8036ec593ee48862966af75 100644
--- a/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> {
@Override
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.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start

Datei anzeigen

@ -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
index c6ac55cdece9e2901e5d17a23408171c6c49ff69..b22cf4636108794092d8e289368b72a10a16d3cd 100644
index c6ac55cdece9e2901e5d17a23408171c6c49ff69..d18c7ac003e8537b9bf389ad3ad58e80242ec502 100644
--- a/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 {
@ -16,10 +16,10 @@ index c6ac55cdece9e2901e5d17a23408171c6c49ff69..b22cf4636108794092d8e289368b72a1
- Preconditions.checkState(this.title != null, "Title not set");
+ // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set");
+ if(this.title == null){
+ if (this.title == null){
+ return Component.literal("");
+ }
+ // Paper end
+ // Paper end - return chat component with empty text instead of throwing error
return this.title;
}
public final void setTitle(Component title) {

Datei anzeigen

@ -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
index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab586c17f4 100644
index 569b645c6d795401c974069d0be7195590cd354a..7b4ee914fb7681760446f864cf3f2f8cab180dd6 100644
--- a/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 {
@ -13,7 +13,7 @@ index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab
});
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) ((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() {}
@ -22,7 +22,7 @@ index 569b645c6d795401c974069d0be7195590cd354a..6fae14c03cb75375cee726df7f3ba9ab
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
- 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) {
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);

Datei anzeigen

@ -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
index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576c45a8045 100644
index b5964614823059261c28eb2e998ad54249f07e7b..08245016186c47077294f758409f8bf14398199f 100644
--- a/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 {
@ -13,7 +13,7 @@ index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
- 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.dropLeash(true, true);
}
@ -22,7 +22,7 @@ index b5964614823059261c28eb2e998ad54249f07e7b..452f219fde958fb4dc775cd2c56c0576
this.onLeashDistance(f);
- 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.dropLeash(true, true);
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

Datei anzeigen

@ -1,18 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com>
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
index 21c37ad365e09a296c3e7a2d0cde7a29ced09c33..52e92ffd6bf5d3d721807a0b3a8e2d301951f934 100644
index 5593a0aa9e618071b6521b213dde0f628348c3dc..1ee863ec252872deb15a6b96f1d937c672ce5898 100644
--- a/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 {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
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
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}

Datei anzeigen

@ -1,40 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index e6a4e8dcdbc49b427c2802f1a358f8f9ad04d0f0..685c35419de7e3c4e854a28118a243e65250ef59 100644
index e6a4e8dcdbc49b427c2802f1a358f8f9ad04d0f0..611cbe0e47474f94cd203ac86ca9e80cab621134 100644
--- a/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() {
return BeaconMenu.decodeEffect(this.beaconData.get(2));
}
+ // Paper start
+ // Paper start - Add PlayerChangeBeaconEffectEvent
+ 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 org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()));
+ }).orElse(null);
+ }
+ // Paper end
+ // Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
if (this.paymentSlot.hasItem()) {
- 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
+ // 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());
+ if (event.callEvent()) {
+ 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())));
+ if (event.willConsumeItem()) {
+ // Paper end
this.paymentSlot.remove(1);
+ }
this.access.execute(Level::blockEntityChanged);
+ } // Paper end
+ } // Paper end - Add PlayerChangeBeaconEffectEvent
}
}

Datei anzeigen

@ -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
index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..99321471d2c8c154059ebf345c63f8918a4cd75a 100644
index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..3c5e18a5d136917c65bbfe1311c881d1b8bbd164 100644
--- a/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 {
@ -13,7 +13,7 @@ index 7741b27816636aaa48277b2fe14fd7b88cd3d78a..99321471d2c8c154059ebf345c63f891
this.spawnExitPortal(true);
this.spawnNewGateway();
- 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());
}

Datei anzeigen

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 27 Nov 2020 17:14:27 -0800
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
Subject: [PATCH] Add PlayerStonecutterRecipeSelectEvent
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
index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114fe06242f 100644
index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..a5763abd3137e993ec856874b8fe7ef82dd6f570 100644
--- a/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 {
@ -14,7 +14,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
super(MenuType.STONECUTTER, syncId);
- 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.input = ItemStack.EMPTY;
this.slotUpdateListener = () -> {
@ -23,7 +23,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (this.isValidRecipeIndex(id)) {
- this.selectedRecipeIndex.set(id);
+ // Paper start
+ // Paper start - Add PlayerStonecutterRecipeSelectEvent
+ int recipeIndex = id;
+ this.selectedRecipeIndex.set(recipeIndex);
+ this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed
@ -45,7 +45,7 @@ index 70ecc3f673ebd56b65ad901e10f40c28368cbfac..aa1d1466d0a7b76967a41d948b7a4114
+ }
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it
+ // Paper end
+ // Paper end - Add PlayerStonecutterRecipeSelectEvent
this.setupResultSlot();
}

Datei anzeigen

@ -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
index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b8bbcdd15 100644
index 3da1debb3ad884d9ba2f8ebea52643e8fcb3a747..c64c8efc7fcf77a78c7807bf8def32cbd748b84d 100644
--- a/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 {
@ -13,16 +13,16 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
} else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent
- 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);
+ if (event.isCancelled()) {
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder()));
return InteractionResult.PASS;
}
// CraftBukkit end
- 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);
return InteractionResult.sidedSuccess(this.level().isClientSide);
} else {
@ -32,11 +32,11 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
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.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);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
}
@ -46,11 +46,11 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
if (flag1 && this.isLeashed()) {
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ if (!event.callEvent()) { return flag1; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
return flag1;
@ -60,48 +60,48 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..16d84042e2575418880897c728a99d1b
super.removeAfterChangingDimensions();
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, false);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
this.getAllSlots().forEach((itemstack) -> {
if (!itemstack.isEmpty()) {
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
index 452f219fde958fb4dc775cd2c56c0576c45a8045..7ed610c67fcfa200c30e13a49146907f765bc5ed 100644
index 08245016186c47077294f758409f8bf14398199f..3d95257d2203fe40bb1fab58ad2a1f9e815184a9 100644
--- a/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 {
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.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
return;
@@ -66,8 +69,11 @@ public abstract class PathfinderMob extends Mob {
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.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
} else if (f > 6.0F) {
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
index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63659bc0ca 100644
index 16784fcc853e23689a854e7dc6c03ed8182a164e..006aba8bbb34a0d45ef626a1d299e81909cf9ba1 100644
--- a/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 {
@ -109,20 +109,20 @@ index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
// CraftBukkit start
- 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);
+ if (event.isCancelled()) {
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
die = false;
continue;
}
- 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
flag1 = true;
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -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) {
- 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) {
+ 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);
return event;
}

Datei anzeigen

@ -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
index ff75234d76e4f6a939841c982a6fc3e33b36ea61..33477a639304c1491b5eea8585051e266ec93bc7 100644
index ff75234d76e4f6a939841c982a6fc3e33b36ea61..468d96f4b1e83d81fec8997557964931c7512a35 100644
--- a/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 {
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}
+ // Paper start
+ // Paper start - Reset shield blocking on dimension change
+ if (this.isBlocking()) {
+ this.stopUsingItem();
+ }
+ // Paper end
+ // Paper end - Reset shield blocking on dimension change
return this;
}

Datei anzeigen

@ -1,35 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
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
index 99321471d2c8c154059ebf345c63f8918a4cd75a..c29ccc66c95faba425acb0ca06af15e2783b4bae 100644
index 3c5e18a5d136917c65bbfe1311c881d1b8bbd164..5ba7bf72f08980b1c16240a5376ad8c3c9379100 100644
--- a/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.spawnExitPortal(true);
this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent
+ // Paper start - Add DragonEggFormEvent
+ 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);
+ 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,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
+ // Paper end - DragonEggFormEvent
if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
+ // Paper end - Add DragonEggFormEvent
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());
+ // 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());
+ } else {
+ eggEvent.setCancelled(true);
+ }
+ if (eggEvent.callEvent()) {
+ eggEvent.getNewState().update(true);
+ // Paper end - Add DragonEggFormEvent
}
+ // Paper end - DragonEggFormEvent
this.previouslyKilled = true;
this.dragonKilled = true;

Datei anzeigen

@ -1,42 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
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
index a75c6825eaee07bbde9b7c81c4232bc982a98326..f89d2dc9ec8bfe0b401b96bffd59502bf903a24d 100644
index 8d3b3524a939d483aa4d451a8ca0fed3a9c87d26..37a5775a96a894a5419f01886fba471f0c62aba0 100644
--- a/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
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
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(() -> {
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
index efbdcaff160e1c8e666d54a9babe35ac325ec8a5..3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01 100644
index 7b76cba12680d7a8720c597b3a98b08ee5313f63..9f39445a78bfea25a12278b4410a44caf3cf929e 100644
--- a/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 {
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
+ public boolean hasEntityMoveEvent = false; // Paper
+ public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent
public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
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
index 7d72477cdeaa8238da1291c0a902d090463b95c8..51916ff6f45090cf5e2da6b12640c130533fc4d9 100644
index 7d72477cdeaa8238da1291c0a902d090463b95c8..1681b63e49cb4f84b1caf0e1b02db19ede08ba13 100644
--- a/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 {
this.pushEntities();
this.level().getProfiler().pop();
+ // Paper start
+ // Paper start - Add EntityMoveEvent
+ 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()) {
+ 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()) {
this.hurt(this.damageSources().drown(), 1.0F);
}

Datei anzeigen

@ -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
index 3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01..a3288d3cd160978e8bab4ca34d1fe6dbee042e28 100644
index 9f39445a78bfea25a12278b4410a44caf3cf929e..da32aad077fb36cc17f420cc445530eec173e110 100644
--- a/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 {
@ -20,7 +20,7 @@ index 3396f940f5c7c4e7b77a4570c34fbe5ad2c7da01..a3288d3cd160978e8bab4ca34d1fe6db
}
}
+ } // Paper
+ } // Paper - option to disable pathfinding updates
}
@Override

Datei anzeigen

@ -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.
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
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable {
})).toArray((i) -> {
return new Direction[i];
});
+ // Paper start
+ // Paper start - Perf: Inline shift direction fields
+ private final int adjX;
+ private final int adjY;
+ 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) {
this.data3d = id;
@ -26,11 +26,11 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fd
this.axis = axis;
this.axisDirection = direction;
this.normal = vector;
+ // Paper start
+ // Paper start - Perf: Inline shift direction fields
+ this.adjX = vector.getX();
+ this.adjY = vector.getY();
+ this.adjZ = vector.getZ();
+ // Paper end
+ // Paper end - Perf: Inline shift direction fields
}
public static Direction[] orderedByNearest(Entity entity) {
@ -39,17 +39,17 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fd
public int getStepX() {
- return this.normal.getX();
+ return this.adjX; // Paper
+ return this.adjX; // Paper - Perf: Inline shift direction fields
}
public int getStepY() {
- return this.normal.getY();
+ return this.adjY; // Paper
+ return this.adjY; // Paper - Perf: Inline shift direction fields
}
public int getStepZ() {
- return this.normal.getZ();
+ return this.adjZ; // Paper
+ return this.adjZ; // Paper - Perf: Inline shift direction fields
}
public Vector3f step() {

Datei anzeigen

@ -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
index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3c78ffb12 100644
index 8761bb7b61d322bc1e29d217631a9d2c70e5bcc4..4caddfe884748543f1153dbf066bb2d3f4cd78d4 100644
--- a/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 {
@ -13,19 +13,19 @@ index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3
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()));
+ // Paper start
+ // Paper start - Allow adding items to BlockDropItemEvent
+ List<Item> list = new ArrayList<>();
+ for (ItemEntity item : items) {
+ list.add((Item) item.getBukkitEntity());
+ }
+ BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), list);
+ // Paper end
+ // Paper end - Allow adding items to BlockDropItemEvent
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- for (ItemEntity item : items) {
- item.level().addFreshEntity(item);
+ // Paper start
+ // Paper start - Allow adding items to BlockDropItemEvent
+ for (Item bukkit : list) {
+ if (!bukkit.isValid()) {
+ Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle();
@ -38,7 +38,7 @@ index 2d9d6d735a13e0e0fc1f277f48c7bdb05aa3352a..8a7c90014beb5e044abc1fd6f8832bb3
+ bukkit.remove();
+ }
}
+ // Paper end
+ // Paper end - Allow adding items to BlockDropItemEvent
}
}

Datei anzeigen

@ -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
index d5dfb08f550f5644ff5164170d6c16a3b25a3748..7204b973c3ad9239e82355513f6d538107102e48 100644
index d5dfb08f550f5644ff5164170d6c16a3b25a3748..897d7632ecfea40890433474870dd7a5e534d8ab 100644
--- a/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 {
@ -13,44 +13,44 @@ index d5dfb08f550f5644ff5164170d6c16a3b25a3748..7204b973c3ad9239e82355513f6d5381
}
+
+ // Paper - start
+ // Paper - start - living entity allow attribute registration
+ public void registerAttribute(Attribute attributeBase) {
+ AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute);
+ 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
index ea48f1119a940056c37d1d203437bfbfdf13663b..a3f989fd1775adbb84d197c51e22c1889a2f8e18 100644
index ea48f1119a940056c37d1d203437bfbfdf13663b..8a678df56fcf30535957e111d81ad07be5b501ec 100644
--- a/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 {
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
}
+ // Paper start
+ // Paper start - living entity allow attribute registration
+ @Override
+ public void registerAttribute(Attribute attribute) {
+ Preconditions.checkArgument(attribute != null, "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
index f108af0f9047ce8d0ee402838ecbf7840d55ba54..d3f97ba1b03e050b10553ea536bc26a7bfc5b976 100644
index f108af0f9047ce8d0ee402838ecbf7840d55ba54..f874712c1569a30c825c1a904a3bcfbe1085200b 100644
--- a/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 {
return this.getHandle().craftAttributes.getAttribute(attribute);
}
+ // Paper start
+ // Paper start - living entity allow attribute registration
+ @Override
+ public void registerAttribute(Attribute attribute) {
+ getHandle().craftAttributes.registerAttribute(attribute);
+ }
+ // Paper end
+ // Paper end - living entity allow attribute registration
+
@Override
public void setAI(boolean ai) {

Datei anzeigen

@ -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
index 2e93eec8733c5b548a15269a322fe4dd1f189b7d..dd9f611efc95f7d06fd3011fedd5d0317b1d0a85 100644
index 2e93eec8733c5b548a15269a322fe4dd1f189b7d..69b18e312db984eaffa8bae2439c88f73b872c53 100644
--- a/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 {
jframe.pack();
jframe.setLocationRelativeTo((Component) null);
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 {
+ jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
+ } catch (java.io.IOException ignore) {
+ }
+ // Paper end
+ // Paper end - Improve ServerGUI
+
jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) {
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
index 7938029cb7aa6f09f78fb1c648357c36edb68510..4073484fefbf1ec6072013f6903f9237eb3ebfbc 100644
index 7938029cb7aa6f09f78fb1c648357c36edb68510..ed94bc86ed47719c2f6c338374edf741bd202c24 100644
--- a/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 {
private void tick() {
long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ // Paper start - Add tps entry
+ // Paper start - Improve ServerGUI
+ double[] tps = org.bukkit.Bukkit.getTPS();
+ 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[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);
+ // Paper end
+ // Paper end - Improve ServerGUI
this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint();
}
@ -85,11 +85,11 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..4073484fefbf1ec6072013f6903f9237
this.timer.stop();
}
+
+ // Paper - start Add tps entry
+ // Paper - Improve ServerGUI
+ 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
+ }
+ // Paper end
+ // Paper end - Improve ServerGUI
}
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
new file mode 100644

Datei anzeigen

@ -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
index a20d47f54f12dfc0a5f76dd969238e34c958b618..935dac757280731bfeb0a8f033cbe315ecac46da 100644
index a20d47f54f12dfc0a5f76dd969238e34c958b618..1c9cf5e1c4ee05724ffcdbd77a19bca1ab2be4d3 100644
--- a/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 {
this.setViewDistance(dedicatedServerProperties.viewDistance);
this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+ // Paper start - moved from constructor
+ // Paper start - fix converting txt to json file; moved from constructor
+ }
+ @Override
+ public void loadAndSaveFiles() {
+ // Paper end
+ // Paper end - fix converting txt to json file
this.loadUserBanList();
this.saveUserBanList();
this.loadIpBanList();
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
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// 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()) {
+ this.getProfileCache().save(false); // Paper
+ }
+ 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
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@ -48,14 +48,14 @@ index 2d5e8d624b153f55e28d8a4e008dce11853179cf..b5acccc3339e3e2b817116ecf2af228c
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
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
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -176,6 +176,7 @@ public abstract class PlayerList {
this.maxPlayers = maxPlayers;
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) {
player.isRealPlayer = true; // Paper

Datei anzeigen

@ -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
index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede88044b2f735a 100644
index dd74e8a034022fe72a1652f92712182b4910f651..8e441aafff788eab9e3d6d2fc7b70183d90b9ef4 100644
--- a/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 {
}
public void setCenter(double x, double z) {
+ // Paper start
+ // Paper start - Add worldborder events
+ 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));
+ if (!event.callEvent()) return;
+ x = event.getNewCenter().getX();
+ z = event.getNewCenter().getZ();
+ }
+ // Paper end
+ // Paper end - Add worldborder events
this.centerX = x;
this.centerZ = z;
this.extent.onCenterChange();
@ -27,7 +27,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
}
public void setSize(double size) {
+ // Paper start
+ // Paper start - Add worldborder events
+ 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);
+ if (!event.callEvent()) return;
@ -37,7 +37,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
+ }
+ size = event.getNewSize();
+ }
+ // Paper end
+ // Paper end - Add worldborder events
this.extent = new WorldBorder.StaticBorderExtent(size);
Iterator iterator = this.getListeners().iterator();
@ -45,7 +45,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
}
public void lerpSizeBetween(double fromSize, double toSize, long time) {
+ // Paper start
+ // Paper start - Add worldborder events
+ if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type;
+ if (fromSize == toSize) { // new size = old size
@ -58,7 +58,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
+ toSize = event.getNewSize();
+ 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));
Iterator iterator = this.getListeners().iterator();
@ -66,7 +66,7 @@ index dd74e8a034022fe72a1652f92712182b4910f651..204f008dc36212e696fba781fede8804
@Override
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);
}

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index af072de68435d1678651bdf2fa13b314ca9c9d58..2941c16ef486345b57ab2dfcd26f0272285d3b5a 100644
index af072de68435d1678651bdf2fa13b314ca9c9d58..d12b3fb8b5e28ba4524d163878be978b1b42d019 100644
--- a/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,14 +15,14 @@ index af072de68435d1678651bdf2fa13b314ca9c9d58..2941c16ef486345b57ab2dfcd26f0272
- entity.setCustomName(stack.getHoverName());
- if (entity instanceof Mob) {
- ((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);
+ if (!event.callEvent()) return InteractionResult.PASS;
+ LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle();
+ newEntityLiving.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null);
+ if (event.isPersistent() && newEntityLiving instanceof Mob) {
+ ((Mob) newEntityLiving).setPersistenceRequired();
+ // Paper end
+ // Paper end - Add PlayerNameEntityEvent
}
stack.shrink(1);

Datei anzeigen

@ -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
index 811d7415ae843347da374d73b4edfe89642d518a..24187a7ce812cb83a9a736bec8dce9e68ccc0798 100644
index 811d7415ae843347da374d73b4edfe89642d518a..0ebd139f2f51730c190570dc4abb5ff2f2ed2cfa 100644
--- a/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 {
@ -20,7 +20,7 @@ index 811d7415ae843347da374d73b4edfe89642d518a..24187a7ce812cb83a9a736bec8dce9e6
}
- 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 {
boolean flag3 = !itemstack.isEmpty();

Datei anzeigen

@ -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
index 7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c..97b8dc205fb22e17ab457e8d1f4d73a7b2f8cc47 100644
index 5c65be04ac88f1308eae6a8cde36d5f7e8aad879..14406c07dc505525ddcd257ca7e3779c1338eb05 100644
--- a/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
@ -13,33 +13,32 @@ index 7bcc4ede30f9cd1af2b0560bd3eca18e11a5524c..97b8dc205fb22e17ab457e8d1f4d73a7
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, (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);
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
index f706c787f7608f7440a5f5e05e7e9c4cb582368c..f776289eea00bd741ad55bb9bc338dd2c05c8b39 100644
index f706c787f7608f7440a5f5e05e7e9c4cb582368c..daeced350310020b99ab0244daf7f7a69c29b069 100644
--- a/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]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> {
- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world);
+ // Paper start - Add recipe to cook events; re-use recipeHolderOptional below
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor(inventorysubcontainer, world);
+ ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> {
+ // Paper end
+ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess());
+ // Paper end - Add recipe to cook events
return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
}).orElse(itemstack);
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
@@ -72,7 +74,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -72,7 +75,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
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, (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);
if (blockCookEvent.isCancelled()) {

Datei anzeigen

@ -208,7 +208,7 @@ index 0000000000000000000000000000000000000000..dd9d77d7c7f1a5a130a1f4c15e5b1e68
+ 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
index b5acccc3339e3e2b817116ecf2af228cb641b175..d0551eb2aae8a26222827fdd7c1b7ee81c8c95b9 100644
index f6da2fcc1709d0942ed8332b4f59c6b4131a0b78..6d3468cc85b8eb7f44994f0c8365cb63e1cede0d 100644
--- a/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
@ -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\"");
@@ -206,6 +206,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
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
+ 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

Datei anzeigen

@ -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
index a13a1725356ca4430f1f0a6d121fc08679de62db..bd0165d9ca52665a52fbd9678ed895bf4bed2fe7 100644
index a13a1725356ca4430f1f0a6d121fc08679de62db..7a990fb47f39da00026d3005d5bb11d3abd14026 100644
--- a/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,
}
+ // Paper Start - Horse API
+ // Paper start - Horse API
+ public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open);
+ }
+ public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH);
+ }
+ // Paper End - Horse API
+ // Paper end - Horse API
+
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
@ -235,11 +235,11 @@ index a13a1725356ca4430f1f0a6d121fc08679de62db..bd0165d9ca52665a52fbd9678ed895bf
this.setFlag(16, eatingGrass);
}
+ // Paper Start - Horse API
+ // Paper start - Horse API
+ public void setForceStanding(boolean standing) {
+ this.setFlag(FLAG_STANDING, standing);
+ }
+ // Paper End - Horse API
+ // Paper end - Horse API
public void setStanding(boolean angry) {
if (angry) {
this.setEating(false);
@ -511,7 +511,7 @@ index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed603
+ // Paper end
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -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
+ public void setLyingDown(boolean lyingDown) {
+ this.getHandle().setLying(lyingDown);
@ -539,7 +539,7 @@ index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..0ccc20157fb9fdb9c99b942dcb4675db
+ public boolean isHeadUp() {
+ 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
index 64b75682a936e071353707f7615d6ff512fd617d..96f6e2fd9c6b20d34122abfe5c7fba732502d5a0 100644
@ -748,7 +748,7 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926
+ // Paper end
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -887,6 +887,22 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -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
index b502b3bf5f4f0a820b75434e8f620b3df01e18e2..17cf920cc7bbd662a08b075466b8c534f0493802 100644
index 7e4868e776c95820385d31aaccb9b821f9d62403..bf93470be313017c125e58fdb24a0d6a14e2bb33 100644
--- a/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
} // Paper end
} // Paper end - Call interact event
// Arm swing animation
- PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

Datei anzeigen

@ -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
index db846e623bdf8231991d30c88dcf858d66836ca4..bd5e80a04a035f670160a5eef94805ab90372cf6 100644
index 796412196f26f22b639b82192a3288a81ebd10b4..711f4ca8ee42a14e40af86d93a9685b4b9a2ba99 100644
--- a/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 {
}
// Paper end
}
+ // Paper Start - Bee Stinger API
+ // Paper start - Bee Stinger API
+ @Override
+ public int getBeeStingerCooldown() {
+ return getHandle().removeStingerTime;
@ -33,7 +33,7 @@ index db846e623bdf8231991d30c88dcf858d66836ca4..bd5e80a04a035f670160a5eef94805ab
+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
+ getHandle().setStingerCount(count);
+ }
+ // Paper End - Bee Stinger API
+ // Paper end - Bee Stinger API
@Override
public void damage(double amount) {
this.damage(amount, null);

Datei anzeigen

@ -86,7 +86,7 @@ index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..a3686cede266c0205247abcec3ce082a
// CraftBukkit end
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
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java
@@ -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) {
+ super(key, result, template, base, addition, copyNbt);
+ }
+ // Paper endv
+ // Paper end - Option to prevent NBT copy
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
if (recipe instanceof CraftSmithingTransformRecipe) {

Datei anzeigen

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

Datei anzeigen

@ -13,14 +13,14 @@ Co-authored-by: Noah van der Aa <ndvdaa@gmail.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
index 95f897b9ef73c880aff1cfe35fe490683badfd44..788d8a04398482fdfd0fe89e519b2a6c57410ec3 100644
index 95f897b9ef73c880aff1cfe35fe490683badfd44..1ec8c2d24ec8468d20f322d67143b9454ff266eb 100644
--- a/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
return to.setValue(BERRIES, from.getValue(BERRIES));
}
+ // Paper start - Fix Spigot growth modifiers
+ // Paper start - Fix Spigot growth modifiers
+ @Override
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);

Datei anzeigen

@ -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
index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d39f6e9c86 100644
index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9b02ac74f 100644
--- a/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 {
private final int adjY;
private final int adjZ;
// Paper end
// Paper end - Perf: Inline shift direction fields
+ // Paper start - optimise collisions
+ private static final int RANDOM_OFFSET = 2017601568;
+ private Direction opposite;
+ static {
+ 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) {
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
index 6571692d00f88947316454e2f10cac30e3756ac0..0492704f7f365310d7ea930c30330a468a39c0de 100644
index f35bd06e3ae16922dfde76abda5b6f938f5b50f7..cb18d1a0ad8c06336d4bfe53b5231fdb9164ae60 100644
--- a/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 {
@ -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
index 1bbcae2411205799b00dba7ee82c3ceb461289cf..5921b4c5c38354c4782783d0debddb8bf4e356c7 100644
index 91fa10899f7f10dc056b4668c1f9758a8de09b9b..81303bc614b47fdd6db90ad1fbdaf9fed65b6cf3 100644
--- a/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 {
@ -2214,7 +2214,7 @@ index 1bbcae2411205799b00dba7ee82c3ceb461289cf..5921b4c5c38354c4782783d0debddb8b
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
index 3086ded2c65b2d623a50401fb0a1612d073da450..5be92231bf62285f29dcf32b2ef65baaf5755804 100644
index 9b9c09f57905d52721e9ab911dbb4df67d235ea7..e19204ff0d29d522ae653805429dc76f628f2ebc 100644
--- a/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

Datei anzeigen

@ -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
index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd89649539cc1012 100644
index daeced350310020b99ab0244daf7f7a69c29b069..6b4ced63bf489a02b1e11ab9b1dd768e2ea0861d 100644
--- a/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 {
@ -34,7 +34,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd896495
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
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));
}
@ -51,7 +51,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd896495
}
@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);
nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime);

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Add API for item entity 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
index cbdac5a439795d429a1364a7eafc4783cff51d54..b1bbab951ef9a3d2bd98cc54665ba824263542eb 100644
index 4a15c3786edbfeae3367c0b20fb6aee11d62aea6..cbfd4cf1d7d32757cf124d1aaa4b83d8a155868f 100644
--- a/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 {
@ -29,6 +29,6 @@ index cbdac5a439795d429a1364a7eafc4783cff51d54..b1bbab951ef9a3d2bd98cc54665ba824
+ this.getHandle().health = health;
+ }
+ }
// Paper End
// Paper end
@Override

Datei anzeigen

@ -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
index 37724831ba9db2d0fb2e7756816e0355bc760815..0ce75b221241b412fe7d8873bdc4a49370b6410b 100644
index a89dec53d68579271d2a259e1a53537262bd0df6..c3dc61f096c0c27c83c34e023994a65dc82706bc 100644
--- a/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 {
@ -29,7 +29,7 @@ index 37724831ba9db2d0fb2e7756816e0355bc760815..0ce75b221241b412fe7d8873bdc4a493
+ // Paper start - Replace rules for Height in Slime Chunks
+ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum;
+ 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);
}
}

Datei anzeigen

@ -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
index a5820d750e88918ef819be0d0896e31b628ab302..e61cb14e9451b242c8324d81b462e80832ef73aa 100644
index f3cb6eac54b245ff6cbe3a1659ac9b7a1b0856a0..276c7dd6af228f404cec7aeb58dad10f2a23a18b 100644
--- a/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
@ -46,7 +46,7 @@ index a5820d750e88918ef819be0d0896e31b628ab302..e61cb14e9451b242c8324d81b462e808
} 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
index d3a1fcd144f513d20fbc9a5688a45fa750f512ae..9561bbe37c57f36edee9f77d69fff363db886b2d 100644
index 95442c5e5abfd916a1b0add6381a8f57b36125e7..13b4a2eae01ee51546e6e5e3c4093e5389971d7d 100644
--- a/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 {
@ -59,14 +59,14 @@ index d3a1fcd144f513d20fbc9a5688a45fa750f512ae..9561bbe37c57f36edee9f77d69fff363
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
index 47be73dbb0dd1b6cef0113042be6a80cb6209252..1879ec9e275194cb83f30ec47930a3814fbe1da3 100644
index 47be73dbb0dd1b6cef0113042be6a80cb6209252..b7df71633527dce2e4f954caee249e3b31b82226 100644
--- a/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 {
return this.getHandle().isFullyFrozen();
}
+ // Paper Start - Freeze Tick Lock API
+ // Paper start - Freeze Tick Lock API
+ @Override
+ public boolean isFreezeTickingLocked() {
+ return this.entity.freezeLocked;

Datei anzeigen

@ -213,7 +213,7 @@ index 73cb7aa01af3eed71b05b1a539f082b26dcd8d60..2783e218d5e5c24787429237974e1967
@Override
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
index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe2db51720 100644
index c9e15a9d82dee935293b2e7e233f5b9b2d822448..fedbfbac02b73382aacc69f8a1e5a3e746c55ea2 100644
--- a/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;
@ -239,7 +239,7 @@ index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe
- if (this.item.getType() != 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);
+//
+// if (item.isEmpty()) {
@ -253,7 +253,7 @@ index c9e15a9d82dee935293b2e7e233f5b9b2d822448..13b09465952dca2e95647ddb9753a7fe
+// if (this.item.getType() != Material.FIREWORK_ROCKET) {
+// this.item.setType(Material.FIREWORK_ROCKET);
+// }
+ // Paper End - Expose firework item directly
+ // Paper end - Expose firework item directly
}
@Override
@ -509,7 +509,7 @@ index 20f9735c7cb76024e15dbdca7684f5c560876175..8a6af0db8e0aa0cffbf19584be747076
// Paper end
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -831,19 +831,19 @@ public class CraftEventFactory {

Datei anzeigen

@ -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
index 753bec96a829a153dc54b5e1013359b86f1776b3..d721c96b2b76209176f295896bff3bd03c241c4f 100644
index 3fb0d020493db8e5bde9f6fc76637c74b80fd791..0f562a8e0c5d4b2907174c9409977570869bd331 100644
--- a/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
@ -18,7 +18,7 @@ index 753bec96a829a153dc54b5e1013359b86f1776b3..d721c96b2b76209176f295896bff3bd0
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
index 5e0466b0522ea325b2c37e3d4c80f3d61c1816fe..5433681fc3765d744193556217169995fbbb3c7d 100644
index 7eba2244e1e92dec7b81dea44b05d5e59887d242..2301445fb77cb8777632d81b60cbc04a42d86533 100644
--- a/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
@ -31,7 +31,7 @@ index 5e0466b0522ea325b2c37e3d4c80f3d61c1816fe..5433681fc3765d744193556217169995
}
break;
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
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
@@ -52,7 +52,7 @@ public class GameRules {
@ -92,8 +92,8 @@ index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c318
this.callback = changeCallback;
@@ -289,10 +289,10 @@ public class GameRules {
public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper
this.updateFromArgument(context, name, gameRuleKey); // Paper
public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
- this.onChanged(((CommandSourceStack) context.getSource()).getServer());
+ this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // Paper - Pass ServerLevel for gamerule callbacks
}
@ -167,22 +167,22 @@ index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c318
this.onChanged(server);
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -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));
handle.deserialize(event.getValue()); // Paper
handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true;
}
@@ -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()));
handle.deserialize(event.getValue()); // Paper
handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true;

Datei anzeigen

@ -7,7 +7,7 @@ Also don't fire level events or game events if stalactite
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
index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1b6cfd6eb 100644
index 4c9334dde0734a3550a810845cee53f474e9c96b..50fd3e43b4971cd72efd1f609f0cdc4b0f57bed4 100644
--- a/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 {
@ -15,7 +15,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) {
// 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, 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;
}
// CraftBukkit end
@ -24,7 +24,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) {
// 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, 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;
}
// CraftBukkit end
@ -33,7 +33,7 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) {
// 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, 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;
}
// CraftBukkit end
@ -42,12 +42,12 @@ index 4c9334dde0734a3550a810845cee53f474e9c96b..dc1d20691ae5bd9026143e143a9bfdc1
if (!world.isClientSide) {
// 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, false)) { // Paper - Call CauldronLevelChange
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS;
}
// 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
index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8097f2b62 100644
index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..47b6b83842201620bd6620f5acf11bb14334e35d 100644
--- a/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 {
@ -55,19 +55,19 @@ index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8
if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) {
if (precipitation == Biome.Precipitation.RAIN) {
- 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
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
} else if (precipitation == Biome.Precipitation.SNOW) {
- 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
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
}
@ -76,25 +76,25 @@ index 588b3e911d9b22dad2928ea9e32e8a8a3a8e9b96..274dc56a71fb05060de42169df34dfd8
if (fluid == Fluids.WATER) {
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
- 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
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.levelEvent(1047, pos, 0);
} else if (fluid == Fluids.LAVA) {
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
- 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
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
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
index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1fe6a23d3d 100644
index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..542bc6be48d5c53eee988156e7aa6ecfccb51069 100644
--- a/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 {
@ -102,13 +102,13 @@ index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1f
// CraftBukkit start
- 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
+ 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
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition);
newState.setData(newBlock);
@ -117,7 +117,7 @@ index 18ca086e28f4295cb9303919222d7c8ae0ca5d9a..9c828328f5b8c1fe723437ed4a42cc1f
}
newState.update(true);
- 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;
}
// CraftBukkit end

Datei anzeigen

@ -54,7 +54,7 @@ index fc33d05cf1a3cceb220dab1ee1da33ffe37834db..21a4669b01e9c57100224e20500bc23f
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
index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd4defdef4 100644
index a7a3f74b846112d752fe04162b30805961457b11..1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69 100644
--- a/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 {
@ -93,7 +93,7 @@ index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd
this.setHurtEntities(true);
}
}
+ // Paper Start - Expand FallingBlock API
+ // Paper start - Expand FallingBlock API
+ @Override
+ public boolean doesAutoExpire() {
+ return this.getHandle().autoExpire;
@ -103,5 +103,5 @@ index a7a3f74b846112d752fe04162b30805961457b11..2ba8f461d32a7c517a93461bf6f8f5cd
+ public void shouldAutoExpire(boolean autoExpires) {
+ this.getHandle().autoExpire = autoExpires;
+ }
+ // Paper End - Expand FallingBlock API
+ // Paper end - Expand FallingBlock API
}

Datei anzeigen

@ -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
index cb2f5d727971c809bcb3eea0db04de4fa91459fb..17f753ac54e73f3644d71c3ef5cbdfb850f5766c 100644
index cd20322f88c2952b451b226c4c5c3f41879d0305..092be422770ceb11446b99f6e2d746d1c9ce4f88 100644
--- a/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 {
public final UUID uuid;
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)
public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());

Datei anzeigen

@ -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
index 8850e7af1bc3668a7bec95ffc8c25053cfb07f21..80856e4dc50bbcc3b210a6599f12a85f64865bba 100644
index 0de707a3400d42249b49e8f1899879d7e361b2a8..fe87c5ad1f206c71088342ca8f3865a0fdbdc2fb 100644
--- a/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 {
}
// Paper end - sendOpLevel API
// Paper end - Add sendOpLevel API
+ // Paper start - custom chat completions API
+ @Override

Datei anzeigen

@ -22,14 +22,14 @@ index 42def68f0c682afe7628ff0b9a537e74d77e558c..884343c4ecdecdecb4117ce61d14e057
// Paper end
}
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -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.
}
// Paper end
+ // Paper Start - Collision API
+ // Paper start - Collision API
+ @Override
+ public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
+ 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);
+ }
+ // Paper End - Collision API
+ // Paper end - Collision API
}

Datei anzeigen

@ -67,9 +67,6 @@ https://bugs.mojang.com/browse/MC-200092
https://bugs.mojang.com/browse/MC-158900
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 ==
public net/minecraft/world/entity/Mob leashInfoTag
@ -129,7 +126,7 @@ index 534493aaddced9200e1618d5eabf2b176a1f35b6..a58c47b16254262ec705a8f986ef42c7
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
index 1089c0ad619784d25b1384db2f09eebb53fa4536..4ffb462f051744d5f7f7b4cf0c49f5d1533d1d53 100644
index 82a71a150c555dd4dfe0ce03a3addba53fda5387..9ef3445aadf98d205a60803f459d07c4ac820ba9 100644
--- a/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 {
@ -142,7 +139,7 @@ index 1089c0ad619784d25b1384db2f09eebb53fa4536..4ffb462f051744d5f7f7b4cf0c49f5d1
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
index c03ea45afb5537058cdeecc654184338b9aa0bd8..6251e68eff87a0b26d6123fdb658749e90fcfc42 100644
index d27793e21f9352896a96d5ccfdd0281b0b102a03..6cf989b4827b78d25bcb0ad4b683b6b1569e12dd 100644
--- a/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 {
@ -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.level.updateSleepingPlayerList();
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
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -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
index bd0165d9ca52665a52fbd9678ed895bf4bed2fe7..8fe5a4ccf474c094b8081828c93e8973cdabb6ed 100644
index 7a990fb47f39da00026d3005d5bb11d3abd14026..ea5fffa7e045d854ce9522f00246e3746f40f028 100644
--- a/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,
@ -375,11 +372,11 @@ index 4a0f4c83228187a2082ad029680056b1801f77bd..31831811ce16265e9828fa34d9e67d8a
player.awardStat(Stats.RAID_TRIGGER);
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
index 685c35419de7e3c4e854a28118a243e65250ef59..0b1a0be964d799f1706c273092dc653fa04e8014 100644
index 611cbe0e47474f94cd203ac86ca9e80cab621134..de919d72e6e3ef160c7d22ca6a4e9f79a1fe493e 100644
--- a/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 {
// Paper end
// Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
+ // Paper start - fix MC-174630 - validate secondary power
@ -388,7 +385,7 @@ index 685c35419de7e3c4e854a28118a243e65250ef59..0b1a0be964d799f1706c273092dc653f
+ }
+ // Paper end
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());
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
@ -442,7 +439,7 @@ index 6e45582f8ea7dd2a46f58369c5581764538bff0d..3ecc92439fc85d224ff52f41c5e34079
+ // 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
index 5199ad9ca36ccd18eb2ff191feaf4331404049d2..f41ffeb9062b661c2b8cf09c0d6848550591eaa7 100644
index 333cc37e4f3ca3ea95191dcaafda6be59ef79b96..91071fa934222c9246547c788e3e6cb18fcaa990 100644
--- a/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 {
@ -455,7 +452,7 @@ index 5199ad9ca36ccd18eb2ff191feaf4331404049d2..f41ffeb9062b661c2b8cf09c0d684855
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
index b7760cc0f85b5db37d5a309aae3c26a00a65e32e..d493136283ae5100c0dc22f8da5f7e5b64fdc5f5 100644
index 0813e7510c43ed6916e83635f2be6d39ce2feb5b..137ee0271f1d7adbf3c463b96e9c4627fd5ca74b 100644
--- a/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

Datei anzeigen

@ -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
index 75d24e0d9f3c84f436d967415ee469e5969d3368..e7f967e8f88e6fc5bcfdc033d14bb2b65dda3e67 100644
index 35b6aa33b7715032686acdfd8e5b07d63729593b..e1a3d047743befa9fbc26e7491cb982df19b2f0c 100644
--- a/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 {
@ -38,10 +38,10 @@ index 75d24e0d9f3c84f436d967415ee469e5969d3368..e7f967e8f88e6fc5bcfdc033d14bb2b6
+ return this.entity.getBukkitYaw();
+ }
// Paper end
// Paper Start - Collision API
// Paper start - Collision API
@Override
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1075,6 +1075,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -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
index bb8381c51bc6b37111b837710da7e1ccbca6df5d..5868f13fa3a3791704ba8e344b9c51d88786f41b 100644
index 44ca57d91c64a062c379de38c2a5af2d6fae1af3..e9ec17c4dfb44f6f562dedd20d123064492ef736 100644
--- a/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
@ -58,7 +58,7 @@ index bb8381c51bc6b37111b837710da7e1ccbca6df5d..5868f13fa3a3791704ba8e344b9c51d8
ServerLevel worldserver = (ServerLevel) iterator.next();
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
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(() -> {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java

Datei anzeigen

@ -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
index 79f1fb45447350b5bedee8ce3efe6c150aa9772c..617c35f8e2877be193693548b5af17c50d013e47 100644
index 79f1fb45447350b5bedee8ce3efe6c150aa9772c..7f58c9f5935cd14ea1096de14633f653eb486d7e 100644
--- a/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 {
if (block != null) {
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) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit
+ } else {

Datei anzeigen

@ -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.
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1195,4 +1195,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !this.getHandle().level().noCollision(this.getHandle(), aabb);
}
// Paper End - Collision API
// Paper end - Collision API
+
+ // Paper start - entity scoreboard name
+ @Override

Datei anzeigen

@ -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
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..baf31c109ee8b5e59acd7ff5fc537ea46f27d164 100644
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..678cebb12e290a9a3967177d97a67bebb9116104 100644
--- a/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 {
@ -13,7 +13,7 @@ index b7c0c9a40dac3e828f880ef928ca34206a898cb9..baf31c109ee8b5e59acd7ff5fc537ea4
private CompoundTag internalTag;
- 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 int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only

Datei anzeigen

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items
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
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -28,9 +28,9 @@ index 2344efd039773a0b3052d6e08ba204b1efe8963c..712708f62fadb6698c4231f38deeb39b
+ worldserver.updateLagCompensationTick(); // Paper - lag compensation
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
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
index df40ffecfa6d34aa3cdffbbec03e049a271364ab..048bcbd730ee87cf2f040bda1080ae1f6e4ef414 100644
index f66857ee0cdb3b110a0c3afedbc1c70bb3357a81..24145582ceb89406deb3d7fc3dfbe473c3d85229 100644
--- a/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 {
@ -65,7 +65,7 @@ index 27d22a6aef3f71179ea102062f1338cce5d46fea..52aadf7336c1486ccf0d192e27b742f9
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
index e9839d0dc8339ce62a6eb01c7094a2a3cf0fa816..f9de831797bff3707115f03c24bdca78889003a3 100644
index 768f1cb6b9a5f234be02f07a7ba84156e629fa03..5b2169737f831ba57ce7925cbe9a82c3cd712974 100644
--- a/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 {