3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Dieser Commit ist enthalten in:
Bjarne Koll 2024-10-22 22:00:33 +02:00
Ursprung 6b27267fb7
Commit 152e82ceec
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
22 geänderte Dateien mit 213 neuen und 171 gelöschten Zeilen

Datei anzeigen

@ -11,10 +11,10 @@ Co-authored-by: lexikiq <noellekiq@gmail.com>
Co-authored-by: Aikar <aikar@aikar.co> Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 223f8d9be5d73e296f5815db7123b95c3b345162..d728afbe1d6882f1ace4ead9d87f4b7d2af43ba2 100644 index 8dc2b2d8ba32aefc11eb23054b902650fac76adf..21c3d771a3dd921767c2cba1e11583d015879ca9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1322,7 +1322,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1335,7 +1335,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override @Override
public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) { public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) {
@ -23,50 +23,68 @@ index 223f8d9be5d73e296f5815db7123b95c3b345162..d728afbe1d6882f1ace4ead9d87f4b7d
} }
public int getLogicalHeight() { public int getLogicalHeight() {
@@ -2152,6 +2152,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.serverLevelData.getGameRules();
}
+ // Paper start - respect global sound events gamerule
+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() {
+ return this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) ? ((ServerLevel) this).getServer().getPlayerList().players : ((ServerLevel) this).players();
+ }
+
+ public double getGlobalSoundRangeSquared(java.util.function.Function<org.spigotmc.SpigotWorldConfig, Integer> rangeFunction) {
+ final double range = rangeFunction.apply(this.spigotConfig);
+ return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent
+ }
+ // Paper end - respect global sound events gamerule
+
@Override
public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 0be5ae83d2fa86142e3404393729039c51ae0639..25a429a2d1725d562a28b9d07dba630cfe49d32a 100644 index 2bb62325d30ac509583de50407ea21f562f6e74f..95d69e3ca1a9095dfb340e9be0ec322ab6c5eb5e 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -695,11 +695,12 @@ public class EnderDragon extends Mob implements Enemy { @@ -666,11 +666,12 @@ public class EnderDragon extends Mob implements Enemy {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.level().globalLevelEvent(1028, this.blockPosition(), 0); // worldserver.globalLevelEvent(1028, this.blockPosition(), 0);
int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; int viewDistance = worldserver.getCraftServer().getViewDistance() * 16;
- for (net.minecraft.server.level.ServerPlayer player : this.level().getServer().getPlayerList().players) { - for (net.minecraft.server.level.ServerPlayer player : worldserver.getServer().getPlayerList().players) {
+ for (net.minecraft.server.level.ServerPlayer player : this.level().getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule + for (net.minecraft.server.level.ServerPlayer player : worldserver.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule
double deltaX = this.getX() - player.getX(); double deltaX = this.getX() - player.getX();
double deltaZ = this.getZ() - player.getZ(); double deltaZ = this.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
- if ( this.level().spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > this.level().spigotConfig.dragonDeathSoundRadius * this.level().spigotConfig.dragonDeathSoundRadius ) continue; // Spigot - if ( worldserver.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > worldserver.spigotConfig.dragonDeathSoundRadius * worldserver.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
+ final double soundRadiusSquared = this.level().getGlobalSoundRangeSquared(config -> config.dragonDeathSoundRadius); // Paper - respect global sound events gamerule + final double soundRadiusSquared = worldserver.getGlobalSoundRangeSquared(config -> config.dragonDeathSoundRadius); // Paper - respect global sound events gamerule
+ if ( !this.level().getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule + if ( !worldserver.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule
if (distanceSquared > viewDistance * viewDistance) { if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared); double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index d288bc209a0b0fdf2d73197a8e7d179e8e8c31e7..3ee24382ef3614ff0c5d5cdc614a41286ba4af5e 100644 index 4c284ccd5b2eb05f487aba18e1daa0b59c3e8129..10c79cbc25383c0b65fb22a7347513134b7dee1d 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -278,11 +278,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @@ -276,11 +276,12 @@ public class WitherBoss extends Monster implements RangedAttackMob {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.level().globalLevelEvent(1023, new BlockPosition(this), 0); // worldserver.globalLevelEvent(1023, new BlockPosition(this), 0);
int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; int viewDistance = world.getCraftServer().getViewDistance() * 16;
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) { - for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ for (ServerPlayer player : this.level().getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule + for (ServerPlayer player : world.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule
double deltaX = this.getX() - player.getX(); double deltaX = this.getX() - player.getX();
double deltaZ = this.getZ() - player.getZ(); double deltaZ = this.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
- if ( this.level().spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > this.level().spigotConfig.witherSpawnSoundRadius * this.level().spigotConfig.witherSpawnSoundRadius ) continue; // Spigot - if ( world.spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius ) continue; // Spigot
+ final double soundRadiusSquared = this.level().getGlobalSoundRangeSquared(config -> config.witherSpawnSoundRadius); // Paper - respect global sound events gamerule + final double soundRadiusSquared = world.getGlobalSoundRangeSquared(config -> config.witherSpawnSoundRadius); // Paper - respect global sound events gamerule
+ if ( !this.level().getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule + if ( !world.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared ) continue; // Spigot // Paper - respect global sound events gamerule
if (distanceSquared > viewDistance * viewDistance) { if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared); double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
index 0224a0e901f9430ef06c30432a7988149a67037d..391579b515c5a07066f82b33c4f9ef8ee1d05530 100644 index 04fce5cc4350df81c7ea103b74b845313dd6cc37..770467bd319f8e2fdf3d713591368aa825cfa5ae 100644
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
@@ -67,11 +67,12 @@ public class EnderEyeItem extends Item { @@ -66,11 +66,12 @@ public class EnderEyeItem extends Item {
// world.b(1038, blockposition1.c(1, 0, 1), 0); // world.globalLevelEvent(1038, blockposition1.offset(1, 0, 1), 0);
int viewDistance = world.getCraftServer().getViewDistance() * 16; int viewDistance = world.getCraftServer().getViewDistance() * 16;
BlockPos soundPos = blockposition1.offset(1, 0, 1); BlockPos soundPos = blockposition1.offset(1, 0, 1);
- for (ServerPlayer player : world.getServer().getPlayerList().players) { - for (ServerPlayer player : world.getServer().getPlayerList().players) {
@ -80,22 +98,3 @@ index 0224a0e901f9430ef06c30432a7988149a67037d..391579b515c5a07066f82b33c4f9ef8e
if (distanceSquared > viewDistance * viewDistance) { if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared); double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 240db0aae0b0e306c90bcc4a537c9afcb290acb3..59992bea10218e48397fa781f895d36e0e1df46e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1277,4 +1277,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.id;
}
}
+ // Paper start - respect global sound events gamerule
+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() {
+ return this.getGameRules().getBoolean(GameRules.RULE_GLOBAL_SOUND_EVENTS) ? ((ServerLevel) this).getServer().getPlayerList().players : ((ServerLevel) this).players();
+ }
+
+ public double getGlobalSoundRangeSquared(java.util.function.Function<org.spigotmc.SpigotWorldConfig, Integer> rangeFunction) {
+ final double range = rangeFunction.apply(this.spigotConfig);
+ return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent
+ }
+ // Paper end - respect global sound events gamerule
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 5b219b5eee0c5958b80093c9223feeed0dec830b..bc7143ad915f001726e8558c8ca4160f3f9ace68 100644 index 197e2ec9f1445a8184d0dde0e9b02b39e3302b91..22ed1e67ccb358655fe74cd1b1e19415f4e5bdd7 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,6 +89,7 @@ public class GameProfileCache { @@ -89,6 +89,7 @@ public class GameProfileCache {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add setting for proxy online mode status
TODO: Add isProxyOnlineMode check to Metrics TODO: Add isProxyOnlineMode check to Metrics
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index c1f41dcf49c75c3d69485c0e1ec821205438ed1e..c466ec011d059b9960606ef2ee51ea3a3a65f8d0 100644 index 07969f82a3df1b71bee275a99ef9170a4f9bbbb0..a5880be1ec88c70f7ee46225036b04dac87943d4 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -593,7 +593,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -575,7 +575,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
public boolean enforceSecureProfile() { public boolean enforceSecureProfile() {
DedicatedServerProperties dedicatedserverproperties = this.getProperties(); DedicatedServerProperties dedicatedserverproperties = this.getProperties();
@ -23,7 +23,7 @@ index c1f41dcf49c75c3d69485c0e1ec821205438ed1e..c466ec011d059b9960606ef2ee51ea3a
@Override @Override
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index bc7143ad915f001726e8558c8ca4160f3f9ace68..aeb0c7ce9b6f93dadd407dbdefba053568f2e2fe 100644 index 22ed1e67ccb358655fe74cd1b1e19415f4e5bdd7..c89f4a885982f06823886c81fd386b8de029a3dd 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,7 +89,8 @@ public class GameProfileCache { @@ -89,7 +89,8 @@ public class GameProfileCache {
@ -60,10 +60,10 @@ index a0b0614ac7d2009db5c6c10ab4a5f09dd447c635..653856d0b8dcf2baf4cc77a276f17c8c
} else { } else {
String[] astring1 = astring; String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b7539a5f7bc20f20f3cd7fb30d87ab7ffc1133c3..b125872e57e15081d6f5a7b3e108f7633046b228 100644 index e9e612581683b27f35c0ef7adaae8e8b7eb677ec..e04c3f623a316ac3a7b3700cfd5165e799bc0afc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1888,7 +1888,7 @@ public final class CraftServer implements Server { @@ -1892,7 +1892,7 @@ public final class CraftServer implements Server {
if (result == null) { if (result == null) {
GameProfile profile = null; GameProfile profile = null;
// Only fetch an online UUID in online mode // Only fetch an online UUID in online mode

Datei anzeigen

@ -8,26 +8,12 @@ object identity checks safely.
Use a simpler optimized hashcode Use a simpler optimized hashcode
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
index ee2f1bff22fed14cda434173dc6286e4d4520822..b63116b333b6e06494091a82588acfb639bddb71 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java
@@ -30,8 +30,7 @@ public class BooleanProperty extends Property<Boolean> {
return value.toString();
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals
if (this == object) {
return true;
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
index f4d9856420a6e7e857fc9b9cb6182a54fe341568..3097298fe356df98967cf4bdeaaede69dfe8a441 100644 index e0259a3f66248b011276b6bc5135c5fc96446640..85a197232be9377c0313ec00e8f935551e2c60e0 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
@@ -44,8 +44,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope @@ -59,8 +59,7 @@ public final class EnumProperty<T extends Enum<T> & StringRepresentable> extends
return value.getSerializedName(); return this.ordinalToIndex[enum_.ordinal()];
} }
- @Override - @Override
@ -37,10 +23,10 @@ index f4d9856420a6e7e857fc9b9cb6182a54fe341568..3097298fe356df98967cf4bdeaaede69
return true; return true;
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c425a68af 100644 index 96798f09abe9676679bb25c74942810919e71924..55a87592a99105dbf57b26fb6ccba695295fce24 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java
@@ -35,8 +35,7 @@ public class IntegerProperty extends Property<Integer> { @@ -28,8 +28,7 @@ public final class IntegerProperty extends Property<Integer> {
return this.values; return this.values;
} }
@ -51,10 +37,10 @@ index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c
return true; return true;
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
index 7cbc5e6e75f389f47ef07045f9876cec192f14e4..9055f15af0cae55effa6942913a9d7edf3857e07 100644 index e2bf1055d9ee09c29884505112ccc748cc049bfc..fcf04c5c58ff35d38c5bf0df562ae2f8dc98a0ee 100644
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
@@ -70,7 +70,7 @@ public abstract class Property<T extends Comparable<T>> { @@ -72,7 +72,7 @@ public abstract class Property<T extends Comparable<T>> {
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 14a821bfc6b20475889d3138b8da9e6bfaf1787c..905a7941597306b0cd23ec9a883ef3ee9a684788 100644 index 0ddc79be416161d89c9f333ef79a16f079ba6e1d..9646788fc1313467e5a93f923109d412d6c44a77 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1534,13 +1534,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1537,13 +1537,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot start - limit place/interactions // Spigot start - limit place/interactions
private int limitedPackets; private int limitedPackets;
private long lastLimitedPacket = -1; private long lastLimitedPacket = -1;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable flying kick messages
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 905a7941597306b0cd23ec9a883ef3ee9a684788..34aeb823950fac8eaef3f38b302c1585a45f7498 100644 index 9646788fc1313467e5a93f923109d412d6c44a77..9289df9663a2dfbc28c2c6dd8c31bf516a6229ae 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -346,7 +346,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -353,7 +353,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -17,7 +17,7 @@ index 905a7941597306b0cd23ec9a883ef3ee9a684788..34aeb823950fac8eaef3f38b302c1585
return; return;
} }
} else { } else {
@@ -365,7 +365,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -372,7 +372,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) { if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());

Datei anzeigen

@ -0,0 +1,103 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Sun, 16 Oct 2016 23:19:30 -0700
Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/world/entity/ConversionParams.java b/src/main/java/net/minecraft/world/entity/ConversionParams.java
index 3300104ad3e1f1e39cbe928ec6ad635e6ab76327..c18bc54721e90ed67312cd8baf52ccc8fe04d4cb 100644
--- a/src/main/java/net/minecraft/world/entity/ConversionParams.java
+++ b/src/main/java/net/minecraft/world/entity/ConversionParams.java
@@ -12,4 +12,11 @@ public record ConversionParams(ConversionType type, boolean keepEquipment, boole
public interface AfterConversion<T extends Mob> {
void finalizeConversion(T convertedEntity);
}
+
+ // Paper start - entity zap event - allow conversion to be cancelled during finalization
+ @FunctionalInterface
+ public interface CancellingAfterConversion<T extends Mob> {
+ boolean finalizeConversionOrCancel(final T convertedEntity);
+ }
+ // Paper start - entity zap event - allow conversion to be cancelled during finalization
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 9655466953cf850b82716246821a3ebb968a5478..03d289abc30927793aa00f6758ed9db6fb765999 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1498,6 +1498,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Nullable
public <T extends Mob> T convertTo(EntityType<T> entitytypes, ConversionParams conversionparams, EntitySpawnReason entityspawnreason, ConversionParams.AfterConversion<T> conversionparams_a, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
+ // Paper start - entity zap event - allow cancellation of conversion post creation
+ return this.convertTo(entitytypes, conversionparams, entityspawnreason, e -> { conversionparams_a.finalizeConversion(e); return true; }, transformReason, spawnReason);
+ }
+ @Nullable
+ public <T extends Mob> T convertTo(EntityType<T> entitytypes, ConversionParams conversionparams, EntitySpawnReason entityspawnreason, ConversionParams.CancellingAfterConversion<T> conversionparams_a, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
+ // Paper end - entity zap event - allow cancellation of conversion post creation
// CraftBukkit end
if (this.isRemoved()) {
return null;
@@ -1508,7 +1514,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return null;
} else {
conversionparams.type().convert(this, t0, conversionparams);
- conversionparams_a.finalizeConversion(t0);
+ if (!conversionparams_a.finalizeConversionOrCancel(t0)) return null; // Paper - entity zap event - return null if conversion was cancelled
Level world = this.level();
// CraftBukkit start
@@ -1544,6 +1550,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Nullable
public <T extends Mob> T convertTo(EntityType<T> entitytypes, ConversionParams conversionparams, ConversionParams.AfterConversion<T> conversionparams_a, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
+ // Paper start - entity zap event - allow cancellation of conversion post creation
+ return this.convertTo(entitytypes, conversionparams, e -> { conversionparams_a.finalizeConversion(e); return true; }, transformReason, spawnReason);
+ }
+ public <T extends Mob> T convertTo(EntityType<T> entitytypes, ConversionParams conversionparams, ConversionParams.CancellingAfterConversion<T> conversionparams_a, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
+ // Paper start - entity zap event - allow cancellation of conversion post creation
return this.convertTo(entitytypes, conversionparams, EntitySpawnReason.CONVERSION, conversionparams_a, transformReason, spawnReason);
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index e52487a3537db6c7d6845f972355f8f437ea9156..624f06d630b55cdcaa97cb66736b69c7ad45dd83 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -834,11 +834,18 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public void thunderHit(ServerLevel world, LightningBolt lightning) {
if (world.getDifficulty() != Difficulty.PEACEFUL) {
- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
+ // Paper - Add EntityZapEvent; move log down, event can cancel
Witch entitywitch = (Witch) this.convertTo(EntityType.WITCH, ConversionParams.single(this, false, false), (entitywitch1) -> {
+ // Paper start - Add EntityZapEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch1).isCancelled()) {
+ return false;
+ }
+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Move down
+ // Paper end - Add EntityZapEvent
entitywitch1.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch1.blockPosition()), EntitySpawnReason.CONVERSION, (SpawnGroupData) null);
entitywitch1.setPersistenceRequired();
this.releaseAllPois();
+ return true; // Paper start - Add EntityZapEvent
}, EntityTransformEvent.TransformReason.LIGHTNING, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
if (entitywitch == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 9100ea65e85a0e55cad736634fa63815366334a8..40c298cf4444e7f458cb99b81d64ee6d58a2f128 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1215,6 +1215,14 @@ public class CraftEventFactory {
return !event.isCancelled();
}
+ // Paper start
+ public static com.destroystokyo.paper.event.entity.EntityZapEvent callEntityZapEvent(Entity entity, Entity lightning, Entity changedEntity) {
+ com.destroystokyo.paper.event.entity.EntityZapEvent event = new com.destroystokyo.paper.event.entity.EntityZapEvent(entity.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), changedEntity.getBukkitEntity());
+ entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
+ return event;
+ }
+ // Paper end
+
public static boolean callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock) {
return CraftEventFactory.callEntityChangeBlockEvent(entity, position, newBlock, false);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Filter bad block entity nbt data from falling blocks
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index c3a16691e8a843c02e0aea6469822cd8869ad593..01ac7bb0ef8ab13e7c4b5b56b768b7c0a642b300 100644 index 5ed77cc6c8b0459691d8044232d9972e4278964b..84d9ae7be1bc9b2c4940cc69de24abf7e4c228b3 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -340,7 +340,7 @@ public class FallingBlockEntity extends Entity { @@ -356,7 +356,7 @@ public class FallingBlockEntity extends Entity {
this.dropItem = nbt.getBoolean("DropItem"); this.dropItem = nbt.getBoolean("DropItem");
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Cache user authenticator threads
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index b2f7c76207f2dc0c62f608f21aba4b531f8f523f..e65c582635317b9f8a1af4e6f6a5fb916f73cc35 100644 index 8cf3b9f1b7eef2d6278830e21ae012852687e02b..80ac468321a9ccb3486e97b3448dd3fccd8e766e 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -76,6 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -76,6 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b125872e57e15081d6f5a7b3e108f7633046b228..8e951ed126453cf1ffa81e5c8aa6e6ea5db03089 100644 index e04c3f623a316ac3a7b3700cfd5165e799bc0afc..1f028c40dbe159f836e255ec52287903bca9fab8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2818,5 +2818,24 @@ public final class CraftServer implements Server { @@ -2835,5 +2835,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions(); DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions();
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 56402312e44d12c859e2c4b39902d31b7cfd1573..25a45e680f9fdea90f43d59de87a3a500f4ee8c0 100644 index 8254f76a386bd6791b844a35b146370e817b09ad..7f3ac3e8631e30c968ef664f994ad208d05eb4a3 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -264,7 +264,7 @@ public class ExperienceOrb extends Entity { @@ -268,7 +268,7 @@ public class ExperienceOrb extends Entity {
int i = this.repairPlayerItems(entityplayer, this.value); int i = this.repairPlayerItems(entityplayer, this.value);
if (i > 0) { if (i > 0) {
@ -18,10 +18,10 @@ index 56402312e44d12c859e2c4b39902d31b7cfd1573..25a45e680f9fdea90f43d59de87a3a50
--this.count; --this.count;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 50f33c6029c190f947b6bf6215004416b034c0cc..d36e039aa5f1cf84179def5df5addaf448f54bd2 100644 index 40c298cf4444e7f458cb99b81d64ee6d58a2f128..00267c18a1a6fba610b271770112a55efe732955 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1170,6 +1170,17 @@ public class CraftEventFactory { @@ -1168,6 +1168,17 @@ public class CraftEventFactory {
return event; return event;
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add ProjectileCollideEvent
Deprecated now and replaced with ProjectileHitEvent Deprecated now and replaced with ProjectileHitEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index d36e039aa5f1cf84179def5df5addaf448f54bd2..91180d7ad705ca97c0df43debc14b204127165d0 100644 index 00267c18a1a6fba610b271770112a55efe732955..0a3c89dba691760c7e0be58914003cc438269a03 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1323,6 +1323,16 @@ public class CraftEventFactory { @@ -1321,6 +1321,16 @@ public class CraftEventFactory {
Bukkit.getPluginManager().callEvent(crafterCraftEvent); Bukkit.getPluginManager().callEvent(crafterCraftEvent);
return crafterCraftEvent; return crafterCraftEvent;
} }
@ -26,7 +26,7 @@ index d36e039aa5f1cf84179def5df5addaf448f54bd2..91180d7ad705ca97c0df43debc14b204
public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) {
Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); Projectile bukkitEntity = (Projectile) entity.getBukkitEntity();
@@ -1348,8 +1358,15 @@ public class CraftEventFactory { @@ -1346,8 +1356,15 @@ public class CraftEventFactory {
if (position.getType() == HitResult.Type.ENTITY) { if (position.getType() == HitResult.Type.ENTITY) {
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
} }

Datei anzeigen

@ -13,10 +13,10 @@ by adding code to all overrides in:
to return BLOCKED if it is outside the world border. to return BLOCKED if it is outside the world border.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 21bbc98b26b270b3ad6a3b34d6e50dfb796c3d5a..188904c9f0f81db1d63eec953d6746f2dc23dc81 100644 index 1d5ce4caf99a3fb376b350968a6bd1ac8471ffec..436812c3bfe53358b4d76bb72d777d6661bb6d60 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -158,7 +158,7 @@ public abstract class PathNavigation { @@ -174,7 +174,7 @@ public abstract class PathNavigation {
// Paper start - EntityPathfindEvent // Paper start - EntityPathfindEvent
boolean copiedSet = false; boolean copiedSet = false;
for (BlockPos possibleTarget : positions) { for (BlockPos possibleTarget : positions) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 008be3aad044d20be14da3a9e96933d265104587..03b0720c6ebf1a876d56d18a941e0a06ed26dbf0 100644 index 529b6eccb634f1f4677118c48e174b42eead2c0b..658ceb9c43bb48f88596cd7270e276a369a3937e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -342,6 +342,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -342,6 +342,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -11,7 +11,7 @@ that is outside happens to be closer, but unreachable, yet another reachable
one is in border that would of been missed. one is in border that would of been missed.
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index a3ba3a09378e3bd0517464130ad2c702b0b0165d..3442e33a1146318228c4727a2a5afde685f69bf7 100644 index 5aa04c48e04c067a366383b252a7b713d85eaee9..b50090df116697a12f5498d65dd2e5d6d5297fb5 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -46,6 +46,18 @@ public class WorldBorder { @@ -46,6 +46,18 @@ public class WorldBorder {
@ -34,7 +34,7 @@ index a3ba3a09378e3bd0517464130ad2c702b0b0165d..3442e33a1146318228c4727a2a5afde6
return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D); return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D);
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index a53fa9bebdd46939a710e46466ca9a350ecefb27..0a779632c9d11496fcfc147870fba2699d9cc274 100644 index a84434a95dbe3c458f358d9824de87c503a8b1dc..115deba41ec48143570489e8494785a3a48cd789 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -222,6 +222,7 @@ public abstract class ChunkGenerator { @@ -222,6 +222,7 @@ public abstract class ChunkGenerator {

Datei anzeigen

@ -9,10 +9,10 @@ Also allow turning off treasure maps all together as they can eat up Map ID's
which are limited in quantity. which are limited in quantity.
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
index 9358498491cd25ef760527ebd83188b76f8458f1..73a222d91dab1d5d1390b018f9537624aaff0798 100644 index 914134d274c4a484c99bbe59521e30881c120799..a20c23db72f207b069f4ae0eb83ab6b6dca12072 100644
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java
@@ -1828,7 +1828,8 @@ public class VillagerTrades { @@ -1826,7 +1826,8 @@ public class VillagerTrades {
return null; return null;
} else { } else {
ServerLevel serverLevel = (ServerLevel)entity.level(); ServerLevel serverLevel = (ServerLevel)entity.level();
@ -23,11 +23,11 @@ index 9358498491cd25ef760527ebd83188b76f8458f1..73a222d91dab1d5d1390b018f9537624
ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true);
MapItem.renderBiomePreviewMap(serverLevel, itemStack); MapItem.renderBiomePreviewMap(serverLevel, itemStack);
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
index e7f2cc799e7c50a9525845347a3f235f7bfefe41..709bc6838d20c420c5a4b3a994a041e594bd6210 100644 index 4a4a692686159a295aeae94daa8e55bcaa503e0d..c30943031db0e72c8a412552d0706d4da9e9cebc 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java
@@ -84,8 +84,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { @@ -83,8 +83,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction {
Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); Vec3 vec3 = context.getOptionalParameter(LootContextParams.ORIGIN);
if (vec3 != null) { if (vec3 != null) {
ServerLevel serverLevel = context.getLevel(); ServerLevel serverLevel = context.getLevel();
+ // Paper start - Configurable cartographer treasure maps + // Paper start - Configurable cartographer treasure maps

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add API methods to control if armor stands can move
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index af954b2c0c7106a231fb15172da3fa8e1d281d56..dae6835696e90bc5a541cacd37ea7aa88c60f4f4 100644 index c3a4b967a73a1a04192850a6880d42ebd22c2a14..aea97a30a9226275f8fbf9cb2c15d5ddf36371ac 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -95,6 +95,7 @@ public class ArmorStand extends LivingEntity { @@ -107,6 +107,7 @@ public class ArmorStand extends LivingEntity {
public Rotations rightArmPose; public Rotations rightArmPose;
public Rotations leftLegPose; public Rotations leftLegPose;
public Rotations rightLegPose; public Rotations rightLegPose;
@ -16,7 +16,7 @@ index af954b2c0c7106a231fb15172da3fa8e1d281d56..dae6835696e90bc5a541cacd37ea7aa8
public ArmorStand(EntityType<? extends ArmorStand> type, Level world) { public ArmorStand(EntityType<? extends ArmorStand> type, Level world) {
super(type, world); super(type, world);
@@ -949,4 +950,13 @@ public class ArmorStand extends LivingEntity { @@ -946,4 +947,13 @@ public class ArmorStand extends LivingEntity {
public boolean canBeSeenByAnyone() { public boolean canBeSeenByAnyone() {
return !this.isInvisible() && !this.isMarker(); return !this.isInvisible() && !this.isMarker();
} }
@ -31,12 +31,12 @@ index af954b2c0c7106a231fb15172da3fa8e1d281d56..dae6835696e90bc5a541cacd37ea7aa8
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 04a7735d278c9e610a33294e65a17796e120fe7e..52ffc401bbb9fa768534a4b871f9cc7dbebb8b20 100644 index 9ed8d228729d067f21f34224458d141988845348..56fcd9dd40e6a63e1af5fbd470ece0d6100292a2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -222,4 +222,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { @@ -222,4 +222,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) { public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
return (this.getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0; return (this.getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterBit(lockType.ordinal() * 8))) != 0;
} }
+ // Paper start + // Paper start
+ @Override + @Override

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] String based Action Bar API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cdcb2fb6229277872db36b6a4c439080f083f64c..258808bcb6f853c5679476305074823a7bb8b379 100644 index ca6194580c10cc864430b859a2c60d0b2e6a9a16..5085da38a278d8f978e19a5b8df7a8e3d087d753 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -390,6 +390,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -391,6 +391,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper start // Paper start

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 984dc7f7f7315b8a8cdb9744ef8454a330888ba7..f067b10e13f01e751fc4ebf088740c7d40afcb99 100644 index 78e4f07019e3231fbaa3f23bcdc8846e2d79ae18..5890aa22912eed9d645393f5a7189d6884fb2c66 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2627,7 +2627,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2982,7 +2982,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override @Override
public boolean isImmobile() { public boolean isImmobile() {
@ -19,10 +19,10 @@ index 984dc7f7f7315b8a8cdb9744ef8454a330888ba7..f067b10e13f01e751fc4ebf088740c7d
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 9bfdcdf427f7c0689d346d17942b5902a9138a4e..5f3b3f03936cfe23ed792c57d342a9932ea2e962 100644 index d4527831f66bf1c55e6273c7f8923d6efbbf100f..04ada45eabd5a6c752c320cdff1a65c7ac83eb22 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -184,7 +184,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -191,7 +191,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
public final boolean isDisconnected() { public final boolean isDisconnected() {

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Firework API's
public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index cc99d67bc52c89b50171b6c808c6e3bf293999f5..09d465947a5720e05c350d455c86002682104079 100644 index e5d245c71ce2b2a1fe7f156e69831dec73354221..8a4e7e1c0c4919d2ee34121c14f9665b9ad95273 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -44,6 +44,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -45,6 +45,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public int lifetime; public int lifetime;
@Nullable @Nullable
public LivingEntity attachedToEntity; public LivingEntity attachedToEntity;
@ -18,7 +18,7 @@ index cc99d67bc52c89b50171b6c808c6e3bf293999f5..09d465947a5720e05c350d455c860026
public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) { public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) {
super(type, world); super(type, world);
@@ -301,6 +302,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -324,6 +325,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
nbt.putInt("LifeTime", this.lifetime); nbt.putInt("LifeTime", this.lifetime);
nbt.put("FireworksItem", this.getItem().save(this.registryAccess())); nbt.put("FireworksItem", this.getItem().save(this.registryAccess()));
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE)); nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
@ -30,7 +30,7 @@ index cc99d67bc52c89b50171b6c808c6e3bf293999f5..09d465947a5720e05c350d455c860026
} }
@Override @Override
@@ -317,7 +323,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -340,7 +346,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
if (nbt.contains("ShotAtAngle")) { if (nbt.contains("ShotAtAngle")) {
this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle")); this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle"));
} }
@ -44,10 +44,10 @@ index cc99d67bc52c89b50171b6c808c6e3bf293999f5..09d465947a5720e05c350d455c860026
private List<FireworkExplosion> getExplosions() { private List<FireworkExplosion> getExplosions() {
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index 99a39f05e7aeefa2ea4372159b4837d80963eabf..f64cdfac1fc1333845ea4ea5efb7922f0ae39619 100644 index 40cae3332a18e3f7be890d2ba8014bfe3d2d1c0e..710181cf04563f06690eee5b46a5a0d84844ac29 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -160,7 +160,11 @@ public class CrossbowItem extends ProjectileWeaponItem { @@ -163,7 +163,11 @@ public class CrossbowItem extends ProjectileWeaponItem {
@Override @Override
protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) { protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) {
if (projectileStack.is(Items.FIREWORK_ROCKET)) { if (projectileStack.is(Items.FIREWORK_ROCKET)) {
@ -61,25 +61,27 @@ index 99a39f05e7aeefa2ea4372159b4837d80963eabf..f64cdfac1fc1333845ea4ea5efb7922f
Projectile projectile = super.createProjectile(world, shooter, weaponStack, projectileStack, critical); Projectile projectile = super.createProjectile(world, shooter, weaponStack, projectileStack, critical);
if (projectile instanceof AbstractArrow abstractArrow) { if (projectile instanceof AbstractArrow abstractArrow) {
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
index da89ccaf91e2baa7caa15681c113bc283f40cd21..38b33eb92d21d0099285a304c6e064bbf56db4eb 100644 index 100a66b9211429b5c32f9ed226c7ddafb9c7df81..3929cb76f1c98c0a22eb2ab64c2ed09805ffe448 100644
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
@@ -42,6 +42,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem { @@ -43,7 +43,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
vec3.z + (double)direction.getStepZ() * 0.15, itemStack
itemStack ),
serverLevel,
- itemStack
+ itemStack, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
); );
+ fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper
level.addFreshEntity(fireworkRocketEntity);
itemStack.shrink(1); itemStack.shrink(1);
} }
@@ -55,6 +56,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem { @@ -56,7 +56,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
if (user.isFallFlying()) {
ItemStack itemStack = user.getItemInHand(hand); ItemStack itemStack = user.getItemInHand(hand);
if (!world.isClientSide) { if (world instanceof ServerLevel serverLevel) {
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); - Projectile.spawnProjectile(new FireworkRocketEntity(world, itemStack, user), serverLevel, itemStack);
+ fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper + Projectile.spawnProjectile(new FireworkRocketEntity(world, itemStack, user), serverLevel, itemStack, f -> f.spawningEntity = user.getUUID()); // Paper - firework api - assign spawning entity uuid
world.addFreshEntity(fireworkRocketEntity);
itemStack.consume(1, user); itemStack.consume(1, user);
user.awardStat(Stats.ITEM_USED.get(this)); user.awardStat(Stats.ITEM_USED.get(this));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 5ae87c370e47c545cef27a36e40da137e1ec656b..c9e15a9d82dee935293b2e7e233f5b9b2d822448 100644 index 5ae87c370e47c545cef27a36e40da137e1ec656b..c9e15a9d82dee935293b2e7e233f5b9b2d822448 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java

Datei anzeigen

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Sun, 16 Oct 2016 23:19:30 -0700
Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 63c10be6eacd7108b8b4795d76bf624e0614440a..243eb1e54293c763a06febff551c051398d43535 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -846,10 +846,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public void thunderHit(ServerLevel world, LightningBolt lightning) {
if (world.getDifficulty() != Difficulty.PEACEFUL) {
- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
+ // Paper - Add EntityZapEvent; move log down, event can cancel
Witch entitywitch = (Witch) EntityType.WITCH.create(world);
if (entitywitch != null) {
+ // Paper start - Add EntityZapEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) {
+ return;
+ }
+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Move down
+ // Paper end - Add EntityZapEvent
+
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null);
entitywitch.setNoAi(this.isNoAi());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 96e0fc5c8a018fd579f24529175decdac634cfa1..50f33c6029c190f947b6bf6215004416b034c0cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1217,6 +1217,14 @@ public class CraftEventFactory {
return !event.isCancelled();
}
+ // Paper start
+ public static com.destroystokyo.paper.event.entity.EntityZapEvent callEntityZapEvent(Entity entity, Entity lightning, Entity changedEntity) {
+ com.destroystokyo.paper.event.entity.EntityZapEvent event = new com.destroystokyo.paper.event.entity.EntityZapEvent(entity.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), changedEntity.getBukkitEntity());
+ entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
+ return event;
+ }
+ // Paper end
+
public static boolean callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock) {
return CraftEventFactory.callEntityChangeBlockEvent(entity, position, newBlock, false);
}