some patches :D

This commit is contained in:
Jason Penilla 2023-12-05 20:34:04 -07:00
parent 5513f8a795
commit 723c05e7fe
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
20 changed files with 35 additions and 31 deletions

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Set area affect cloud rotation
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 970c85656c398b72e225fb755833e2887c04a68c..a8716fec24006a89bcaa1e3acb394cc557944703 100644
index 31969ed9b6f8660dc969eab83d11c24d5932cef0..29369cab2ccdd1d43fc67dbe2e666e477f96b26d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -953,6 +953,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@@ -987,6 +987,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
entity.moveTo(location.getX(), location.getY(), location.getZ());
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.AreaEffectCloud(world, x, y, z);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 408c23c8310c464baebfb1f4adafe56a01645a5a..e8e61fb73792f8f7fb0266df93dbaf552114b492 100644
index 6a5f5c00f9276337ddee8c8d1458a429bc5443d9..bd2c3425cb17d14ccb6f8390997cc07de354468c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -133,6 +133,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -134,6 +134,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
// Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7dfaaf9fc460d84d87370ae3a0e081e8b21e8348..c795d07645c5dd1b7502ea443ce92e2a3b3ca8ee 100644
index a4e06cc6f88cbaa043a95416d732be1e5f34e893..f84252aa999391c15d1302aea59d9187ffe10d33 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1895,6 +1895,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1922,6 +1922,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerDeepSleepEvent
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 6c498338d3918afb4f7ad5bac013f6dbb43594c2..0d65e04efacef0bef245e6b5b21e430d90696c5d 100644
index 2957b3929c1e92af1b1a2636b83b757a0fbc789d..51fe3687f6f8c2ce5a5f0ac7749bc7cad135a69a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -253,6 +253,11 @@ public abstract class Player extends LivingEntity {
@@ -248,6 +248,11 @@ public abstract class Player extends LivingEntity {
if (this.isSleeping()) {
++this.sleepCounter;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] More World API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b4e1a0990ca8a9d4a17012ff3bae367e046ae27f..d2b8fa11c1f78aadab79cb296da192a0e9b493b7 100644
index cb9db52f7dba755146713be45cb66905e065336f..6252d231e072fcd1fd8ca2eb0b74c66cac9950e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2119,6 +2119,53 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2125,6 +2125,53 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), CraftLocation.toBukkit(found.getFirst(), this));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerBedFailEnterEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index efac034d07f4aadf5dc4ca8322e0dc7d861e6034..a605c9739ebc8e60bd668ff67c760cca9bd210dc 100644
index 77438ea56b83f6aecd5f9acb9c55d4cd6e86ff95..0e63fa3b49b1a275254cf108a51ab18e816aad49 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -109,14 +109,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -119,14 +119,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
BlockPos finalblockposition = pos;
// CraftBukkit end
player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> {

View File

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 27034f08e6fcacb0670f2bdddce6d073a3dd1bc1..16a32e2baebe01d1f2d077500b775aeca7ec61aa 100644
index 3cacbbc03a3207656b71a1a05d95dbb750815bab..8f9ea1907ed4574cca8d362a0f207fb546cb6484 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -209,6 +209,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 504bed9e3baa3bdd1c4d913d033ac8d0bd7cfc24..289e5609b74c254ca95680eaf592bdcdb253c9ce 100644
index f76bdc288c9c8ac24030eb9c6ad8b1c92d42e1c0..6ba2510a98332db7b271aa9a190577402cdac9a4 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -826,6 +826,7 @@ public abstract class PlayerList {
@@ -824,6 +824,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
@ -17,7 +17,7 @@ index 504bed9e3baa3bdd1c4d913d033ac8d0bd7cfc24..289e5609b74c254ca95680eaf592bdcd
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end
@@ -846,6 +847,7 @@ public abstract class PlayerList {
@@ -844,6 +845,7 @@ public abstract class PlayerList {
if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition);
boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
@ -25,7 +25,7 @@ index 504bed9e3baa3bdd1c4d913d033ac8d0bd7cfc24..289e5609b74c254ca95680eaf592bdcd
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -874,7 +876,7 @@ public abstract class PlayerList {
@@ -872,7 +874,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c795d07645c5dd1b7502ea443ce92e2a3b3ca8ee..4d641005076c200ffea9f30a5ee447d2b624ae09 100644
index f84252aa999391c15d1302aea59d9187ffe10d33..14e967c71ae44caab604d8d758deb660d62cfff3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2629,7 +2629,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2637,7 +2637,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -18,10 +18,10 @@ index c795d07645c5dd1b7502ea443ce92e2a3b3ca8ee..4d641005076c200ffea9f30a5ee447d2
} else {
if (this.player.getHealth() > 0.0F) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 289e5609b74c254ca95680eaf592bdcdb253c9ce..80e31db0fbcac487f8dec943972204cddd10e161 100644
index 6ba2510a98332db7b271aa9a190577402cdac9a4..2ed83d020ec5fe2aca1a66b2196c7fc9f41bf4c5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -785,6 +785,12 @@ public abstract class PlayerList {
@@ -783,6 +783,12 @@ public abstract class PlayerList {
}
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
@ -34,7 +34,7 @@ index 289e5609b74c254ca95680eaf592bdcdb253c9ce..80e31db0fbcac487f8dec943972204cd
entityplayer.stopRiding(); // CraftBukkit
this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -876,7 +882,7 @@ public abstract class PlayerList {
@@ -874,7 +880,7 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index c37d9fb4f1fb388e5c264404de378cee298fd253..5fd7e5aa0644fda8e2f7f57eef9a6f0011534cb9 100644
index dead614bf8153d9039bc59f75ba0eee872d0dcb5..094eb2d3aff11c861490e04cc054918bff5e2d87 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -402,7 +402,12 @@ public class Commands {
@@ -456,7 +456,12 @@ public class Commands {
}
public void sendCommands(ServerPlayer player) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityBlockStorage#clearEntities()
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 5c89d824ef43792c34c9f2df5851ba8af503cbd9..9d4152f9fde93a832f263c793955d327f1e078f7 100644
index 5f2042d565974a5509aec8f744e091fe7c576c98..8c4fba5369e5e25f144291c43e086b7417b013aa 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -139,6 +139,11 @@ public class BeehiveBlockEntity extends BlockEntity {

View File

@ -9,10 +9,10 @@ defaults are only included for certain entites, this allows setting
limits for any entity type.
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 5981b2bd5745ac32cdb377c15c4384d074a47680..b1a5f160f5bd4da271f212f02c3c977a5e576b99 100644
index 9d16fc698b0771bcb3c95f5fb017879c37ebb39b..823f3b3093cffb49ccdcbcfbe6d348009a553ad7 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -627,9 +627,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -631,9 +631,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
final Spliterator<? extends Tag> spliterator = entityNbtList.spliterator();
return StreamSupport.stream(new Spliterator<Entity>() {

View File

@ -5,23 +5,27 @@ Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index d03db10517b2df98b40ab48e450333960508aabf..e38e2e5a7ddba9c140f362021b6be0b0974f7cd1 100644
index f29ddc244cfa5eba9b2903d40d8509731fc18287..f655e0ae4a287886d0291cd0089bad2000249d0f 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -237,11 +237,17 @@ public class PlayerAdvancements {
@@ -236,11 +236,21 @@ public class PlayerAdvancements {
this.progressChanged.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {
- this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit())); // CraftBukkit
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ final net.kyori.adventure.text.Component message = advancement.value().display().flatMap(info -> java.util.Optional.ofNullable(info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + info.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement))) : null)).orElse(null);
+ final net.kyori.adventure.text.Component message = advancement.value().display().flatMap(info -> {
+ return java.util.Optional.ofNullable(
+ info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(info.getType().createAnnouncement(advancement, this.player)) : null
+ );
+ }).orElse(null);
+ final org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit(), message);
+ this.player.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ // Paper end
advancement.value().rewards().grant(this.player);
advancement.value().display().ifPresent((advancementdisplay) -> {
- if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
- this.playerList.broadcastSystemMessage(Component.translatable("chat.type.advancement." + advancementdisplay.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement)), false);
- this.playerList.broadcastSystemMessage(advancementdisplay.getType().createAnnouncement(advancement, this.player), false);
+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
+ if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);