[ci skip] Add more identifying patch comments, merge related patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-19 13:22:30 +01:00
Ursprung cc693ce82b
Commit eeb6afc435
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
441 geänderte Dateien mit 401 neuen und 449 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 29 Jan 2021 15:13:11 +0100
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
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..764a5dd85e3fb581b1e713ce9b148be1874d55be 100644
index d330b6d291cd2967358e892ccbc480bb3bd8022d..f9743f8705a7f5f3ede4c869070d5735e24348a0 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 {
@ -48,7 +48,7 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..764a5dd85e3fb581b1e713ce9b148be1
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return flag1; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
}
@ -62,7 +62,7 @@ index d330b6d291cd2967358e892ccbc480bb3bd8022d..764a5dd85e3fb581b1e713ce9b148be1
- this.dropLeash(true, false);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
this.getAllSlots().forEach((itemstack) -> {

Datei anzeigen

@ -9,7 +9,7 @@ public net.minecraft.world.item.enchantment.Enchantment slots
Co-authored-by: Luis <luisc99@icloud.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index 92922e8eef7fa4638a01f3cefc4c46a1451e40e7..4daf2c54c7127e8e091ffc49362f288594956143 100644
index 92922e8eef7fa4638a01f3cefc4c46a1451e40e7..92465b2a9f1483be76004c9f80a1fe15913b3b8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -90,7 +90,7 @@ public class CraftEnchantment extends Enchantment {
@ -17,7 +17,7 @@ index 92922e8eef7fa4638a01f3cefc4c46a1451e40e7..4daf2c54c7127e8e091ffc49362f2885
@Override
public boolean isCursed() {
- return this.handle instanceof BindingCurseEnchantment || this.handle instanceof VanishingCurseEnchantment;
+ return this.handle.isCurse(); // Paper
+ return this.handle.isCurse(); // Paper - More Enchantment API
}
@Override

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Move range check for block placing up
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4ea889c12a6750914b82d796ed641cdd810ea957..4d3452fb5cf9330e87d914f775c1a8e0c955a571 100644
index 4ea889c12a6750914b82d796ed641cdd810ea957..8d6254c7f63bae10d3e09771d484ee9e44c2c3de 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1743,6 +1743,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -16,7 +16,7 @@ index 4ea889c12a6750914b82d796ed641cdd810ea957..4d3452fb5cf9330e87d914f775c1a8e0
+ if (!Double.isFinite(vec3d.x) || !Double.isFinite(vec3d.y) || !Double.isFinite(vec3d.z)) {
+ return;
+ }
+ // Paper end
+ // Paper end - improve distance check
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Vec3 vec3d1 = Vec3.atCenterOf(blockposition);

Datei anzeigen

@ -267,7 +267,7 @@ index 415d55285bb02442d8d1ec907d37b07fad4f3fcc..9b0bbaf23b90a04b6e6f6c97d9174fe3
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fbfe5d18a004225396f2d33084fb5073af2d9731..2acd875f34c367f9b9db85dee5052140c05d0add 100644
index fbfe5d18a004225396f2d33084fb5073af2d9731..7bfd8307555a9447d4c546a8945341806041cc32 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -586,11 +586,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -279,7 +279,7 @@ index fbfe5d18a004225396f2d33084fb5073af2d9731..2acd875f34c367f9b9db85dee5052140
- return true;
- }, dimensions);
- }
+ // Paper - move down
+ // Paper - fix and optimise world upgrading; move down
PrimaryLevelData iworlddataserver = worlddata;
boolean flag = worlddata.isDebugWorld();
@ -352,7 +352,7 @@ index deed4d50e0e4d810647a0745ef328c20dfe51093..9fa07295bf73317a4c2bbbbaf1918393
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..9c82a367ceacb1d2ae1a0503f5920d5919289502 100644
index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..b28212bbf7678d73282d160bfeb0d246e93a8492 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1251,9 +1251,7 @@ public final class CraftServer implements Server {
@ -362,7 +362,7 @@ index 565beb65968b3f7e187f3e5b59aa08e9ac34f2a0..9c82a367ceacb1d2ae1a0503f5920d59
- if (this.console.options.has("forceUpgrade")) {
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistry);
- }
+ // Paper - move down
+ // Paper - fix and optimise world upgrading; move down
long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));

Datei anzeigen

