moaaaaar patches

This commit is contained in:
Jake 2021-11-24 11:33:17 -08:00 committed by MiniDigger | Martin
parent e141126891
commit 6f5b43e290
23 changed files with 50 additions and 69 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expose Tracked Players
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index b02704b0535522c5535b560105eec2885fdd3e77..d515de1c316f14165ee327bc81f0be98b60db3bf 100644 index 2c892de67ecca09e490246186c8d2eccf91f3536..18795003815d5bb6e04a15256430f69a31b2ace5 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -760,5 +760,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -760,5 +760,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 976dbf40292b10364f9e80bebe96ec9c4dfb657e..c375081e02925da6085a2d433bfc2c3719770f78 100644 index 63b0044a86e6830ccf9d6da8e29989de1402dff4..68da2530db8b0fcdba957ee90c185324a010919f 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1213,12 +1213,15 @@ public abstract class Mob extends LivingEntity { @@ -1228,12 +1228,15 @@ public abstract class Mob extends LivingEntity {
return InteractionResult.PASS; return InteractionResult.PASS;
} else if (this.getLeashHolder() == player) { } else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent // CraftBukkit start - fire PlayerUnleashEntityEvent
@ -26,7 +26,7 @@ index 976dbf40292b10364f9e80bebe96ec9c4dfb657e..c375081e02925da6085a2d433bfc2c37
return InteractionResult.sidedSuccess(this.level.isClientSide); return InteractionResult.sidedSuccess(this.level.isClientSide);
} else { } else {
InteractionResult enuminteractionresult = this.checkAndHandleImportantInteractions(player, hand); InteractionResult enuminteractionresult = this.checkAndHandleImportantInteractions(player, hand);
@@ -1376,8 +1379,11 @@ public abstract class Mob extends LivingEntity { @@ -1391,8 +1394,11 @@ public abstract class Mob extends LivingEntity {
if (this.leashHolder != null) { if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) { if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -40,7 +40,7 @@ index 976dbf40292b10364f9e80bebe96ec9c4dfb657e..c375081e02925da6085a2d433bfc2c37
} }
} }
@@ -1440,8 +1446,11 @@ public abstract class Mob extends LivingEntity { @@ -1455,8 +1461,11 @@ public abstract class Mob extends LivingEntity {
boolean flag1 = super.startRiding(entity, force); boolean flag1 = super.startRiding(entity, force);
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
@ -54,7 +54,7 @@ index 976dbf40292b10364f9e80bebe96ec9c4dfb657e..c375081e02925da6085a2d433bfc2c37
} }
return flag1; return flag1;
@@ -1611,8 +1620,11 @@ public abstract class Mob extends LivingEntity { @@ -1626,8 +1635,11 @@ public abstract class Mob extends LivingEntity {
@Override @Override
protected void removeAfterChangingDimensions() { protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions(); super.removeAfterChangingDimensions();
@ -69,10 +69,10 @@ index 976dbf40292b10364f9e80bebe96ec9c4dfb657e..c375081e02925da6085a2d433bfc2c37
if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
}); });
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index a884940cc576704951d42c6b0d00f5a319297c29..d16a7bab5495d58ea9e6811d4b507667cfa3d264 100644 index 999d18610666ec442bb038da5c452e3cd77e7428..5f256c1ac5d49e19cfccf174dd55506313c493e0 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -47,8 +47,11 @@ public abstract class PathfinderMob extends Mob { @@ -49,8 +49,11 @@ public abstract class PathfinderMob extends Mob {
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
if (f > entity.level.paperConfig.maxLeashDistance) { // Paper if (f > entity.level.paperConfig.maxLeashDistance) { // Paper
@ -86,7 +86,7 @@ index a884940cc576704951d42c6b0d00f5a319297c29..d16a7bab5495d58ea9e6811d4b507667
} }
return; return;
@@ -56,8 +59,11 @@ public abstract class PathfinderMob extends Mob { @@ -58,8 +61,11 @@ public abstract class PathfinderMob extends Mob {
this.onLeashDistance(f); this.onLeashDistance(f);
if (f > entity.level.paperConfig.maxLeashDistance) { // Paper if (f > entity.level.paperConfig.maxLeashDistance) { // Paper
@ -101,7 +101,7 @@ index a884940cc576704951d42c6b0d00f5a319297c29..d16a7bab5495d58ea9e6811d4b507667
} else if (f > 6.0F) { } else if (f > 6.0F) {
double d0 = (entity.getX() - this.getX()) / (double) f; double d0 = (entity.getX() - this.getX()) / (double) f;
diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
index b9b67134f02fd7484ed19905c9ae1f9b8a26ce26..c05f173b7642380900fdd77ce5d2c020468b5fc0 100644 index cf932116a0cafd315e44159fbf7c5d25d43782ff..03bda898a5a263053ecd79f74799d37095bbeb54 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
@@ -123,11 +123,14 @@ public class LeashFenceKnotEntity extends HangingEntity { @@ -123,11 +123,14 @@ public class LeashFenceKnotEntity extends HangingEntity {
@ -122,7 +122,7 @@ index b9b67134f02fd7484ed19905c9ae1f9b8a26ce26..c05f173b7642380900fdd77ce5d2c020
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index db6b057eb6b0f08f7fcb998f8b646b757a98d3f6..33a8e174c4e3b3b5164157c90c8f5b5f9c6d8263 100644 index eda17a60afd6cf03e58e66b2dbfe414b1cfac9d5..5931cf0c05ca22f72a465d096dfb60508d84b859 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1489,8 +1489,10 @@ public class CraftEventFactory { @@ -1489,8 +1489,10 @@ public class CraftEventFactory {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 77a6a5883d7e9fba12d0a2c8f3e7f2565d4785b4..6d0c56e4071a990a3b168143e8ac73f8b5ed0379 100644 index d56eb5071ed3ae2b9d5636cafb3aca9b2cd71d15..46a43cd457ee39463e1bd79880e8391f60c06a52 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -974,7 +974,7 @@ public class ServerChunkCache extends ChunkSource { @@ -891,7 +891,7 @@ public class ServerChunkCache extends ChunkSource {
int l = this.distanceManager.getNaturalSpawnChunkCount(); int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning // Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down NaturalSpawner.SpawnState spawnercreature_d; // moved down

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8608464c1d229625a10fd459427d8cc5e217789a..e1296bbc1f31f270053a47c21887efbad8718b72 100644 index 6166d1ce68742fbcb365c59cd44a611addbe2f8c..f8805dad18a5b9fa37b4f2c214acb17d59167f9d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1142,6 +1142,11 @@ public class ServerPlayer extends Player { @@ -1151,6 +1151,11 @@ public class ServerPlayer extends Player {
this.level.getCraftServer().getPluginManager().callEvent(changeEvent); this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end // CraftBukkit end
} }

View File

@ -5,19 +5,18 @@ Subject: [PATCH] add DragonEggFormEvent
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index f88719dede80c064f6210e078c435ffda32ecc1a..dec99c9d40705a89c395437d0d050f3ab36bc17b 100644 index 619ce8161deab5b93e2a3c4e652b3249f499fd3b..467e2af08698ca40fbbe1fa7b0bafb9561f4fa65 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -363,9 +363,24 @@ public class EndDragonFight { @@ -367,9 +367,23 @@ public class EndDragonFight {
this.dragonEvent.setVisible(false); this.dragonEvent.setVisible(false);
this.spawnExitPortal(true); this.spawnExitPortal(true);
this.spawnNewGateway(); this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent + // Paper start - DragonEggFormEvent
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION); + BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition);
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition); + org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState()); + eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(eggBlock, eggState, + io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); + new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
+ // Paper end - DragonEggFormEvent + // Paper end - DragonEggFormEvent
if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg

View File

@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d37b14523dd2a0e6412449001c7876bd27bf760e..f3976a53514249e64d91075ec2e620e4c7cef37f 100644 index ad1e731900973deebdc363f34c4cf72058e4363d..6694e0d6d7d8d60f54ea1a2d2dcb5a8894b5b4b9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1527,6 +1527,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1489,6 +1489,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -17,10 +17,10 @@ index d37b14523dd2a0e6412449001c7876bd27bf760e..f3976a53514249e64d91075ec2e620e4
this.profiler.push(() -> { this.profiler.push(() -> {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 073dbf69b5b58c4351110d28491e7feb2e47081c..c58b0de1cf1c51ceb0a0ecc145f4a98929521934 100644 index 24ff621292d04d241f432e3a43e9dca92a35be55..bc9bb3f9ea041283a5fa1000f1043db5160f04ba 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -197,6 +197,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -205,6 +205,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable; public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid; public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper public boolean hasPhysicsEvent = true; // Paper
@ -29,10 +29,10 @@ index 073dbf69b5b58c4351110d28491e7feb2e47081c..c58b0de1cf1c51ceb0a0ecc145f4a989
return new Throwable(entity + " Added to world at " + new java.util.Date()); return new Throwable(entity + " Added to world at " + new java.util.Date());
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e3d8557733e20a51bb71d9c968f4f12cc3192624..8ce983822ab44ade6306b52cad352ad95f6d6bad 100644 index de90fc7af633576a33b0d35715c3cb68bb9f5b21..fbd33490d7e1394c0989ca20fb36f0033a9e1c26 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3223,6 +3223,20 @@ public abstract class LivingEntity extends Entity { @@ -3222,6 +3222,20 @@ public abstract class LivingEntity extends Entity {
this.pushEntities(); this.pushEntities();
this.level.getProfiler().pop(); this.level.getProfiler().pop();

View File

@ -5,25 +5,26 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3e694d8a28524f9ea6ba8f1947061b92bc15b13d..843878bb83dfebca8d3574c159c5e338f15104ac 100644 index 1eaea3659dbd99767a045e0f66143bebb604c047..3c5dd72a4c98703602c41f2a04f1c793a6faf2ea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -807,5 +807,10 @@ public class PaperWorldConfig { @@ -702,6 +702,11 @@ public class PaperWorldConfig {
private void enderDragonsDeathAlwaysPlacesDragonEgg() {
enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
} }
+
+ public boolean updatePathfindingOnBlockUpdate = true; + public boolean updatePathfindingOnBlockUpdate = true;
+ private void setUpdatePathfindingOnBlockUpdate() { + private void setUpdatePathfindingOnBlockUpdate() {
+ updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate);
+ } + }
} +
public boolean phantomIgnoreCreative = true;
public boolean phantomOnlyAttackInsomniacs = true;
private void phantomSettings() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 09474f7e973563585e102cc839ab6842a3a10c0c..e0efad2395dd889430554074bbd9769957a72687 100644 index bc9bb3f9ea041283a5fa1000f1043db5160f04ba..d09a9886a6fa8a7e180ab0c1c4a5b437b621f236 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1386,6 +1386,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1360,6 +1360,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
this.getChunkSource().blockChanged(pos); this.getChunkSource().blockChanged(pos);
@ -31,7 +32,7 @@ index 09474f7e973563585e102cc839ab6842a3a10c0c..e0efad2395dd889430554074bbd97699
VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
@@ -1413,6 +1414,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1387,6 +1388,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }

View File

@ -7,10 +7,10 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is
critical section for much of the server, including the lighting engine. critical section for much of the server, including the lighting engine.
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index e8e9494f7f337ee91a56fbd299da015dcda4a81b..593d6251c75ec337175d08b85000239ba7da1af2 100644 index b92377f109c6bc0d497a20b1f92185cb29b57443..6d883db5c04cbcf454952c0f361029ecbfe4f037 100644
--- a/src/main/java/net/minecraft/core/Direction.java --- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java
@@ -62,6 +62,11 @@ public enum Direction implements StringRepresentable { @@ -64,6 +64,11 @@ public enum Direction implements StringRepresentable {
}, (direction1, direction2) -> { }, (direction1, direction2) -> {
throw new IllegalArgumentException("Duplicate keys"); throw new IllegalArgumentException("Duplicate keys");
}, Long2ObjectOpenHashMap::new)); }, Long2ObjectOpenHashMap::new));
@ -22,7 +22,7 @@ index e8e9494f7f337ee91a56fbd299da015dcda4a81b..593d6251c75ec337175d08b85000239b
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id; this.data3d = id;
@@ -71,6 +76,11 @@ public enum Direction implements StringRepresentable { @@ -73,6 +78,11 @@ public enum Direction implements StringRepresentable {
this.axis = axis; this.axis = axis;
this.axisDirection = direction; this.axisDirection = direction;
this.normal = vector; this.normal = vector;
@ -34,7 +34,7 @@ index e8e9494f7f337ee91a56fbd299da015dcda4a81b..593d6251c75ec337175d08b85000239b
} }
public static Direction[] orderedByNearest(Entity entity) { public static Direction[] orderedByNearest(Entity entity) {
@@ -310,15 +320,15 @@ public enum Direction implements StringRepresentable { @@ -357,15 +367,15 @@ public enum Direction implements StringRepresentable {
} }
public int getStepX() { public int getStepX() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 33a8e174c4e3b3b5164157c90c8f5b5f9c6d8263..2b2654ec04e8abca9db09d6257edf11099bb0d9b 100644 index 5931cf0c05ca22f72a465d096dfb60508d84b859..5013a93f9bdc6d2c52239ca0434c7aa40f0572e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -395,13 +395,30 @@ public class CraftEventFactory { @@ -395,13 +395,30 @@ public class CraftEventFactory {

View File

@ -41,7 +41,7 @@ index 46c313d581b9af6aa0a48f97ae3cc800a88535f2..07d700382fc356837045c46d320b7b69
return net.minecraft.core.Registry.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey())); return net.minecraft.core.Registry.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey()));
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 7c8dba1c7d65b4b91eb5a83c029bc5b31750775f..88c0e80be343614947bfa3a14e08c5400a2d4ccc 100644 index 0293d6fd1bb29f75fa1fa1cdfa36b3f679c1bc45..6555db49ff57bba13a7eb3c0bf7ecb66d7828dce 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -686,6 +686,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -686,6 +686,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Merchant#getRecipes should return an immutable list
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java
index 425c8de426cecc9919d03dc64325494104d1b294..fcd6574857f77d547fd8101c5ac097bc6306034c 100644 index 425c8de426cecc9919d03dc64325494104d1b294..71be1e4f17ded6ea42e36be0a9b534c6a65ec640 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java
@@ -24,7 +24,7 @@ public class CraftMerchant implements Merchant { @@ -24,7 +24,7 @@ public class CraftMerchant implements Merchant {
@ -13,7 +13,7 @@ index 425c8de426cecc9919d03dc64325494104d1b294..fcd6574857f77d547fd8101c5ac097bc
@Override @Override
public List<MerchantRecipe> getRecipes() { public List<MerchantRecipe> getRecipes() {
- return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { - return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() {
+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) + return List.copyOf(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes())
@Override @Override
public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) { public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) {
return recipe.asBukkit(); return recipe.asBukkit();

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add support for hex color codes in console
Converts upstream's hex color code legacy format into actual hex color codes in the console. Converts upstream's hex color code legacy format into actual hex color codes in the console.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 57edac376bcbd056fb8fc7f0a433e946bce4ff2e..f3db86346c5e7bf446707a746f3094f7f27e09c4 100644 index eaeed610e3f1a622b2ece220d595fbca9c750d20..5e1b87f84ab78952291c16ef468b83c9c5f21112 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -34,6 +34,7 @@ dependencies { @@ -34,6 +34,7 @@ dependencies {
@ -16,7 +16,7 @@ index 57edac376bcbd056fb8fc7f0a433e946bce4ff2e..f3db86346c5e7bf446707a746f3094f7
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin + annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin
// Paper end // Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper implementation("org.ow2.asm:asm:9.2")
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..a4315961b7a465fb4872a4d67e7c26d4b4ed1fb9 index 0000000000000000000000000000000000000000..a4315961b7a465fb4872a4d67e7c26d4b4ed1fb9

View File

@ -44,39 +44,20 @@ index 7680c269c2fe0cf2a51d0ebeb34624181826d578..49f3b25d28072b61f5cc97260df61df8
+ // Paper end + // Paper end
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
index 66c90013e52170a657b1a5dbdb99748a19fe55e8..ffd83db0a419ab589e89feeddd3fb038d6ed5839 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
@@ -21,9 +21,11 @@ public class NearestLivingEntitySensor extends Sensor<LivingEntity> {
list.sort(Comparator.comparingDouble(entity::distanceToSqr));
Brain<?> brain = entity.getBrain();
brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, list.stream().filter((livingEntity2) -> {
- return isEntityTargetable(entity, livingEntity2);
- }).collect(Collectors.toList()));
+ // Paper start - remove streams in favour of lists
+ List<LivingEntity> visibleMobs = new java.util.ArrayList<>(list);
+ visibleMobs.removeIf(otherEntityLiving -> !Sensor.isEntityTargetable(entity, otherEntityLiving));
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, visibleMobs);
+ // Paper end
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
index b51574548b370f8a86d27835e9888ce1cd1d18be..457ea75137b8b02dc32bf1769ae8d57c470da470 100644 index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..0c40e0f8904880e1f01349953f44d1d330a5a696 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
@@ -21,18 +21,25 @@ public class PlayerSensor extends Sensor<LivingEntity> { @@ -21,18 +21,25 @@ public class PlayerSensor extends Sensor<LivingEntity> {
@Override @Override
protected void doTick(ServerLevel world, LivingEntity entity) { protected void doTick(ServerLevel world, LivingEntity entity) {
- List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((serverPlayer) -> { - List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> {
- return entity.closerThan(serverPlayer, 16.0D); - return entity.closerThan(player, 16.0D);
- }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); - }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList());
+ // Paper start - remove streams in favour of lists + List<Player> players= new java.util.ArrayList<>(world.players());
+ List<Player> players = new java.util.ArrayList<>(world.players()); + players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D));
+ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator + players.sort(Comparator.comparingDouble(entity::distanceTo));
Brain<?> brain = entity.getBrain(); Brain<?> brain = entity.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); - brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list);
- List<Player> list2 = list.stream().filter((player) -> { - List<Player> list2 = list.stream().filter((player) -> {