@ -3,15 +3,9 @@ From: Andrew Steinborn <git@steinborn.me>
Date: Tue, 11 May 2021 17:39:22 -0400
Subject: [PATCH] Add Unix domain socket support
For Windows and ARM support, JEP-380 is required:
https://inside.java/2021/02/03/jep380-unix-domain-sockets-channels/
This will be possible as of the Minecraft 1.17 Java version bump.
Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac0298bf33 100644
index 019dd5a66b883e6ac8d0f07abc2636768a373664..bc157cd71bb6dbc109990533f622f78bcc103918 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -219,6 +219,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -41,7 +35,7 @@ index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac
}
+ bindAddress = new java.net.InetSocketAddress(inetaddress, this.getPort());
+ }
+ // Paper end
+ // Paper end - Unix domain socket support
this.initializeKeyPair();
DedicatedServer.LOGGER.info("Starting Minecraft server on {}:{}", this.getLocalIp().isEmpty() ? "*" : this.getLocalIp(), this.getPort());
@ -53,19 +47,19 @@ index 019dd5a66b883e6ac8d0f07abc2636768a373664..f0d6e6f85dc2a9ae8d70dd691b144fac
DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString());
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfccfdb95f2 100644
index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..4bbb370c5d26749c566216bac079a0cb6d0b4507 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -78,7 +78,12 @@ public class ServerConnectionListener {
this.running = true;
}
+ // Paper start
+ // Paper start - Unix domain socket support
public void startTcpServerListener(@Nullable InetAddress address, int port) throws IOException {
+ bind(new java.net.InetSocketAddress(address, port));
+ }
+ public void bind(java.net.SocketAddress address) throws IOException {
+ // Paper end
+ // Paper end - Unix domain socket support
List list = this.channels;
synchronized (this.channels) {
@ -73,13 +67,13 @@ index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfc
EventLoopGroup eventloopgroup;
if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
+ // Paper start
+ // Paper start - Unix domain socket support
+ if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
+ oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class;
+ } else {
oclass = EpollServerSocketChannel.class;
+ }
+ // Paper end
+ // Paper end - Unix domain socket support
eventloopgroup = (EventLoopGroup) ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP.get();
ServerConnectionListener.LOGGER.info("Using epoll channel type");
} else {
@ -88,35 +82,35 @@ index 6641fd04821240b1bbeff1bd8d996a8f2fff8385..5f625acf04ddb56e3596d086252f9bfc
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper
}
- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper - Unix domain socket support
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4d3452fb5cf9330e87d914f775c1a8e0c955a571..4d23d019173d0921145338544e190bc34f9f45c2 100644
index 8d6254c7f63bae10d3e09771d484ee9e44c2c3de..73b825b16f02e254a1e2313ff1c93c642c5dceeb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2476,6 +2476,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
public SocketAddress getRawAddress()
{
+ // Paper start - this can be nullable in the case of a Unix domain socket, so if it is, fake something
+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
+ if (connection.channel.remoteAddress() == null) {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
+ }
+ // Paper end
+ // Paper end - Unix domain socket support
return this.connection.channel.remoteAddress();
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884f37e387b 100644
index 3068e25f2df958689627fb31783a2d356547f1be..f1a002ddfa55ba3bf4313639d0e82f0c8b036c65 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -45,6 +45,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN);
// CraftBukkit start - Connection throttle
try {
+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - the connection throttle is useless when you have a Unix domain socket
+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - Unix domain socket support; the connection throttle is useless when you have a Unix domain socket
long currentTime = System.currentTimeMillis();
long connectionThrottle = this.server.server.getConnectionThrottle();
InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
@ -124,7 +118,7 @@ index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884
}
}
}
+ } // Paper - add closing bracket for if check above
+ } // Paper - Unix domain socket support
} catch (Throwable t) {
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
}
@ -137,7 +131,7 @@ index 3068e25f2df958689627fb31783a2d356547f1be..d2edc000f34d7f07a840bb8012c6f884
this.connection.hostname = split[0];
- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
+ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
+ // Paper end
+ // Paper end - Unix domain socket support
this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
} else
{

Datei anzeigen

@ -5,278 +5,278 @@ Subject: [PATCH] Add EntityInsideBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index 0e56fbe8836020a0e36c0b6df01ae82d0aa8cf38..02cbb25b8b1fdaf6e2b771067ca132245eab13dc 100644
index 0e56fbe8836020a0e36c0b6df01ae82d0aa8cf38..450f87ea7f4c5ef3b26a3c75bc7c8bd08a982075 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -124,6 +124,7 @@ public abstract class BaseFireBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
index 040e55edea53a2ebab7cc8fe6f85206c9301e11a..e074c126cd3117dc3233f39913b94b3e3fd94973 100644
index 040e55edea53a2ebab7cc8fe6f85206c9301e11a..0d573c05f4f8838d4492f749ca473f7a9e8d60dd 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -76,6 +76,7 @@ public abstract class BasePressurePlateBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
int i = this.getSignalForState(state);
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
index 546dbe28edbba32ab2aede1260fbd2c9baa9fe1a..8e4a6a1188b2ce2825dc5750505212c72efb5c7b 100644
index 546dbe28edbba32ab2aede1260fbd2c9baa9fe1a..0d92bd6f1e4f3470a62f573add3490220e60ef7a 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -177,6 +177,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index 240e01063b5d684020ed2d7d73fc60c64fd8cf2e..115506fceb9a406e844880fb523d2ff09a66cf7b 100644
index 240e01063b5d684020ed2d7d73fc60c64fd8cf2e..78d98a442ea3c14500ac6ae597ff2a5080b7ce15 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -47,6 +47,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
BlockState blockState = world.getBlockState(pos.above());
if (blockState.isAir()) {
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
index 3356f327c9adae6c2f3354b4417f3954012c945a..c6e13cc12ec8817870eb55a82ceb6f1ef77e2d9a 100644
index 3356f327c9adae6c2f3354b4417f3954012c945a..0118c4ef4f5ed0e724b379b5a563e2b6976803a2 100644
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
@@ -206,6 +206,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) {
this.checkPressed(state, world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
index 3c7bbfcb3a88f23056cd0db3da2a281a81dc8c85..a9629a102c4fa4e5720e63fcf4590e9231426c62 100644
index 3c7bbfcb3a88f23056cd0db3da2a281a81dc8c85..88ca50038b483fe5c207ef5c2bf3ea87540e147e 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -121,6 +121,7 @@ public class CactusBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
CraftEventFactory.blockDamage = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // CraftBukkit
entity.hurt(world.damageSources().cactus(), 1.0F);
CraftEventFactory.blockDamage = null; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index cbabee578a6fd62234d0aa350d911c6c7d02e0b2..7302d07c6ff69608e75ac52fdb19f2ec1d105129 100644
index cbabee578a6fd62234d0aa350d911c6c7d02e0b2..20dbfeb68ac33ee8ba8214edcca0d7f7ce1be58e 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -108,6 +108,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, pos); // CraftBukkit
entity.hurt(world.damageSources().inFire(), (float) this.fireDamage);
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index a7809bb2a468c7ad7ef7ba795afd93dd2a63cadc..76c12b34aac276fc9375135dac1c2018fdd7d756 100644
index a7809bb2a468c7ad7ef7ba795afd93dd2a63cadc..aa029bee9839497e48ff639e286a024280150362 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -174,6 +174,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 8eff69cb70ba094f9dcc0849f0436d4a3498fceb..034a3bc5b5e526e28088a9715a41ad8ab843860b 100644
index 8eff69cb70ba094f9dcc0849f0436d4a3498fceb..9de6503f20396601a270e6eb0b66c40187fca690 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -51,6 +51,7 @@ public class DetectorRailBlock extends BaseRailBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
this.checkPressed(world, pos, state);
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 07629f6106f384751c376d2a99ba2e8b905e49c6..c8f1bdbfcb2df3d4be05d185e97857a6181b076e 100644
index 07629f6106f384751c376d2a99ba2e8b905e49c6..9ee2fd0914ff7836517ca143d51db6150967cb0e 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -52,6 +52,7 @@ public class EndPortalBlock extends BaseEntityBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (world instanceof ServerLevel && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey);
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..a4ca58384ae2a39ec568b153cc1a4f7704136108 100644
index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..68978e1629381ada161225c53a236a54deae6481 100644
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
@@ -78,6 +78,7 @@ public class FrogspawnBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.getType().equals(EntityType.FALLING_BLOCK)) {
this.destroyBlock(world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
index 8b84359316e559b94ae6a2d757bda2286d99a903..b9d89cce40e4cbeaf98eeb85c254db353e573c95 100644
index 8b84359316e559b94ae6a2d757bda2286d99a903..39e2fe8c5f5a2a4d4f3a7be3645923b5a1dca875 100644
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
@@ -61,6 +61,7 @@ public class HoneyBlock extends HalfTransparentBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (this.isSlidingDown(pos, entity)) {
this.maybeDoSlideAchievement(entity, pos);
this.doSlideMovement(entity);
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..5012de7e58092a11f8022a1aa33986604da840b3 100644
index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..04e69d6066faf1c605aeeabe827dc20fc96a3568 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof HopperBlockEntity) {
HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity);
diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
index 7e926a4546f89da22080ef28c3858ac7b3cf80f1..bc099abfda6555cade0a83eddfe1be9c243fa83b 100644
index 7e926a4546f89da22080ef28c3858ac7b3cf80f1..29d4553df54236706c76fdec0bb14b5d9fb82ff2 100644
--- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
@@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (this.isEntityInsideContent(state, pos, entity)) {
entity.lavaHurt();
}
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 64247c3a81273277b95656885c78eca3e883ef13..a8b2c49ebf531d730d681ca3bceb4dc74b433fdb 100644
index 64247c3a81273277b95656885c78eca3e883ef13..18ca086e28f4295cb9303919222d7c8ae0ca5d9a 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -65,6 +65,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
// CraftBukkit start
if (entity.mayInteract(world, pos)) {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index 4e52e92846428b0d01635b90f3480b4a2c13a0b4..ee998d06804e344ea9d5b84ef0074b84aaba04c2 100644
index 4e52e92846428b0d01635b90f3480b4a2c13a0b4..e6b762c70cbc08b20fc225b7731abd19c626369c 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -90,6 +90,7 @@ public class NetherPortalBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity.canChangeDimensions()) {
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
index f7154d56ad42e0dde497e0e585cc554d34865e3b..c80a3ee02f3af146926a3611779fd0af298a8ac1 100644
index f7154d56ad42e0dde497e0e585cc554d34865e3b..690abba9d27ab4061de4dd3676292b1859036868 100644
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
@@ -94,6 +94,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity instanceof Ravager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
index b38658b84e821435ba5a3fc7218b72406da00e47..f579911b06b66e94e6311d970e93cca33fa089c6 100644
index b38658b84e821435ba5a3fc7218b72406da00e47..0dfcac8cfcbb09fe04486bff60119f7985714454 100644
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -63,6 +63,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is((Block) this)) {
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
index c733b9dc26370322e404b56ac3feb3417948cb90..f474ae7b3121de701f371b7d88e80086ec07d03d 100644
index c733b9dc26370322e404b56ac3feb3417948cb90..6c1ed9d37adb97b47f0288a5986b805ee0e13842 100644
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
@@ -84,6 +84,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) {
entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index d092ee2aa4a37c89642133dca7049737c55a4245..bbb7d1b03c78758d608e89129aacec151242831c 100644
index d092ee2aa4a37c89642133dca7049737c55a4245..003fd247b12323cca5fd82a6cdf31bd897afd682 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -134,6 +134,7 @@ public class TripWireBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
this.checkPressed(world, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
index d89a4c30599cedcb8ce17899631cb58c8a6a2195..c01cc63497917b0c5d95424c060c69f3693fc871 100644
index d89a4c30599cedcb8ce17899631cb58c8a6a2195..61abbcfe97e3d3e3da5ee658672549d14594ad17 100644
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
@@ -34,6 +34,7 @@ public class WaterlilyBlock extends BushBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
super.entityInside(state, world, pos, entity);
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (world instanceof ServerLevel && entity instanceof Boat) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..edf00a8c3747d0c5ac8001c70846475800fa6a84 100644
index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..4905de6446f07e2fff53a3c8580b64b96306c373 100644
--- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java
@@ -22,6 +22,7 @@ public class WebBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
entity.makeStuckInBlock(state, new Vec3(0.25D, (double)0.05F, 0.25D));
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
index c10a01013f8393c677834136babed15817b45611..8f6139d8b1fbe45b9330961ccfbe9413f9f5f225 100644
index c10a01013f8393c677834136babed15817b45611..a49027c73ca461e0610914138cc660c89965f956 100644
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
@@ -61,6 +61,7 @@ public class WitherRoseBlock extends FlowerBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide && world.getDifficulty() != Difficulty.PEACEFUL) {
if (entity instanceof LivingEntity) {
LivingEntity entityliving = (LivingEntity) entity;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..8b2f72be4304ebab84fc46e6c4c0984abd8e8905 100644
index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..b858ee2fc8c03c52a6b6d703b1f770b3c496b2a8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -672,8 +672,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -14,8 +14,8 @@ index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..8b2f72be4304ebab84fc46e6c4c0984a
this.serverLevelData.setThunderTime(rainDuration);
- this.serverLevelData.setRaining(raining);
- this.serverLevelData.setThundering(thundering);
+ this.serverLevelData.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.COMMAND); // Paper
+ this.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.COMMAND); // Paper
+ this.serverLevelData.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.COMMAND); // Paper - Add cause to Weather/ThunderChangeEvents
+ this.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.COMMAND); // Paper - Add cause to Weather/ThunderChangeEvents
}
@Override
@ -25,8 +25,8 @@ index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..8b2f72be4304ebab84fc46e6c4c0984a
this.serverLevelData.setClearWeatherTime(i);
- this.serverLevelData.setThundering(flag1);
- this.serverLevelData.setRaining(flag2);
+ this.serverLevelData.setThundering(flag1, org.bukkit.event.weather.ThunderChangeEvent.Cause.NATURAL); // Paper
+ this.serverLevelData.setRaining(flag2, org.bukkit.event.weather.WeatherChangeEvent.Cause.NATURAL); // Paper
+ this.serverLevelData.setThundering(flag1, org.bukkit.event.weather.ThunderChangeEvent.Cause.NATURAL); // Paper - Add cause to Weather/ThunderChangeEvents
+ this.serverLevelData.setRaining(flag2, org.bukkit.event.weather.WeatherChangeEvent.Cause.NATURAL); // Paper - Add cause to Weather/ThunderChangeEvents
}
this.oThunderLevel = this.thunderLevel;
@ -35,7 +35,7 @@ index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..8b2f72be4304ebab84fc46e6c4c0984a
public void resetWeatherCycle() {
// CraftBukkit start
- this.serverLevelData.setRaining(false);
+ this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night
+ this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
if (!this.serverLevelData.isRaining()) {
@ -43,23 +43,23 @@ index a3288d3cd160978e8bab4ca34d1fe6dbee042e28..8b2f72be4304ebab84fc46e6c4c0984a
}
// CraftBukkit end
- this.serverLevelData.setThundering(false);
+ this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night
+ this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..47266d2b86e7f2022de7ea0c9347b4f55ad6fbe1 100644
index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..59ba982dc96ce47e47399514e8f74d2b972dbe1e 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -373,6 +373,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setThundering(boolean thundering) {
+ // Paper start
+ // Paper start - Add cause to Weather/ThunderChangeEvents
+ this.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.UNKNOWN);
+ }
+ public void setThundering(boolean thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause cause) {
+ // Paper end
+ // Paper end - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
if (this.thundering == thundering) {
return;
@ -68,7 +68,7 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..47266d2b86e7f2022de7ea0c9347b4f5
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
- ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering);
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering, cause); // Paper
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering, cause); // Paper - Add cause to Weather/ThunderChangeEvents
Bukkit.getServer().getPluginManager().callEvent(thunder);
if (thunder.isCancelled()) {
return;
@ -76,12 +76,12 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..47266d2b86e7f2022de7ea0c9347b4f5
@Override
public void setRaining(boolean raining) {
+ // Paper start
+ // Paper start - Add cause to Weather/ThunderChangeEvents
+ this.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.UNKNOWN);
+ }
+
+ public void setRaining(boolean raining, org.bukkit.event.weather.WeatherChangeEvent.Cause cause) {
+ // Paper end
+ // Paper end - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
if (this.raining == raining) {
return;
@ -90,12 +90,12 @@ index f5ac36fa54f3d3b39de103c95abb9ca3adfe8dda..47266d2b86e7f2022de7ea0c9347b4f5
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
- WeatherChangeEvent weather = new WeatherChangeEvent(world, raining);
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining, cause); // Paper
+ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining, cause); // Paper - Add cause to Weather/ThunderChangeEvents
Bukkit.getServer().getPluginManager().callEvent(weather);
if (weather.isCancelled()) {
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 43d3c45cd7a178a4ca30e4c0c7fb1e7e21cd89f1..e88b42727ba0b87ba01933116b6ef456203d9dbb 100644
index 43d3c45cd7a178a4ca30e4c0c7fb1e7e21cd89f1..c0d02f7d714f7116b34b5a735b5520cf3a5a4587 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1243,7 +1243,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -103,7 +103,7 @@ index 43d3c45cd7a178a4ca30e4c0c7fb1e7e21cd89f1..e88b42727ba0b87ba01933116b6ef456
@Override
public void setStorm(boolean hasStorm) {
- this.world.levelData.setRaining(hasStorm);
+ this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper
+ this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@ -112,7 +112,7 @@ index 43d3c45cd7a178a4ca30e4c0c7fb1e7e21cd89f1..e88b42727ba0b87ba01933116b6ef456
@Override
public void setThundering(boolean thundering) {
- this.world.serverLevelData.setThundering(thundering);
+ this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper
+ this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}

Datei anzeigen

@ -5,17 +5,17 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 5992f450f01349ce49286c34b8af56737de01a45..e4c4948e076cd64686dfd16ae0568fafc1437140 100644
index 5992f450f01349ce49286c34b8af56737de01a45..45269115e63cfc3bd7dc740a5694e2cc7c35bcb1 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -302,8 +302,10 @@ public class MapItemSavedData extends SavedData {
MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
+ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper
+ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps
this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1);
+ } // Paper
+ } // Paper - Limit item frame cursors on maps
}
CompoundTag nbttagcompound = stack.getTag();
@ -24,7 +24,7 @@ index 5992f450f01349ce49286c34b8af56737de01a45..e4c4948e076cd64686dfd16ae0568faf
}
- if (!this.isTrackedCountOverLimit(256)) {
+ if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper
+ if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper - Limit item frame cursors on maps
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, mapiconbanner.getName());
return true;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..22ead092ae984d1eaa052fe97981ce3c49b521d8 100644
index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92be5eb172 100644
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
@@ -35,16 +35,16 @@ public class SignedMessageChain {
@ -33,22 +33,22 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..22ead092ae984d1eaa052fe97981ce3c
public static class DecodeException extends ThrowingComponent {
private final boolean shouldDisconnect;
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper - kick event causes
public DecodeException(Component message, boolean shouldDisconnect) {
+ // Paper start
+ // Paper start - kick event causes
+ this(message, shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+ public DecodeException(Component message, boolean shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) {
+ // Paper end
+ // Paper end - kick event causes
super(message);
this.shouldDisconnect = shouldDisconnect;
+ this.kickCause = kickCause; // Paper
+ this.kickCause = kickCause; // Paper - kick event causes
}
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2acd875f34c367f9b9db85dee5052140c05d0add..26f4516f20336ddfaf868337cab3a05166f01b8d 100644
index 7bfd8307555a9447d4c546a8945341806041cc32..970dafebf8143ab6de44bfffdeff2475685f99fa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -209,7 +209,7 @@ index 0616a8e89931680602da2dbc640906708aebd5ca..70458ff8c9bf6f3263868b0f5570840f
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4d23d019173d0921145338544e190bc34f9f45c2..1a85755ad62498c263783d1d54130d023105ec8d 100644
index 73b825b16f02e254a1e2313ff1c93c642c5dceeb..005116339cce73b555415f8deb0e1333f0a2a4bd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..277555a26e8281dd1a626e572794b08cf51d00c5 100644
index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..4b9e726e6ac255e743479d5c2e0cdb98464399a4 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -39,6 +39,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
+ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
+ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper - Fix PlayerBucketEmptyEvent result itemstack
+
public final Fluid content;
@ -22,13 +22,13 @@ index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..277555a26e8281dd1a626e572794b08c
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
+ // Paper start
+ // Paper start - Fix PlayerBucketEmptyEvent result itemstack
+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
+ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
+ return itemInHand;
+ }
+ // Paper end
+ // Paper end - Fix PlayerBucketEmptyEvent result itemstack
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
}
@ -36,7 +36,7 @@ index e0ca5316fb66ed94f1c5cf541d096d1cb8774196..277555a26e8281dd1a626e572794b08c
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - fix empty event result itemstack
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - Fix PlayerBucketEmptyEvent result itemstack
}
// CraftBukkit end
if (!flag2) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add BellRevealRaiderEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
index b446d6549922f3dabaaa05793d8ee3eb45566ac3..f07222c8c9c82478d492b0916cd394be1ab0c804 100644
index b446d6549922f3dabaaa05793d8ee3eb45566ac3..f692421ae50c07ffdcdd521b328ad950bdfaccb2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -156,7 +156,7 @@ public class BellBlockEntity extends BlockEntity {
@ -13,7 +13,7 @@ index b446d6549922f3dabaaa05793d8ee3eb45566ac3..f07222c8c9c82478d492b0916cd394be
}).map((entity) -> (org.bukkit.entity.LivingEntity) entity.getBukkitEntity()).collect(java.util.stream.Collectors.toCollection(java.util.ArrayList::new)); // CraftBukkit
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(BellBlockEntity::glow);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(entity -> glow(entity, pos)); // Paper - Add BellRevealRaiderEvent
// CraftBukkit end
}
@ -22,11 +22,11 @@ index b446d6549922f3dabaaa05793d8ee3eb45566ac3..f07222c8c9c82478d492b0916cd394be
}
- private static void glow(LivingEntity entity) {
+ // Paper start
+ // Paper start - Add BellRevealRaiderEvent
+ private static void glow(LivingEntity entity) { glow(entity, null); }
+ private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) {
+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level().getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level(), pos)), entity.getBukkitEntity()).callEvent()) return;
+ // Paper end
+ // Paper end - Add BellRevealRaiderEvent
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index cc3f1532a2108ea915d0e8c840e87bc56ab60a65..ffc5b68c4246a7111845230a75552bb15875a209 100644
index cc3f1532a2108ea915d0e8c840e87bc56ab60a65..c99ab157e43fc990549fc06f5b6fb1e227014fde 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -29,6 +29,7 @@ public class EndCrystal extends Entity {
@ -31,7 +31,7 @@ index cc3f1532a2108ea915d0e8c840e87bc56ab60a65..ffc5b68c4246a7111845230a75552bb1
+ this.setBeamTarget(null);
+ }
+ }
+ // Paper end
+ // Paper end - Fix invulnerable end crystals
}
}
@ -52,14 +52,14 @@ index cc3f1532a2108ea915d0e8c840e87bc56ab60a65..ffc5b68c4246a7111845230a75552bb1
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
index 4b685e185ebac8553f1f81d1a5a04be8166a6ca4..dbd1e440ced5d23f2f813b12808f9400a49c3f8f 100644
index 4b685e185ebac8553f1f81d1a5a04be8166a6ca4..3b36caafde83c87c823277e2085ee82ae497b9be 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
@@ -101,6 +101,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
endCrystal.setBeamTarget(config.getCrystalBeamTarget());
endCrystal.setInvulnerable(config.isCrystalInvulnerable());
endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F);
+ endCrystal.generatedByDragonFight = true; // Paper
+ endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals
world.addFreshEntity(endCrystal);
BlockPos blockPos2 = endCrystal.blockPosition();
this.setBlock(world, blockPos2.below(), Blocks.BEDROCK.defaultBlockState());

Datei anzeigen

@ -5,36 +5,36 @@ Subject: [PATCH] Add ElderGuardianAppearanceEvent
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
index fd803cbdad0e75f43279c5d5049b0152c2d013c3..2902a06b06bedf4fba42ac37a5371b0b353e0e98 100644
index fd803cbdad0e75f43279c5d5049b0152c2d013c3..fcc60a419c6dade50848d4c1e6e8daf0d3095d70 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
@@ -54,10 +54,23 @@ public final class MobEffectUtil {
}
public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
+ // Paper start
+ // Paper start - Add ElderGuardianAppearanceEvent
+ return addEffectToPlayersAround(worldserver, entity, vec3d, d0, mobeffect, i, cause, null);
+ }
+
+ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate<ServerPlayer> playerPredicate) {
+ // Paper end
+ // Paper end - Add ElderGuardianAppearanceEvent
// CraftBukkit end
MobEffect mobeffectlist = mobeffect.getEffect();
List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
+ // Paper start
+ // Paper start - Add ElderGuardianAppearanceEvent
+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
+ if (condition) {
+ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true
+ } else {
+ return false;
+ }
+ // Paper ned
+ // Paper ned - Add ElderGuardianAppearanceEvent
});
list.forEach((entityplayer) -> {
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 1dfdb378a2491b0ae64a4152e4cd8b539dfdf65b..efc1d49c5bfea7d1674b8a9de2c8b617657eda0f 100644
index 1dfdb378a2491b0ae64a4152e4cd8b539dfdf65b..6d4810626980ce46e02042a5660f615c58d0d5fd 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -70,7 +70,7 @@ public class ElderGuardian extends Guardian {
@ -42,7 +42,7 @@ index 1dfdb378a2491b0ae64a4152e4cd8b539dfdf65b..efc1d49c5bfea7d1674b8a9de2c8b617
if ((this.tickCount + this.getId()) % 1200 == 0) {
MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 6000, 2);
- List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK, (player) -> new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), player.getBukkitEntity()).callEvent()); // CraftBukkit // Paper
+ List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK, (player) -> new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), player.getBukkitEntity()).callEvent()); // CraftBukkit // Paper - Add ElderGuardianAppearanceEvent
list.forEach((entityplayer) -> {
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls.
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..9e2f7fc64b284efd6388be35f250642c47e7603b 100644
index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..b10dfbaef9bde9d94c4971b47d77a1514e476f86 100644
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
@@ -61,11 +61,43 @@ public class MobSpawnSettings {
@ -14,7 +14,7 @@ index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..9e2f7fc64b284efd6388be35f250642c
public static class Builder {
- private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = Stream.of(MobCategory.values()).collect(ImmutableMap.toImmutableMap((mobCategory) -> {
+ // Paper start - keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it
+ // Paper start - Perf: keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it
+ public static class MobList extends java.util.ArrayList<MobSpawnSettings.SpawnerData> {
+ java.util.Set<MobSpawnSettings.SpawnerData> biomes = new java.util.HashSet<>();
+
@ -51,7 +51,7 @@ index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..9e2f7fc64b284efd6388be35f250642c
- return Lists.newArrayList();
+ return new MobList(); // Use MobList instead of ArrayList
}));
+ // Paper end
+ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls
private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap();
private float creatureGenerationProbability = 0.1F;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 383c39ac381f9a86693abb7935b5b142b889d7be..ca6e0f27b9d0c5d867909abd89262132bf1aa6bd 100644
index 383c39ac381f9a86693abb7935b5b142b889d7be..e0524231da219dc4c7857ef7b39d4d018fa96ab2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3606,7 +3606,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -14,7 +14,7 @@ index 383c39ac381f9a86693abb7935b5b142b889d7be..ca6e0f27b9d0c5d867909abd89262132
- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
+ return vec3d1.distanceToSqr(vec3d) > 128.0D * 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
+ return vec3d1.distanceToSqr(vec3d) > 128.0D * 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper - Perf: Use distance squared
}
}

Datei anzeigen

@ -3,10 +3,9 @@ From: chase <chasewhip20@gmail.com>
Date: Wed, 2 Dec 2020 22:43:39 -0800
Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e88b42727ba0b87ba01933116b6ef456203d9dbb..a920936018a2e05ea72d68a83e6debb3807df353 100644
index c0d02f7d714f7116b34b5a735b5520cf3a5a4587..d6b402d0bae4d16932e059f1da59ac4523d974b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -215,6 +215,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -19,7 +18,7 @@ index e88b42727ba0b87ba01933116b6ef456203d9dbb..a920936018a2e05ea72d68a83e6debb3
+ setSpawnLimit(spawnCategory, this.world.paperConfig().entities.spawning.spawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory)));
+ }
+ }
+ // Paper end
+ // Paper end - per world spawn limits
}
@Override

Datei anzeigen

@ -8,18 +8,18 @@ Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6
Fix splash events cancellation that still show particles/sound
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c64d1316a 100644
index b87077c47a0131c5f4ca085b6b32e657043a9e1a..bb116b0c75a311d0dc65c032a7727598890ef942 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
@@ -105,56 +105,77 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
Potion potionregistry = PotionUtils.getPotion(itemstack);
List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
boolean flag = potionregistry == Potions.WATER && list.isEmpty();
+ boolean showParticles = true; // Paper
+ boolean showParticles = true; // Paper - Fix potions splash events
if (flag) {
- this.applyWater();
+ showParticles = this.applyWater(); // Paper
+ showParticles = this.applyWater(); // Paper - Fix potions splash events
} else if (true || !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
if (this.isLingering()) {
- this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition
@ -30,21 +30,21 @@ index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c
}
}
+ if (showParticles) { // Paper
+ if (showParticles) { // Paper - Fix potions splash events
int i = potionregistry.hasInstantEffects() ? 2007 : 2002;
this.level().levelEvent(i, this.blockPosition(), PotionUtils.getColor(itemstack));
+ } // Paper
+ } // Paper - Fix potions splash events
this.discard();
}
}
- private void applyWater() {
+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper
+ private boolean applyWater() { // Paper
+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper - Fix potions splash events
+ private boolean applyWater() { // Paper - Fix potions splash events
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
- List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
+ // Paper start
+ // Paper start - Fix potions splash events
+ List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.APPLY_WATER_GET_ENTITIES_PREDICATE);
+ Map<LivingEntity, Double> affected = new HashMap<>();
+ java.util.Set<LivingEntity> rehydrate = new java.util.HashSet<>();
@ -93,14 +93,14 @@ index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c
+ axolotl.rehydrate();
+ }
+ }
+ // Paper end
+ // Paper end - Fix potions splash events
}
+ return !event.isCancelled(); // Paper
+ return !event.isCancelled(); // Paper - Fix potions splash events
}
- private void applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
@ -116,7 +116,7 @@ index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c
}
}
}
+ return !event.isCancelled(); // Paper
+ return !event.isCancelled(); // Paper - Fix potions splash events
}
@ -129,12 +129,12 @@ index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c
entityareaeffectcloud.setPotion(potionregistry);
Iterator iterator = PotionUtils.getCustomEffects(itemstack).iterator();
+ boolean noEffects = potionregistry.getEffects().isEmpty(); // Paper
+ boolean noEffects = potionregistry.getEffects().isEmpty(); // Paper - Fix potions splash events
while (iterator.hasNext()) {
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
entityareaeffectcloud.addEffect(new MobEffectInstance(mobeffect));
+ noEffects = false; // Paper
+ noEffects = false; // Paper - Fix potions splash events
}
CompoundTag nbttagcompound = itemstack.getTag();
@ -149,7 +149,7 @@ index b87077c47a0131c5f4ca085b6b32e657043a9e1a..40307233e5bc67d538f580bc514a033c
entityareaeffectcloud.discard();
}
// CraftBukkit end
+ return !event.isCancelled(); // Paper
+ return !event.isCancelled(); // Paper - Fix potions splash events
}
public boolean isLingering() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8766c1a6485b371c1d95804d7ad364fd5ba826de..76eb668311d2aa2659adf4f7857a670d81387830 100644
index 8766c1a6485b371c1d95804d7ad364fd5ba826de..b5ee665fecb3e9e96cb937c92cef8579f9cbeb3d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2391,7 +2391,7 @@ public class ServerPlayer extends Player {
@ -13,7 +13,7 @@ index 8766c1a6485b371c1d95804d7ad364fd5ba826de..76eb668311d2aa2659adf4f7857a670d
if (retainOwnership) {
if (!itemstack1.isEmpty()) {
- this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), stack.getCount());
+ this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper
+ this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper - Fix PlayerDropItemEvent using wrong item
}
this.awardStat(Stats.DROP);

Datei anzeigen

@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8b2f72be4304ebab84fc46e6c4c0984abd8e8905..dbfd4a642e862f46a8b4fd1f3fc52c13ecf74284 100644
index b858ee2fc8c03c52a6b6d703b1f770b3c496b2a8..45d5e5bd1ed37c4a3a658b27dc8571344580b65b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -229,7 +229,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -16,30 +16,30 @@ index 8b2f72be4304ebab84fc46e6c4c0984abd8e8905..dbfd4a642e862f46a8b4fd1f3fc52c13
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
- return this.chunkSource.getChunk(x, z, false);
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 761d01c993b60a11c749e172c3ee3067c055b582..35ca44c88497e0b07f43ba7bf092360365b1c53a 100644
index 761d01c993b60a11c749e172c3ee3067c055b582..2069cad866a3fd2ed5512fa8fc6dc2ef8bc9758e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -204,6 +204,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return (CraftServer) Bukkit.getServer();
}
+ // Paper start
+ // Paper start - Use getChunkIfLoadedImmediately
+ @Override
+ public boolean hasChunk(int chunkX, int chunkZ) {
+ return this.getChunkIfLoaded(chunkX, chunkZ) != null;
+ }
+ // Paper end
+ // Paper end - Use getChunkIfLoadedImmediately
+
public abstract ResourceKey<LevelStem> getTypeKey();
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..744160405680babbb83c99abcbe2dc89bf312398 100644
index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..37ae0f928440af5b2fdfe68ad6c9c54e8c95c82c 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -55,7 +55,7 @@ public class GameEventDispatcher {
@ -47,7 +47,7 @@ index 0d5ae91a9b43df7b412968ab5faf5498c09169f9..744160405680babbb83c99abcbe2dc89
for (int l1 = j; l1 <= i1; ++l1) {
for (int i2 = l; i2 <= k1; ++i2) {
- LevelChunk chunk = this.level.getChunkSource().getChunkNow(l1, i2);
+ LevelChunk chunk = (LevelChunk) this.level.getChunkIfLoadedImmediately(l1, i2); // Paper
+ LevelChunk chunk = (LevelChunk) this.level.getChunkIfLoadedImmediately(l1, i2); // Paper - Use getChunkIfLoadedImmediately
if (chunk != null) {
for (int j2 = k; j2 <= j1; ++j2) {

Datei anzeigen

@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..da3d947c58bdb79372e64b2cea6e49b99a4a9ad8 100644
index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..393e6e5fb2c901cdf369cfe5bcde454dee2b1b0d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -273,7 +273,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@ -66,7 +66,7 @@ index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..da3d947c58bdb79372e64b2cea6e49b9
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player, world, pos), chatclickable.getValue());
+ // Paper start
+ // Paper start - Fix commands from signs not firing command events
+ String command = chatclickable.getValue().startsWith("/") ? chatclickable.getValue() : "/" + chatclickable.getValue();
+ if (org.spigotmc.SpigotConfig.logCommands) {
+ LOGGER.info("{} issued server command: {}", player.getScoreboardName(), command);
@ -76,7 +76,7 @@ index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..da3d947c58bdb79372e64b2cea6e49b9
+ return false;
+ }
+ player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
+ // Paper end
+ // Paper end - Fix commands from signs not firing command events
flag1 = true;
}
}
@ -84,7 +84,7 @@ index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..da3d947c58bdb79372e64b2cea6e49b9
String s = player == null ? "Sign" : player.getName().getString();
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
+ // Paper start - send messages back to the player
+ // Paper start - Fix commands from signs not firing command events
+ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) {
+ @Override
+ public void sendSystemMessage(Component message) {
@ -98,15 +98,15 @@ index 1a54db9f8b2fb3071e79ec26c49242b528b8cd9e..da3d947c58bdb79372e64b2cea6e49b9
+ return true;
+ }
+ } : this;
+ // Paper end
+ // Paper end - Fix commands from signs not firing command events
// CraftBukkit - this
- return new CommandSourceStack(this, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player);
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player); // Paper
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player); // Paper - Fix commands from signs not firing command events
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
index d113e54a30db16e2ad955170df6030d15de530d6..26f3a2799e687731d883e7733591f6934479e88d 100644
index d113e54a30db16e2ad955170df6030d15de530d6..21b6f90cf5bd7087d1a0f512289d971f2c3e1afa 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
@@ -61,7 +61,7 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
@ -114,7 +114,7 @@ index d113e54a30db16e2ad955170df6030d15de530d6..26f3a2799e687731d883e7733591f693
try {
- return this.server.dispatchCommand(sender, context.getInput()) ? 1 : 0;
+ return this.server.dispatchCommand(sender, context.getRange().get(context.getInput())) ? 1 : 0; // Paper - actually use the StringRange from context
+ return this.server.dispatchCommand(sender, context.getRange().get(context.getInput())) ? 1 : 0; // Paper - Fix commands from signs not firing command events; actually use the StringRange from context
} catch (CommandException ex) {
sender.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
this.server.getLogger().log(Level.SEVERE, null, ex);

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 12 Mar 2021 19:22:21 -0800
Subject: [PATCH] Adds PlayerArmSwingEvent
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 fe969ecdca0e93319449f2fe3c3f41b4e17b385e..da21fdec10a10e4dcec3b0cadb72fa82ef56e4b4 100644
index 0f0edc347beb179d96ed81e389a71aecd1e0e367..a7984c2454e40137b535c4a14034975339d66407 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
@ -13,7 +13,7 @@ index fe969ecdca0e93319449f2fe3c3f41b4e17b385e..da21fdec10a10e4dcec3b0cadb72fa82
// Arm swing animation
- PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);
+ io.papermc.paper.event.player.PlayerArmSwingEvent event = new io.papermc.paper.event.player.PlayerArmSwingEvent(this.getCraftPlayer(), packet.getHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND); // Paper
+ io.papermc.paper.event.player.PlayerArmSwingEvent event = new io.papermc.paper.event.player.PlayerArmSwingEvent(this.getCraftPlayer(), packet.getHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND); // Paper - Add PlayerArmSwingEvent
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) return;

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, 7 Jul 2021 16:19:41 -0700
Subject: [PATCH] Fixes kick event leave message not being sent
Subject: [PATCH] Fix kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 76eb668311d2aa2659adf4f7857a670d81387830..ae9acf496b866309d336ebd480a0b99aa03694df 100644
index b5ee665fecb3e9e96cb937c92cef8579f9cbeb3d..4d1978b43a0b95a5fbdcd87a215d63163ec459b4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -273,7 +273,6 @@ public class ServerPlayer extends Player {
@ -17,18 +17,18 @@ index 76eb668311d2aa2659adf4f7857a670d81387830..ae9acf496b866309d336ebd480a0b99a
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 70458ff8c9bf6f3263868b0f5570840fe3d89ed2..d28d0ef6105ddeb562ddf31ae9088739856941fc 100644
index 70458ff8c9bf6f3263868b0f5570840fe3d89ed2..134a84841a1e05b212794c00477f20eb30e53ec5 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void onDisconnect(Component reason) {
+ // Paper start
+ // Paper start - Fix kick event leave message not being sent
+ this.onDisconnect(reason, null);
+ }
+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) {
+ // Paper end
+ // Paper end - Fix kick event leave message not being sent
if (this.isSingleplayerOwner()) {
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false);
@ -50,19 +50,19 @@ index 70458ff8c9bf6f3263868b0f5570840fe3d89ed2..d28d0ef6105ddeb562ddf31ae9088739
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index da21fdec10a10e4dcec3b0cadb72fa82ef56e4b4..8ed347ad9e758a3d5df7110ea0b098a207f61094 100644
index a7984c2454e40137b535c4a14034975339d66407..acde997a61660c1afd4d2a265de553c45bf8a11f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1887,6 +1887,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void onDisconnect(Component reason) {
+ // Paper start
+ // Paper start - Fix kick event leave message not being sent
+ this.onDisconnect(reason, null);
+ }
+ @Override
+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) {
+ // Paper end
+ // Paper end - Fix kick event leave message not being sent
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@ -72,17 +72,17 @@ index da21fdec10a10e4dcec3b0cadb72fa82ef56e4b4..8ed347ad9e758a3d5df7110ea0b098a2
ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString());
- this.removePlayerFromWorld();
- super.onDisconnect(reason);
+ this.removePlayerFromWorld(quitMessage); // Paper
+ super.onDisconnect(reason, quitMessage); // Paper
+ this.removePlayerFromWorld(quitMessage); // Paper - Fix kick event leave message not being sent
+ super.onDisconnect(reason, quitMessage); // Paper - Fix kick event leave message not being sent
}
+ // Paper start
+ // Paper start - Fix kick event leave message not being sent
private void removePlayerFromWorld() {
+ this.removePlayerFromWorld(null);
+ }
+
+ private void removePlayerFromWorld(@Nullable net.kyori.adventure.text.Component quitMessage) {
+ // Paper end
+ // Paper end - Fix kick event leave message not being sent
this.chatMessageChain.close();
// CraftBukkit start - Replace vanilla quit message handling with our own.
/*
@ -96,18 +96,18 @@ index da21fdec10a10e4dcec3b0cadb72fa82ef56e4b4..8ed347ad9e758a3d5df7110ea0b098a2
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ff387a1b9ef7165dc755daf672df5d83315b6b7c..29ad37a8d449b5addfd48ef46dde9835f34a057a 100644
index ff387a1b9ef7165dc755daf672df5d83315b6b7c..75b81f0852241a8edc931e514f06d46583b6ac43 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -570,6 +570,11 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component
+ // Paper start
+ // Paper start - Fix kick event leave message not being sent
+ return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
+ }
+ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
+ // Paper end
+ // Paper end - Fix kick event leave message not being sent
ServerLevel worldserver = entityplayer.serverLevel();
entityplayer.awardStat(Stats.LEAVE_GAME);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ca6e0f27b9d0c5d867909abd89262132bf1aa6bd..0e004d32250fea991c66caead50f2f64dbe0bbf7 100644
index e0524231da219dc4c7857ef7b39d4d018fa96ab2..6518d7972f7902b3f7b65d7e5f6629491b531f22 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1164,7 +1164,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -13,12 +13,12 @@ index ca6e0f27b9d0c5d867909abd89262132bf1aa6bd..0e004d32250fea991c66caead50f2f64
MobEffect mobeffectlist = effect.getEffect();
- if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) {
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper - Add config for mobs immune to default effects
return false;
}
}
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 8241dbf7591b2f56b25cdc3ce9009c7133d2e4ef..2beece01e1b2acc69eeb92810ce14db01a311f23 100644
index 8241dbf7591b2f56b25cdc3ce9009c7133d2e4ef..0a2c2b847dc516abf31870116056dbdbb22f31d9 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -606,7 +606,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@ -26,12 +26,12 @@ index 8241dbf7591b2f56b25cdc3ce9009c7133d2e4ef..2beece01e1b2acc69eeb92810ce14db0
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
private class WitherDoNothingGoal extends Goal {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index 6241baccd3fdee59175f616cdf69d3873074f855..9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1 100644
index 6241baccd3fdee59175f616cdf69d3873074f855..4d5cfaa58bdf4e6cb975134004d14c591f6e85fa 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -135,7 +135,7 @@ public class Spider extends Monster {
@ -39,12 +39,12 @@ index 6241baccd3fdee59175f616cdf69d3873074f855..9e5d68fe86d17118df3d6a1c36b296f3
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.POISON && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper
+ return effect.getEffect() == MobEffects.POISON && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
public boolean isClimbing() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
index 62943d43b701d9ae6d955003f4e7658f76d5bdb3..3dcd43279ce1295b37c3504ecbdaac5275df2b80 100644
index 62943d43b701d9ae6d955003f4e7658f76d5bdb3..20a65c11ededcd7170704b70118da6200151fbab 100644
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
@@ -128,6 +128,6 @@ public class WitherSkeleton extends AbstractSkeleton {
@ -52,6 +52,6 @@ index 62943d43b701d9ae6d955003f4e7658f76d5bdb3..3dcd43279ce1295b37c3504ecbdaac52
@Override
public boolean canBeAffected(MobEffectInstance effect) {
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
}
}

Datei anzeigen

@ -28,7 +28,7 @@ index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d
* Get a named timer for the specified tile entity type to track type specific timings.
* @param entity
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 4ea437253539e3ee533ca9da77a337cbf4d1e807..57ef7fbba3028c28231abf7b7ae78aa019323536 100644
index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -13,6 +13,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
@ -38,7 +38,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..57ef7fbba3028c28231abf7b7ae78aa0
+ // Paper start - configurable behavior tick rate and timings
+ private final String configKey;
+ private final co.aikar.timings.Timing timing;
+ // Paper end
+ // Paper end - configurable behavior tick rate and timings
public Behavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState) {
this(requiredMemoryState, 60);
@ -54,7 +54,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..57ef7fbba3028c28231abf7b7ae78aa0
+ }
+ this.configKey = key.toLowerCase(java.util.Locale.ROOT);
+ this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey);
+ // Paper end
+ // Paper end - configurable behavior tick rate and timings
}
@Override
@ -62,12 +62,12 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..57ef7fbba3028c28231abf7b7ae78aa0
@Override
public final boolean tryStart(ServerLevel world, E entity, long time) {
+ // Paper start - behavior tick rate
+ // Paper start - configurable behavior tick rate and timings
+ int tickRate = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.behavior.get(entity.getType(), this.configKey), -1);
+ if (tickRate > -1 && time < this.endTimestamp + tickRate) {
+ return false;
+ }
+ // Paper end
+ // Paper end - configurable behavior tick rate and timings
if (this.hasRequiredMemories(entity) && this.checkExtraStartConditions(world, entity)) {
this.status = Behavior.Status.RUNNING;
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);

Datei anzeigen

@ -1,34 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 20 Jul 2021 21:25:35 -0700
Subject: [PATCH] Add a bunch of missing forceDrop toggles
Subject: [PATCH] Add missing forceDrop toggles
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
index 012586360a48369dad243dbb8892579a1dbcca90..b4f0e80c507157cb0a807070c3375c2d305b8c40 100644
index 012586360a48369dad243dbb8892579a1dbcca90..edeb1899996e53d276d7481e8eddee65249a07d3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
@@ -87,7 +87,9 @@ public class WorkAtComposter extends WorkAtPoi {
simpleContainer.removeItemType(Items.WHEAT, m);
ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
if (!itemStack.isEmpty()) {
+ entity.forceDrops = true; // Paper
+ entity.forceDrops = true; // Paper - Add missing forceDrop toggles
entity.spawnAtLocation(itemStack, 0.5F);
+ entity.forceDrops = false; // Paper
+ entity.forceDrops = false; // Paper - Add missing forceDrop toggles
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 27e1ed14f2ae4f7922c7c3bc1ac21156bafcb0ba..130761afcaa6723e0a9d9a518f1b526c344484b4 100644
index 27e1ed14f2ae4f7922c7c3bc1ac21156bafcb0ba..eb61d539fcf15dfc51b3ea52c232a0c7ef4f1ca9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -534,7 +534,9 @@ public class Panda extends Animal {
}
if (!this.level().isClientSide() && this.random.nextInt(700) == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ this.forceDrops = true; // Paper
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.spawnAtLocation((ItemLike) Items.SLIME_BALL);
+ this.forceDrops = false; // Paper
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
}
@ -36,9 +36,9 @@ index 27e1ed14f2ae4f7922c7c3bc1ac21156bafcb0ba..130761afcaa6723e0a9d9a518f1b526c
ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
if (!itemstack1.isEmpty() && !player.getAbilities().instabuild) {
+ this.forceDrops = true; // Paper
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // Paper
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
@ -46,37 +46,37 @@ index 27e1ed14f2ae4f7922c7c3bc1ac21156bafcb0ba..130761afcaa6723e0a9d9a518f1b526c
ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
if (!itemstack.isEmpty()) {
+ Panda.this.forceDrops = true; // Paper
+ Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
Panda.this.spawnAtLocation(itemstack);
+ Panda.this.forceDrops = false; // Paper
+ Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 8231b48a9e88adb2a1ca3441ee81e3d653c9ae78..1c42425b9211bea7cb189e967e566ad80fd278c2 100644
index 8231b48a9e88adb2a1ca3441ee81e3d653c9ae78..ea0902b4ba68a89b1f51281b10c1dfd1bfb42833 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -317,7 +317,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel world) {
PiglinAi.cancelAdmiring(this);
+ this.forceDrops = true; // Paper
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.inventory.removeAllItems().forEach(this::spawnAtLocation);
+ this.forceDrops = false; // Paper
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
super.finishConversion(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index a780b22553a65814c3d8bc21ad68b8bbdbaa3475..86bb0ac321da9a93065dfe40f33dc8417f092269 100644
index a780b22553a65814c3d8bc21ad68b8bbdbaa3475..e00a1e6031b6de0f6900e004c9e9c97b0d84f8d3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -270,7 +270,9 @@ public class PiglinAi {
private static void holdInOffhand(Piglin piglin, ItemStack stack) {
if (PiglinAi.isHoldingItemInOffHand(piglin)) {
+ piglin.forceDrops = true; // Paper
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
piglin.spawnAtLocation(piglin.getItemInHand(InteractionHand.OFF_HAND));
+ piglin.forceDrops = false; // Paper
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
}
piglin.holdInOffHand(stack);
@ -84,23 +84,23 @@ index a780b22553a65814c3d8bc21ad68b8bbdbaa3475..86bb0ac321da9a93065dfe40f33dc841
protected static void cancelAdmiring(Piglin piglin) {
if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) {
+ piglin.forceDrops = true; // Paper
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
piglin.spawnAtLocation(piglin.getOffhandItem());
+ piglin.forceDrops = false; // Paper
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY);
}
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 49e07b33fccfe339712e5d1bd72e6c0edbd2e922..5538f7a9024d8708b70de836aa78a4015656a828 100644
index 49e07b33fccfe339712e5d1bd72e6c0edbd2e922..798a774c19361bfaf8583a602192e9e547fa85e8 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -250,7 +250,9 @@ public abstract class Raider extends PatrollingMonster {
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
+ this.forceDrops = true; // Paper
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // Paper
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
this.onItemPickup(item);

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] Improve boat collision performance
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 8188febd6f1039a31619b42af23df18afd2e985c..e67a2aa92f9c9bb5a4ba9fc869aa738a43cd8595 100644
index 90f5e7d36719dc9b464dd6ba0335da035bab29d3..006a7876a0c8e1180dada6694992f596948be53b 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -121,6 +121,7 @@ public class Util {
}).findFirst().orElseThrow(() -> {
return new IllegalStateException("No jar file system provider found");
});
+ public static final double COLLISION_EPSILON = 1.0E-7; // Paper
+ public static final double COLLISION_EPSILON = 1.0E-7; // Paper - Improve boat collision performance
private static Consumer<String> thePauser = (message) -> {
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0e004d32250fea991c66caead50f2f64dbe0bbf7..b137ce3be71fa92cb196f5725dd7cfc71f93fcf7 100644
index 6518d7972f7902b3f7b65d7e5f6629491b531f22..394af8382455d2a039534b87142679f52dc8f2a6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1413,7 +1413,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -25,7 +25,7 @@ index 0e004d32250fea991c66caead50f2f64dbe0bbf7..b137ce3be71fa92cb196f5725dd7cfc7
Entity entity = source.getDirectEntity();
- if (entity instanceof LivingEntity) {
+ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper
+ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Improve boat collision performance
LivingEntity entityliving = (LivingEntity) entity;
this.blockUsingShield(entityliving);
@ -34,13 +34,13 @@ index 0e004d32250fea991c66caead50f2f64dbe0bbf7..b137ce3be71fa92cb196f5725dd7cfc7
if (entity1 != null && !source.is(DamageTypeTags.NO_KNOCKBACK)) {
- double d0 = entity1.getX() - this.getX();
+ final boolean far = entity1.distanceToSqr(this) > (200.0 * 200.0); // Paper
+ double d0 = far ? (Math.random() - Math.random()) : entity1.getX() - this.getX(); // Paper
+ final boolean far = entity1.distanceToSqr(this) > (200.0 * 200.0); // Paper - Improve boat collision performance
+ double d0 = far ? (Math.random() - Math.random()) : entity1.getX() - this.getX(); // Paper - Improve boat collision performance
double d1;
- for (d1 = entity1.getZ() - this.getZ(); d0 * d0 + d1 * d1 < 1.0E-4D; d1 = (Math.random() - Math.random()) * 0.01D) {
+ for (d1 = far ? Math.random() - Math.random() : entity1.getZ() - this.getZ(); d0 * d0 + d1 * d1 < 1.0E-4D; d1 = (Math.random() - Math.random()) * 0.01D) { // Paper
+ for (d1 = far ? Math.random() - Math.random() : entity1.getZ() - this.getZ(); d0 * d0 + d1 * d1 < 1.0E-4D; d1 = (Math.random() - Math.random()) * 0.01D) { // Paper - Improve boat collision performance
d0 = (Math.random() - Math.random()) * 0.01D;
}
@ -49,12 +49,12 @@ index 0e004d32250fea991c66caead50f2f64dbe0bbf7..b137ce3be71fa92cb196f5725dd7cfc7
Entity entity = damagesource.getDirectEntity();
- if (entity instanceof LivingEntity) {
+ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper
+ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Improve boat collision performance
this.blockUsingShield((LivingEntity) entity);
}
}
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 8b0efc4d78a04effddae0799b7ee5759ed5c720f..c041c0b81be41cfd128c2f5ba56a5329d50b2efc 100644
index 8b0efc4d78a04effddae0799b7ee5759ed5c720f..dfd53ca465c9d4864020c14a49f4e74b717df5d6 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -689,8 +689,8 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@ -63,8 +63,8 @@ index 8b0efc4d78a04effddae0799b7ee5759ed5c720f..c041c0b81be41cfd128c2f5ba56a5329
this.waterLevel = this.getY(1.0D);
- this.setPos(this.getX(), (double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D, this.getZ());
- this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D));
+ this.move(MoverType.SELF, new Vec3(0.0, ((double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D) - this.getY(), 0.0)); // Paper
+ this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); // Paper
+ this.move(MoverType.SELF, new Vec3(0.0, ((double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D) - this.getY(), 0.0)); // Paper - Improve boat collision performance
+ this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); // Paper - Improve boat collision performance
this.lastYd = 0.0D;
this.status = Boat.Status.IN_WATER;
} else {

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Noah van der Aa <ndvdaa@gmail.com>
Date: Sat, 24 Jul 2021 16:54:11 +0200
Subject: [PATCH] Prevent AFK kick while watching end credits.
Subject: [PATCH] Prevent AFK kick while watching end credits
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8ed347ad9e758a3d5df7110ea0b098a207f61094..28fdf5f4df4b61383e6d132f603c50ec35f62024 100644
index acde997a61660c1afd4d2a265de553c45bf8a11f..9573db9b35b1eae861af18d5eb4ce54a6648786f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -390,7 +390,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -13,7 +13,7 @@ index 8ed347ad9e758a3d5df7110ea0b098a207f61094..28fdf5f4df4b61383e6d132f603c50ec
}
- if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
+ if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
+ if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}

Datei anzeigen

@ -8,7 +8,7 @@ Makes less git noise, as it won't update the date every single time
Use -DPaper.skipServerPropertiesComments=true flag to disable writing it
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
index fc45c2c4ecdf3906df6bceaf3e019c462fe62186..f04bfbef6876ceb1fc7d28d9f964b730d1e5c238 100644
index fc45c2c4ecdf3906df6bceaf3e019c462fe62186..61bf3ccf998bcb9ebd80e983566e7181a73f0e30 100644
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
@@ -29,6 +29,7 @@ public abstract class Settings<T extends Settings<T>> {
@ -24,7 +24,7 @@ index fc45c2c4ecdf3906df6bceaf3e019c462fe62186..f04bfbef6876ceb1fc7d28d9f964b730
}
// CraftBukkit end
- BufferedWriter bufferedwriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
+ // Paper start - disable writing comments to properties file
+ // Paper start - allow skipping server.properties comments
+ java.io.OutputStream outputstream = Files.newOutputStream(path);
+ java.io.BufferedOutputStream bufferedOutputStream = !skipComments ? new java.io.BufferedOutputStream(outputstream) : new java.io.BufferedOutputStream(outputstream) {
+ private boolean isRightAfterNewline = true; // If last written char was newline
@ -63,7 +63,7 @@ index fc45c2c4ecdf3906df6bceaf3e019c462fe62186..f04bfbef6876ceb1fc7d28d9f964b730
+ }
+ };
+ BufferedWriter bufferedwriter = new BufferedWriter(new java.io.OutputStreamWriter(bufferedOutputStream, java.nio.charset.StandardCharsets.UTF_8.newEncoder()));
+ // Paper end
+ // Paper end - allow skipping server.properties comments
try {
this.properties.store(bufferedwriter, "Minecraft server properties");

Datei anzeigen

@ -5,51 +5,51 @@ Subject: [PATCH] Add PlayerSetSpawnEvent
diff --git a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
index a2d0699e8427b2262a2396495111125eccafbb66..d797637f61bdf8a424f56fbb48e28b7c9117d604 100644
index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b345b526b6 100644
--- a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
@@ -38,24 +38,34 @@ public class SetSpawnCommand {
ResourceKey<Level> resourcekey = source.getLevel().dimension();
Iterator iterator = targets.iterator();
+ final Collection<ServerPlayer> actualTargets = new java.util.ArrayList<>(); // Paper
+ final Collection<ServerPlayer> actualTargets = new java.util.ArrayList<>(); // Paper - Add PlayerSetSpawnEvent
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
- entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.COMMAND); // CraftBukkit
+ // Paper start - PlayerSetSpawnEvent
+ // Paper start - Add PlayerSetSpawnEvent
+ if (entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.COMMAND)) {
+ actualTargets.add(entityplayer);
+ }
+ // Paper end
+ // Paper end - Add PlayerSetSpawnEvent
}
+ // Paper start
+ // Paper start - Add PlayerSetSpawnEvent
+ if (actualTargets.isEmpty()) {
+ return 0;
+ }
+ // Paper end
+ // Paper end - Add PlayerSetSpawnEvent
String s = resourcekey.location().toString();
- if (targets.size() == 1) {
+ if (actualTargets.size() == 1) { // Paper
+ if (actualTargets.size() == 1) { // Paper - Add PlayerSetSpawnEvent
source.sendSuccess(() -> {
- return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName());
+ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper
+ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper - Add PlayerSetSpawnEvent
}, true);
} else {
source.sendSuccess(() -> {
- return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size());
+ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper
+ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper - Add PlayerSetSpawnEvent
}, true);
}
- return targets.size();
+ return actualTargets.size(); // Paper
+ return actualTargets.size(); // Paper - Add PlayerSetSpawnEvent
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc571c3280 100644
index 29e94d937f88763fef3c1f748e110cd1dae9a27b..b14f65b657c1a00923bec4a338e06e39f6642dfc 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1356,7 +1356,7 @@ public class ServerPlayer extends Player {
@ -57,7 +57,7 @@ index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc
return Either.left(Player.BedSleepingProblem.OBSTRUCTED);
} else {
- this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - PlayerSetSpawnEvent
+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - Add PlayerSetSpawnEvent
if (this.level().isDay()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@ -65,7 +65,7 @@ index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc
return this.respawnForced;
}
+ @Deprecated // Paper
+ @Deprecated // Paper - Add PlayerSetSpawnEvent
public void setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage) {
- // CraftBukkit start
- this.setRespawnPosition(dimension, pos, angle, forced, sendMessage, PlayerSpawnChangeEvent.Cause.UNKNOWN);
@ -91,7 +91,7 @@ index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc
- resourcekey = Level.OVERWORLD;
- blockposition = null;
- f = 0.0F;
+ // Paper start
+ // Paper start - Add PlayerSetSpawnEvent
+ this.setRespawnPosition(dimension, pos, angle, forced, sendMessage, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.UNKNOWN);
+ }
+ @Deprecated
@ -126,12 +126,12 @@ index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(event.getLocation());
+ angle = event.getLocation().getYaw();
+ forced = event.isForced();
+ // Paper end
+ // Paper end - Add PlayerSetSpawnEvent
- if (flag1 && !flag2) {
- this.sendSystemMessage(Component.translatable("block.minecraft.set_spawn"));
+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper - Add PlayerSetSpawnEvent
+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper - Add PlayerSetSpawnEvent
}
- this.respawnPosition = blockposition;
@ -149,12 +149,12 @@ index b49b56848bdbbd07c49e44d85997fa36192332c5..9f7c149d3ad1175d55ec02e295ee43bc
this.respawnForced = false;
}
+ return true; // Paper
+ return true; // Paper - Add PlayerSetSpawnEvent
}
public SectionPos getLastSectionPos() {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 29ad37a8d449b5addfd48ef46dde9835f34a057a..f7588787769902506e317bdb052483c5dc377693 100644
index 75b81f0852241a8edc931e514f06d46583b6ac43..a0a17fa35c5333655afa8e4e8b3a66ffa41bcc24 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -872,7 +872,7 @@ public abstract class PlayerList {
@ -162,12 +162,12 @@ index 29ad37a8d449b5addfd48ef46dde9835f34a057a..f7588787769902506e317bdb052483c5
} else if (blockposition != null) {
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
- entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - Add PlayerSetSpawnEvent
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index ecaa7f0b2bf795f16187f11fa27f6d5d435ccbfe..c83ffba568f33323b0f8b9a03fa0b7bbbfed4355 100644
index ecaa7f0b2bf795f16187f11fa27f6d5d435ccbfe..acd5ec218b8d4c096f44ae2eec1379eeaf30ddc5 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -87,9 +87,14 @@ public class RespawnAnchorBlock extends Block {
@ -175,19 +175,19 @@ index ecaa7f0b2bf795f16187f11fa27f6d5d435ccbfe..c83ffba568f33323b0f8b9a03fa0b7bb
if (entityplayer.getRespawnDimension() != world.dimension() || !pos.equals(entityplayer.getRespawnPosition())) {
- entityplayer.setRespawnPosition(world.dimension(), pos, 0.0F, false, true, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.RESPAWN_ANCHOR); // CraftBukkit
+ if (entityplayer.setRespawnPosition(world.dimension(), pos, 0.0F, false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.RESPAWN_ANCHOR)) { // Paper - PlayerSetSpawnEvent
+ if (entityplayer.setRespawnPosition(world.dimension(), pos, 0.0F, false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.RESPAWN_ANCHOR)) { // Paper - Add PlayerSetSpawnEvent
world.playSound((Player) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundEvents.RESPAWN_ANCHOR_SET_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F);
return InteractionResult.SUCCESS;
+ // Paper start - handle failed set spawn
+ // Paper start - Add PlayerSetSpawnEvent
+ } else {
+ return InteractionResult.FAIL;
+ }
+ // Paper end
+ // Paper end - Add PlayerSetSpawnEvent
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 11507cbf0f213079b39b35d06f8fc675d437469b..cb72755c1b1e04797dbe99612d7bdd0bfd4b540e 100644
index 11507cbf0f213079b39b35d06f8fc675d437469b..97d489d0130e5854b82be73cd538c3305737f3be 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1318,9 +1318,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -195,10 +195,10 @@ index 11507cbf0f213079b39b35d06f8fc675d437469b..cb72755c1b1e04797dbe99612d7bdd0b
public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) {
- this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
+ this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - PlayerSetSpawnEvent
+ this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - Add PlayerSetSpawnEvent
} else {
- this.getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), CraftLocation.toBlockPosition(location), location.getYaw(), override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
+ this.getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), CraftLocation.toBlockPosition(location), location.getYaw(), override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - PlayerSetSpawnEvent
+ this.getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), CraftLocation.toBlockPosition(location), location.getYaw(), override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - Add PlayerSetSpawnEvent
}
}

Datei anzeigen

@ -5,26 +5,26 @@ Subject: [PATCH] Make hoppers respect inventory max stack size
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index d83b0c58ea9fba6ba0060ee20c3e8251561f301a..f98367830e87d5f1428448931f756d9277699563 100644
index d83b0c58ea9fba6ba0060ee20c3e8251561f301a..321d30f1c0d3838b9c3d210eedb03aa59e0761d8 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -437,15 +437,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
if (itemstack1.isEmpty()) {
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
+ ItemStack leftover = ItemStack.EMPTY; // Paper
+ ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) {
+ leftover = stack; // Paper
+ leftover = stack; // Paper - Make hoppers respect inventory max stack size
stack = stack.split(to.getMaxStackSize());
}
// Spigot end
to.setItem(slot, stack);
- stack = ItemStack.EMPTY;
+ stack = leftover; // Paper
+ stack = leftover; // Paper - Make hoppers respect inventory max stack size
flag = true;
} else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) {
- int j = stack.getMaxStackSize() - itemstack1.getCount();
+ int j = Math.min(stack.getMaxStackSize(), to.getMaxStackSize()) - itemstack1.getCount(); // Paper
+ int j = Math.min(stack.getMaxStackSize(), to.getMaxStackSize()) - itemstack1.getCount(); // Paper - Make hoppers respect inventory max stack size
int k = Math.min(stack.getCount(), j);
stack.shrink(k);

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Config option for Piglins guarding chests
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index 86bb0ac321da9a93065dfe40f33dc8417f092269..b98179602f5b26ecd4df46837b15ca186f65cb38 100644
index e00a1e6031b6de0f6900e004c9e9c97b0d84f8d3..9c979aee4d1e6e72f599d3c5751267e17aa3d32a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -477,6 +477,7 @@ public class PiglinAi {
}
public static void angerNearbyPiglins(Player player, boolean blockOpen) {
+ if (!player.level().paperConfig().entities.behavior.piglinsGuardChests) return; // Paper
+ if (!player.level().paperConfig().entities.behavior.piglinsGuardChests) return; // Paper - Config option for Piglins guarding chests
List<Piglin> list = player.level().getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D));
list.stream().filter(PiglinAi::isIdle).filter((entitypiglin) -> {

Datei anzeigen

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 22 Dec 2020 13:52:48 -0800
Subject: [PATCH] Added EntityDamageItemEvent
Subject: [PATCH] Add EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea730f47f408 100644
index 761a46c21aaddcd43b4c33f477658605648127e9..f23c1695840553ae14e49310b3708a801b5a0f8d 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -622,7 +622,7 @@ public final class ItemStack {
@ -13,7 +13,7 @@ index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea73
}
- public boolean hurt(int amount, RandomSource random, @Nullable ServerPlayer player) {
+ public boolean hurt(int amount, RandomSource random, @Nullable LivingEntity player) { // Paper - allow any living entity instead of only ServerPlayers
+ public boolean hurt(int amount, RandomSource random, @Nullable LivingEntity player) { // Paper - Add EntityDamageItemEvent
if (!this.isDamageableItem()) {
return false;
} else {
@ -23,8 +23,8 @@ index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea73
// CraftBukkit start
- if (player != null) {
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (player instanceof ServerPlayer serverPlayer) { // Paper
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper
+ if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent
event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) {
@ -32,14 +32,14 @@ index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea73
}
amount = event.getDamage();
+ // Paper start - EntityDamageItemEvent
+ // Paper start - Add EntityDamageItemEvent
+ } else if (player != null) {
+ io.papermc.paper.event.entity.EntityDamageItemEvent event = new io.papermc.paper.event.entity.EntityDamageItemEvent(player.getBukkitLivingEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (!event.callEvent()) {
+ return false;
+ }
+ amount = event.getDamage();
+ // Paper end
+ // Paper end - Add EntityDamageItemEvent
}
// CraftBukkit end
if (amount <= 0) {
@ -49,8 +49,8 @@ index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea73
- if (player != null && amount != 0) {
- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, this.getDamageValue() + amount);
+ if (player instanceof ServerPlayer serverPlayer && amount != 0) { // Paper
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, this.getDamageValue() + amount); // Paper
+ if (player instanceof ServerPlayer serverPlayer && amount != 0) { // Paper - Add EntityDamageItemEvent
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, this.getDamageValue() + amount); // Paper - Add EntityDamageItemEvent
}
j = this.getDamageValue() + amount;
@ -59,7 +59,7 @@ index 761a46c21aaddcd43b4c33f477658605648127e9..fdcec8496abda362e611b42ef054ea73
if (!entity.level().isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) {
if (this.isDamageableItem()) {
- if (this.hurt(amount, entity.getRandom(), entity instanceof ServerPlayer ? (ServerPlayer) entity : null)) {
+ if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent
+ if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - Add EntityDamageItemEvent
breakCallback.accept(entity);
Item item = this.getItem();
// CraftBukkit start - Check for item breaking

Datei anzeigen

@ -5,31 +5,31 @@ Subject: [PATCH] Optimize indirect passenger iteration
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 486a4d9e5cd421e2444327e2c28e4f674c98894a..c598247bd8cf65f33845502107277518f7260d4d 100644
index 72f50fe74695e32167d414c1c9ee38deb95afb79..8b84de55028a9c4d65fe5ae99b808f0d84ce6799 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3926,20 +3926,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
private Stream<Entity> getIndirectPassengersStream() {
+ if (this.passengers.isEmpty()) { return Stream.of(); } // Paper
+ if (this.passengers.isEmpty()) { return Stream.of(); } // Paper - Optimize indirect passenger iteration
return this.passengers.stream().flatMap(Entity::getSelfAndPassengers);
}
@Override
public Stream<Entity> getSelfAndPassengers() {
+ if (this.passengers.isEmpty()) { return Stream.of(this); } // Paper
+ if (this.passengers.isEmpty()) { return Stream.of(this); } // Paper - Optimize indirect passenger iteration
return Stream.concat(Stream.of(this), this.getIndirectPassengersStream());
}
@Override
public Stream<Entity> getPassengersAndSelf() {
+ if (this.passengers.isEmpty()) { return Stream.of(this); } // Paper
+ if (this.passengers.isEmpty()) { return Stream.of(this); } // Paper - Optimize indirect passenger iteration
return Stream.concat(this.passengers.stream().flatMap(Entity::getPassengersAndSelf), Stream.of(this));
}
public Iterable<Entity> getIndirectPassengers() {
+ // Paper start - rewrite this method
+ // Paper start - Optimize indirect passenger iteration
+ if (this.passengers.isEmpty()) { return ImmutableList.of(); }
+ ImmutableList.Builder<Entity> indirectPassengers = ImmutableList.builder();
+ for (Entity passenger : this.passengers) {
@ -39,7 +39,7 @@ index 486a4d9e5cd421e2444327e2c28e4f674c98894a..c598247bd8cf65f33845502107277518
+ return indirectPassengers.build();
+ }
+ private Iterable<Entity> getIndirectPassengers_old() {
+ // Paper end
+ // Paper end - Optimize indirect passenger iteration
return () -> {
return this.getIndirectPassengersStream().iterator();
};
@ -47,7 +47,7 @@ index 486a4d9e5cd421e2444327e2c28e4f674c98894a..c598247bd8cf65f33845502107277518
// Paper end - rewrite chunk system
public boolean hasExactlyOnePlayerPassenger() {
+ if (this.passengers.isEmpty()) { return false; } // Paper
+ if (this.passengers.isEmpty()) { return false; } // Paper - Optimize indirect passenger iteration
return this.countPlayerPassengers() == 1;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Clear bucket NBT after dispense
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 8c8d2e81f0866dc1441e181f2580852d87263bcc..9f220c99d7374ab3d9db222346694342d3e926c1 100644
index 8c8d2e81f0866dc1441e181f2580852d87263bcc..d41e3e5382b17d3de41054b496c1707a926a897a 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -650,8 +650,7 @@ public interface DispenseItemBehavior {
@ -14,7 +14,7 @@ index 8c8d2e81f0866dc1441e181f2580852d87263bcc..9f220c99d7374ab3d9db222346694342
if (stack.isEmpty()) {
- stack.setItem(Items.BUCKET);
- stack.setCount(1);
+ stack = new ItemStack(item); // Paper - clear tag
+ stack = new ItemStack(item); // Paper - Clear bucket NBT after dispense
} else if (pointer.blockEntity().addItem(new ItemStack(item)) < 0) {
this.defaultDispenseItemBehavior.dispense(pointer, new ItemStack(item));
}

Datei anzeigen

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 3 Jan 2021 21:25:31 -0800
Subject: [PATCH] Make EntityUnleashEvent cancellable
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 764a5dd85e3fb581b1e713ce9b148be1874d55be..16d84042e2575418880897c728a99d1b8bbcdd15 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1550,7 +1550,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (flag1 && this.isLeashed()) {
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return flag1; }
this.dropLeash(true, event.isDropLeash());
// Paper end
}
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 8e362ad31208d87f4a69a1747485610e0588be51..463b72cab6a62e9738b33007728b2b00ae12e1bc 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -59,7 +59,7 @@ public abstract class PathfinderMob extends Mob {
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
this.dropLeash(true, event.isDropLeash());
// Paper end
}
@@ -71,7 +71,7 @@ public abstract class PathfinderMob extends Mob {
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
// Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
- this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ if (!event.callEvent()) { return; }
this.dropLeash(true, event.isDropLeash());
// Paper end
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] Change EnderEye target without changing other things
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
index ee6bbe96503e9205349e9a5c411dc60dd952ec9e..e48706e2fefc39fcce3c65f629153fdcd677044c 100644
index ee6bbe96503e9205349e9a5c411dc60dd952ec9e..eb7c16b0291357445d408c0748a03f1a9b562a90 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
@@ -70,6 +70,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
}
public void signalTo(BlockPos pos) {
+ // Paper start
+ // Paper start - Change EnderEye target without changing other things
+ this.signalTo(pos, true);
+ }
+ public void signalTo(BlockPos pos, boolean update) {
+ // Paper end
+ // Paper end - Change EnderEye target without changing other things
double d0 = (double) pos.getX();
int i = pos.getY();
double d1 = (double) pos.getZ();
@ -24,31 +24,31 @@ index ee6bbe96503e9205349e9a5c411dc60dd952ec9e..e48706e2fefc39fcce3c65f629153fdc
this.tz = d1;
}
+ if (update) { // Paper
+ if (update) { // Paper - Change EnderEye target without changing other things
this.life = 0;
this.surviveAfterDeath = this.random.nextInt(5) > 0;
+ } // Paper
+ } // Paper - Change EnderEye target without changing other things
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
index d4dfc7a0266086b9bf2c3966c6e149453d0583ba..1fb5760681bf0c745f9f3517489a83666a6d6805 100644
index d4dfc7a0266086b9bf2c3966c6e149453d0583ba..27f56fa4b7ef92a9a4dfa6b782350424b88210f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java
@@ -32,8 +32,15 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public void setTargetLocation(Location location) {
+ // Paper start
+ // Paper start - Change EnderEye target without changing other things
+ this.setTargetLocation(location, true);
+ }
+
+ @Override
+ public void setTargetLocation(Location location, boolean update) {
+ // Paper end
+ // Paper end - Change EnderEye target without changing other things
Preconditions.checkArgument(this.getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
- this.getHandle().signalTo(CraftLocation.toBlockPosition(location));
+ this.getHandle().signalTo(CraftLocation.toBlockPosition(location), update); // Paper
+ this.getHandle().signalTo(CraftLocation.toBlockPosition(location), update); // Paper - Change EnderEye target without changing other things
}
@Override

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Add BlockBreakBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 5e5199b50847958f7abc6d8e42cfb6806df8421f..142f9438f75cb7e2d97011fdeb3f9e367ff81599 100644
index 5e5199b50847958f7abc6d8e42cfb6806df8421f..af62781cc96354c87aa63d4f03f9e25b81959081 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -326,6 +326,23 @@ public class Block extends BlockBehaviour implements ItemLike {
}
}
+ // Paper start
+ // Paper start - Add BlockBreakBlockEvent
+ public static boolean dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity, BlockPos source) {
+ if (world instanceof ServerLevel) {
+ List<org.bukkit.inventory.ItemStack> items = com.google.common.collect.Lists.newArrayList();
@ -28,12 +28,12 @@ index 5e5199b50847958f7abc6d8e42cfb6806df8421f..142f9438f75cb7e2d97011fdeb3f9e36
+ }
+ return true;
+ }
+ // Paper end
+ // Paper end - Add BlockBreakBlockEvent
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
if (world instanceof ServerLevel) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 565da027ca7c395f9b965505cbe9e85e62367834..cda90023ad662e8875365eac98ec69f476dcb42d 100644
index 565da027ca7c395f9b965505cbe9e85e62367834..de9102f943fe90122b2fe7f94228b4248244374a 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -415,7 +415,7 @@ public class PistonBaseBlock extends DirectionalBlock {
@ -41,12 +41,12 @@ index 565da027ca7c395f9b965505cbe9e85e62367834..cda90023ad662e8875365eac98ec69f4
BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null;
- dropResources(iblockdata1, world, blockposition3, tileentity);
+ dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper
+ dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper - Add BlockBreakBlockEvent
world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18);
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1));
if (!iblockdata1.is(BlockTags.FIRE)) {
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index f7527ed1d47901e52df4e3fffbdcd838782c90db..55208b4889f4af60f2b2b66ed6b102b2cd0bb26b 100644
index f7527ed1d47901e52df4e3fffbdcd838782c90db..482616c7cbe12f7a23ec99378e24a87dedc2a8ae 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -296,7 +296,7 @@ public abstract class FlowingFluid extends Fluid {
@ -54,7 +54,7 @@ index f7527ed1d47901e52df4e3fffbdcd838782c90db..55208b4889f4af60f2b2b66ed6b102b2
} else {
if (!state.isAir()) {
- this.beforeDestroyingBlock(world, pos, state);
+ this.beforeDestroyingBlock(world, pos, state, pos.relative(direction.getOpposite())); // Paper
+ this.beforeDestroyingBlock(world, pos, state, pos.relative(direction.getOpposite())); // Paper - Add BlockBreakBlockEvent
}
world.setBlock(pos, fluidState.createLegacyBlock(), 3);
@ -62,25 +62,25 @@ index f7527ed1d47901e52df4e3fffbdcd838782c90db..55208b4889f4af60f2b2b66ed6b102b2
}
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - add source parameter
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - Add BlockBreakBlockEvent
protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state);
private static short getCacheKey(BlockPos from, BlockPos to) {
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..82e85fbbd45244d02df90fa00c9046e7f51275a2 100644
index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..c5f9eda32f2cd172569c7b7d72f5dd3e41a34a70 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid {
return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
}
+ // Paper start
+ // Paper start - Add BlockBreakBlockEvent
+ @Override
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {
+ BlockEntity tileentity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
+ Block.dropResources(state, world, pos, tileentity, source);
+ }
+ // Paper end
+ // Paper end - Add BlockBreakBlockEvent
@Override
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state) {
BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;

Datei anzeigen

@ -5,22 +5,22 @@ Subject: [PATCH] Option to prevent NBT copy in smithing recipes
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
index 566b588006da2b46ec1727be85560ccd59c42c6f..8f71a60c1d83dfad67ac77ec4464a55c7439d4b3 100644
index 566b588006da2b46ec1727be85560ccd59c42c6f..67f7eb89570934b73ff5b894ae3e89fdb874b923 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
@@ -23,8 +23,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
final Ingredient base;
final Ingredient addition;
final ItemStack result;
+ final boolean copyNBT; // Paper
+ final boolean copyNBT; // Paper - Option to prevent NBT copy
public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result) {
+ // Paper start
+ // Paper start - Option to prevent NBT copy
+ this(template, base, addition, result, true);
+ }
+ public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
+ this.copyNBT = copyNBT;
+ // Paper end
+ // Paper end - Option to prevent NBT copy
this.template = template;
this.base = base;
this.addition = addition;
@ -28,13 +28,13 @@ index 566b588006da2b46ec1727be85560ccd59c42c6f..8f71a60c1d83dfad67ac77ec4464a55c
@Override
public ItemStack assemble(Container inventory, RegistryAccess registryManager) {
ItemStack itemstack = this.result.copy();
+ if (this.copyNBT) { // Paper - copy nbt conditionally
+ if (this.copyNBT) { // Paper - Option to prevent NBT copy
CompoundTag nbttagcompound = inventory.getItem(1).getTag();
if (nbttagcompound != null) {
itemstack.setTag(nbttagcompound.copy());
}
+ } // Paper
+ } // Paper - Option to prevent NBT copy
return itemstack;
}
@ -43,27 +43,27 @@ index 566b588006da2b46ec1727be85560ccd59c42c6f..8f71a60c1d83dfad67ac77ec4464a55c
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
- CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper - Option to prevent NBT copy
return recipe;
}
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..2f26ef211322398e795cbdc75b565fc7922cf4ff 100644
index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..a3686cede266c0205247abcec3ce082ae4a048a0 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
@@ -29,8 +29,15 @@ public class SmithingTrimRecipe implements SmithingRecipe {
final Ingredient template;
final Ingredient base;
final Ingredient addition;
+ final boolean copyNbt; // Paper
+ final boolean copyNbt; // Paper - Option to prevent NBT copy
public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition) {
+ // Paper start
+ // Paper start - Option to prevent NBT copy
+ this(template, base, addition, true);
+ }
+ public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition, boolean copyNbt) {
+ this.copyNbt = copyNbt;
+ // Paper end
+ // Paper end - Option to prevent NBT copy
this.template = template;
this.base = base;
this.addition = addition;
@ -72,7 +72,7 @@ index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..2f26ef211322398e795cbdc75b565fc7
}
- ItemStack itemstack1 = itemstack.copy();
+ ItemStack itemstack1 = this.copyNbt ? itemstack.copy() : new ItemStack(itemstack.getItem(), itemstack.getCount()); // Paper
+ ItemStack itemstack1 = this.copyNbt ? itemstack.copy() : new ItemStack(itemstack.getItem(), itemstack.getCount()); // Paper - Option to prevent NBT copy
itemstack1.setCount(1);
ArmorTrim armortrim = new ArmorTrim((Holder) optional.get(), (Holder) optional1.get());
@ -81,30 +81,30 @@ index e0b24c140e04a159a7b8aaef64ab94e19fc03dfd..2f26ef211322398e795cbdc75b565fc7
@Override
public Recipe toBukkitRecipe(NamespacedKey id) {
- return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
+ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper - Option to prevent NBT copy
}
// 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..8b0e3a92e9893af954bc85adb2566502b65a0fa4 100644
index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..ced6dc7db823ecabe91d438dbcbd78f5a4bbdcae 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
public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
super(key, result, template, base, addition);
}
+ // Paper start
+ // Paper start - Option to prevent NBT copy
+ public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, result, template, base, addition, copyNbt);
+ }
+ // Paper end
+ // Paper endv
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
if (recipe instanceof CraftSmithingTransformRecipe) {
return (CraftSmithingTransformRecipe) recipe;
}
- CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
+ CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
+ CraftSmithingTransformRecipe ret = new CraftSmithingTransformRecipe(recipe.getKey(), recipe.getResult(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper - Option to prevent NBT copy
return ret;
}
@ -113,35 +113,35 @@ index 8c381e2745e7d5b63e72a60c5541b549f0d1b9bf..8b0e3a92e9893af954bc85adb2566502
ItemStack result = this.getResult();
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper - Option to prevent NBT copy
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
index 87f20a4811d082f217638768417c1c0feb84f741..105c72a674e1a8ca4eb6003841f5d933d3a2c275 100644
index 87f20a4811d082f217638768417c1c0feb84f741..2217e7ed9533c52a3b7d27d4dfff23ada6f2cef1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
@@ -12,17 +12,22 @@ public class CraftSmithingTrimRecipe extends SmithingTrimRecipe implements Craft
public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition) {
super(key, template, base, addition);
}
+ // Paper start
+ // Paper start - Option to prevent NBT copy
+ public CraftSmithingTrimRecipe(NamespacedKey key, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, template, base, addition, copyNbt);
+ }
+ // Paper end
+ // Paper end - Option to prevent NBT copy
public static CraftSmithingTrimRecipe fromBukkitRecipe(SmithingTrimRecipe recipe) {
if (recipe instanceof CraftSmithingTrimRecipe) {
return (CraftSmithingTrimRecipe) recipe;
}
- CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition());
+ CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper
+ CraftSmithingTrimRecipe ret = new CraftSmithingTrimRecipe(recipe.getKey(), recipe.getTemplate(), recipe.getBase(), recipe.getAddition(), recipe.willCopyNbt()); // Paper - Option to prevent NBT copy
return ret;
}
@Override
public void addToCraftingManager() {
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true))));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), true), this.toNMS(this.getBase(), true), this.toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper - Option to prevent NBT copy
}
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c598247bd8cf65f33845502107277518f7260d4d..80df6afacee92b205949322c9ccfba6f37af0279 100644
index 8b84de55028a9c4d65fe5ae99b808f0d84ce6799..019d3494bb4d01172b33cc9022a7db9e0f603f8d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3373,6 +3373,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 80df6afacee92b205949322c9ccfba6f37af0279..024b993b1fb709297fb495a5fd8224484c48c8b6 100644
index 019d3494bb4d01172b33cc9022a7db9e0f603f8d..82db53692f3fc38625d63f9371f2d842159c454c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2159,6 +2159,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -166,7 +166,7 @@ index bbbf6dd8e566ecdca8794e3b03765fe7e426a2bd..66ab901956ca394c251c420338643d39
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason});
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 095fa9e4c4d367a3cdd343ca71bef7a6564759be..b52d3413cfe725ff5778c897a0ba06ca834e533f 100644
index 59ca5a224561f59bf1f44e11db9bc323ac2f6d71..b882e8d1b3e45277b5e9e3a359f51d9703bdb2d0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1803,6 +1803,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -123,7 +123,7 @@ index 63fad53a9184d7ab97f143b7d85ae9ef2ca9f8bc..1483007b79e18107e41037c279e048f0
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ce74bfb123427c5459c03c3c8f85445077c329c7..6b999e05f93b0da1a3cc9a679a3a88b89df4aab5 100644
index dfbec0bd98f58f7e01d0f45f2ab2c433f9094cc3..1be545d545dcd165fd76b5bb70ac00ddfc49b8bb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -216,6 +216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -151,7 +151,7 @@ index ce74bfb123427c5459c03c3c8f85445077c329c7..6b999e05f93b0da1a3cc9a679a3a88b8
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e297be9cf8c59b6b8d051d5db70c3bebcd235a2d..02dfea10b27c6f932bc5742f6c577e30c155b3fe 100644
index 69730027a70e91ec32604b1fb32820363ea20a71..4691008f0f3a5802af880aa2149f5360dee76920 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -927,6 +927,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6b999e05f93b0da1a3cc9a679a3a88b89df4aab5..a9f336ed75ef406c1179bdc6e63e6fd944470534 100644
index 1be545d545dcd165fd76b5bb70ac00ddfc49b8bb..8117a0334fdf59904e31a0419f7b5bf231d198c5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -860,6 +860,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -324,7 +324,7 @@ index 722e323d2ae3f4ac8aa3197fed79f7d926d5ccfa..f8c1dfc8e121a406955348a1ec00c264
public BlockPos getHomePos() {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 02dfea10b27c6f932bc5742f6c577e30c155b3fe..94a4ceeea167164fb589518881952dd5e082f8c2 100644
index 4691008f0f3a5802af880aa2149f5360dee76920..0d685f1f446061cc723d190b16eedcb2ddedfa46 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1398,10 +1398,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -122,7 +122,7 @@ index 8117a0334fdf59904e31a0419f7b5bf231d198c5..569fbb2f6c5f1ec286ecafe5c7f1b1fe
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b78bcccfb17f24cadea8ff63b6387a6f3ee6429b..a65a0ae8f7e9c2c5fe48d141dba6d95c2e94f426 100644
index 82db53692f3fc38625d63f9371f2d842159c454c..873ae06dc0b5de6cc69e2e8a24a882ca90ee8663 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -8,7 +8,7 @@ This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a65a0ae8f7e9c2c5fe48d141dba6d95c2e94f426..0591b20138bf8b36aa7d78fc0c672ab55abf4f24 100644
index 873ae06dc0b5de6cc69e2e8a24a882ca90ee8663..cee005823020adaef519267630030e8d31b5b994 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1918,6 +1918,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0591b20138bf8b36aa7d78fc0c672ab55abf4f24..d2b2ab7415999b76d8cb0747f5b4235b5b4e07f6 100644
index cee005823020adaef519267630030e8d31b5b994..3086ded2c65b2d623a50401fb0a1612d073da450 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -794,7 +794,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 3b73151b594e6f3882afa2a223d0d7ca5a0b47b3..736c7aed99928af654a8ee30602f705de18a8df6 100644
index 485eba54061b1f7ad17435bce244135634c62b90..983aae5e9b381f34cbd5a3e167a46dd4b5f8a209 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -952,17 +952,7 @@ public class Util {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen