mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
Work work work work
This commit is contained in:
parent
0bb4d1d660
commit
4db250389e
@ -5,7 +5,7 @@ Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||||
index 2034858a53c4c887da334cdc7713997daa01124f..ce297420f695404356655b1df2847a32fb98ec59 100644
|
index 54fb380a6896731a18c0100722d12099e590cbc9..9c8aac69f01db647e20d49d272ccc107a7edceaf 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||||
@@ -558,7 +558,7 @@ public class CraftBlock implements Block {
|
@@ -558,7 +558,7 @@ public class CraftBlock implements Block {
|
@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
|
|||||||
load in that case).
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 055650b315d53b56798ded7af2054c3e8e3ee319..c72687fb23e8d01639cce7d79e3f97805d51e01f 100644
|
index 355b60f8d0d600973da673db5a954345f3a0094d..83f3f05ffe61d77417bce50ce7ae6a8671605e9e 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
|
||||||
@@ -231,7 +231,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -234,7 +234,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
||||||
|
|
||||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||||
@ -21,13 +21,13 @@ index 055650b315d53b56798ded7af2054c3e8e3ee319..c72687fb23e8d01639cce7d79e3f9780
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 144d243e0d6ba3ae3f0b0bf457fa516e2b4f416f..20a14b4163807b806bf2ce5a88d3c35098bed929 100644
|
index aff89d2e3274b91238989fc1e7d8c119c2a3c097..560777a99b58c4f82cc0e8fb087de04a564163b5 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -180,6 +180,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -180,6 +180,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
public CraftServer getCraftServer() {
|
||||||
return (CraftServer) Bukkit.getServer();
|
return (CraftServer) Bukkit.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Use getChunkIfLoadedImmediately
|
+ // Paper start - Use getChunkIfLoadedImmediately
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
||||||
@ -35,9 +35,9 @@ index 144d243e0d6ba3ae3f0b0bf457fa516e2b4f416f..20a14b4163807b806bf2ce5a88d3c350
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end - Use getChunkIfLoadedImmediately
|
+ // Paper end - Use getChunkIfLoadedImmediately
|
||||||
+
|
+
|
||||||
|
|
||||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
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) { // Paper - create paper world config
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
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 13b34e89bd3e55df1bb1d4d0cf013bafae43f502..df6c97be1b278c97a20390be5d3e60f429383702 100644
|
index 13b34e89bd3e55df1bb1d4d0cf013bafae43f502..df6c97be1b278c97a20390be5d3e60f429383702 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
@ -58,10 +58,10 @@ 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
|
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 87e272cfb145c37d26b0bf56f97ec784a9bfd98e..bfe8029852385875af4ebe73c63e688f61042021 100644
|
index 3339130f3a02e6e395bcd8e3047b35f6f4eca9a9..a34c2fc6ac1418a89d789b8945ca3dad57f64151 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
@@ -274,7 +274,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
@@ -274,7 +274,17 @@ public class SignBlockEntity extends BlockEntity {
|
||||||
ClickEvent chatclickable = chatmodifier.getClickEvent();
|
ClickEvent chatclickable = chatmodifier.getClickEvent();
|
||||||
|
|
||||||
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
|
if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
|
||||||
@ -80,16 +80,18 @@ index 87e272cfb145c37d26b0bf56f97ec784a9bfd98e..bfe8029852385875af4ebe73c63e688f
|
|||||||
flag1 = true;
|
flag1 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,8 +321,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
@@ -314,8 +324,23 @@ public class SignBlockEntity extends BlockEntity {
|
||||||
String s = player == null ? "Sign" : player.getName().getString();
|
String s = player == null ? "Sign" : player.getName().getString();
|
||||||
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
|
Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
|
||||||
|
|
||||||
|
- // CraftBukkit - commandSource
|
||||||
|
- return new CommandSourceStack(this.commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player);
|
||||||
+ // Paper start - Fix commands from signs not firing command events
|
+ // Paper start - Fix commands from signs not firing command events
|
||||||
+ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) {
|
+ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this.commandSource) {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendSystemMessage(Component message) {
|
+ public void sendSystemMessage(Component message) {
|
||||||
+ if (player != null) {
|
+ if (player instanceof final ServerPlayer serverPlayer) {
|
||||||
+ player.sendSystemMessage(message);
|
+ serverPlayer.sendSystemMessage(message);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -97,10 +99,9 @@ index 87e272cfb145c37d26b0bf56f97ec784a9bfd98e..bfe8029852385875af4ebe73c63e688f
|
|||||||
+ public boolean acceptsFailure() {
|
+ public boolean acceptsFailure() {
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ } : this;
|
+ } : this.commandSource;
|
||||||
+ // Paper end - Fix commands from signs not firing command events
|
+ // Paper end - Fix commands from signs not firing command events
|
||||||
// CraftBukkit - this
|
+ // 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 - Fix commands from signs not firing command events
|
+ 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
|
||||||
}
|
}
|
||||||
|
|
@ -5,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index b30c71ad0cc2602d2c026433a94c9ca45977855e..3b20dce53403e241261f270f0a9e32f12b9e368a 100644
|
index f4d92374f7865a39a0442d79eb5f146ed4bd2b52..c8ab002ddfcea910f916ee503e930085f6c5cb5a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2412,7 +2412,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2423,7 +2423,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
} // Paper end - Call interact event
|
} // Paper end - Call interact event
|
||||||
|
|
||||||
// Arm swing animation
|
// Arm swing animation
|
@ -5,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index f20019261a09f425137731f7a4b92e889b617334..9982940af7d10ca7799e2c21ac994ea3afa0b805 100644
|
index 7bcb3ef3cb498114428782848e0370ac2497ccdc..99a634760cd04d5e3182254b1d0b817baf1cf87a 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
|
||||||
@@ -290,7 +290,6 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
@@ -318,7 +318,6 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
public boolean joining = true;
|
public boolean joining = true;
|
||||||
public boolean sentListPacket = false;
|
public boolean sentListPacket = false;
|
||||||
public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready
|
public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready
|
||||||
@ -17,10 +17,10 @@ index f20019261a09f425137731f7a4b92e889b617334..9982940af7d10ca7799e2c21ac994ea3
|
|||||||
public boolean isRealPlayer; // Paper
|
public boolean isRealPlayer; // Paper
|
||||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
index 64450024ce8094874875321537ddab71ab5206fa..6998f32f8d79dbdb6b31ffaa126602fc4a428616 100644
|
index 59d20fd62e850a38380d877cef95ed69cb46ecbd..fc242acade3ff06c9213428cde103cf078216382 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
@@ -115,6 +115,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -116,6 +116,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnect(DisconnectionDetails info) {
|
public void onDisconnect(DisconnectionDetails info) {
|
||||||
@ -32,7 +32,7 @@ index 64450024ce8094874875321537ddab71ab5206fa..6998f32f8d79dbdb6b31ffaa126602fc
|
|||||||
if (this.isSingleplayerOwner()) {
|
if (this.isSingleplayerOwner()) {
|
||||||
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
|
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||||
this.server.halt(false);
|
this.server.halt(false);
|
||||||
@@ -379,18 +384,17 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -386,18 +391,17 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
// Do not kick the player
|
// Do not kick the player
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,10 +55,10 @@ index 64450024ce8094874875321537ddab71ab5206fa..6998f32f8d79dbdb6b31ffaa126602fc
|
|||||||
MinecraftServer minecraftserver = this.server;
|
MinecraftServer minecraftserver = this.server;
|
||||||
Connection networkmanager = this.connection;
|
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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 3b20dce53403e241261f270f0a9e32f12b9e368a..08c4d0b79dc1c6e51105487b96e9333a5dd904d7 100644
|
index c8ab002ddfcea910f916ee503e930085f6c5cb5a..e9e5b35cd09fe50ce4f2116ca5c38137408105bf 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1894,6 +1894,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1907,6 +1907,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnect(DisconnectionDetails info) {
|
public void onDisconnect(DisconnectionDetails info) {
|
||||||
@ -71,7 +71,7 @@ index 3b20dce53403e241261f270f0a9e32f12b9e368a..08c4d0b79dc1c6e51105487b96e9333a
|
|||||||
// CraftBukkit start - Rarely it would send a disconnect line twice
|
// CraftBukkit start - Rarely it would send a disconnect line twice
|
||||||
if (this.processedDisconnect) {
|
if (this.processedDisconnect) {
|
||||||
return;
|
return;
|
||||||
@@ -1902,11 +1908,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1915,11 +1921,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), info.reason().getString());
|
ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), info.reason().getString());
|
||||||
@ -91,7 +91,7 @@ index 3b20dce53403e241261f270f0a9e32f12b9e368a..08c4d0b79dc1c6e51105487b96e9333a
|
|||||||
this.chatMessageChain.close();
|
this.chatMessageChain.close();
|
||||||
// CraftBukkit start - Replace vanilla quit message handling with our own.
|
// CraftBukkit start - Replace vanilla quit message handling with our own.
|
||||||
/*
|
/*
|
||||||
@@ -1916,7 +1928,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1929,7 +1941,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
|
||||||
this.player.disconnect();
|
this.player.disconnect();
|
||||||
// Paper start - Adventure
|
// Paper start - Adventure
|
||||||
@ -101,10 +101,10 @@ index 3b20dce53403e241261f270f0a9e32f12b9e368a..08c4d0b79dc1c6e51105487b96e9333a
|
|||||||
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
|
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
|
||||||
// Paper end
|
// Paper end
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 55a2f234436808258ef59f889a9b253fe79b82e8..2b0eed116327e74ff66aa065e42899e74b90abf1 100644
|
index 3ec8d38ca514048d94d24424d2132a90c10f529f..55e1e8ab83e8ca44735a0b1a7365526d0a3b24e7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -561,6 +561,11 @@ public abstract class PlayerList {
|
@@ -511,6 +511,11 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component
|
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component
|
@ -0,0 +1,25 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Phoenix616 <max@themoep.de>
|
||||||
|
Date: Sun, 20 Jun 2021 16:35:42 +0100
|
||||||
|
Subject: [PATCH] Don't apply cramming damage to players
|
||||||
|
|
||||||
|
It does not make a lot of sense to damage players if they get crammed,
|
||||||
|
especially as the usecase of teleporting lots of players to the same
|
||||||
|
location isn't too uncommon and killing all those players isn't
|
||||||
|
really what one would expect to happen.
|
||||||
|
|
||||||
|
For those who really want it a config option is provided.
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
index 99a634760cd04d5e3182254b1d0b817baf1cf87a..94cc69ed1ccbcfcc8f431762fef641c313b2f634 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
@@ -1814,7 +1814,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInvulnerableTo(ServerLevel world, DamageSource source) {
|
||||||
|
- return super.isInvulnerableTo(world, source) || this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL);
|
||||||
|
+ return super.isInvulnerableTo(world, source) || (this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL)) || (!this.level().paperConfig().collisions.allowPlayerCrammingDamage && source.is(DamageTypes.CRAMMING)); // Paper - disable player cramming;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
@ -93,10 +93,10 @@ index f639cafa64d98a001e622882c647701547f5c3ac..9379dd4056018b52c93ed4888dcdc945
|
|||||||
|
|
||||||
protected void tick(ServerLevel world, E entity, long time) {
|
protected void tick(ServerLevel world, E entity, long time) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||||
index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..85b4b24361e785acf75571ff98f924c00ae80748 100644
|
index 4d451f6cb5862411848bb9b6b5692ab512dcaa25..8bc7979fb9c2a796921a2a279b78294809f2ed03 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||||
@@ -26,8 +26,21 @@ public abstract class Sensor<E extends LivingEntity> {
|
@@ -29,8 +29,21 @@ public abstract class Sensor<E extends LivingEntity> {
|
||||||
.ignoreInvisibilityTesting();
|
.ignoreInvisibilityTesting();
|
||||||
private final int scanRate;
|
private final int scanRate;
|
||||||
private long timeToTick;
|
private long timeToTick;
|
||||||
@ -118,7 +118,7 @@ index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..85b4b24361e785acf75571ff98f924c0
|
|||||||
this.scanRate = senseInterval;
|
this.scanRate = senseInterval;
|
||||||
this.timeToTick = (long)RANDOM.nextInt(senseInterval);
|
this.timeToTick = (long)RANDOM.nextInt(senseInterval);
|
||||||
}
|
}
|
||||||
@@ -38,8 +51,12 @@ public abstract class Sensor<E extends LivingEntity> {
|
@@ -41,9 +54,13 @@ public abstract class Sensor<E extends LivingEntity> {
|
||||||
|
|
||||||
public final void tick(ServerLevel world, E entity) {
|
public final void tick(ServerLevel world, E entity) {
|
||||||
if (--this.timeToTick <= 0L) {
|
if (--this.timeToTick <= 0L) {
|
||||||
@ -126,6 +126,7 @@ index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..85b4b24361e785acf75571ff98f924c0
|
|||||||
+ // Paper start - configurable sensor tick rate and timings
|
+ // Paper start - configurable sensor tick rate and timings
|
||||||
+ this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
|
+ this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
|
||||||
+ this.timing.startTiming();
|
+ this.timing.startTiming();
|
||||||
|
this.updateTargetingConditionRanges(entity);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.doTick(world, entity);
|
this.doTick(world, entity);
|
||||||
+ this.timing.stopTiming(); // Paper - sensor timings
|
+ this.timing.stopTiming(); // Paper - sensor timings
|
@ -5,106 +5,104 @@ 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
|
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 b9c2b41d9c46c871bab44cfb1d454f4141f1627b..d975b349aa81327c6b6c23e83e9552159217f11e 100644
|
index 4ec1f881c05d96d72814ac3dffd3b4bef40c1bce..c34cb8c918e400636856317cc58356d2677e1d52 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
|
||||||
@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi {
|
@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi {
|
||||||
simpleContainer.removeItemType(Items.WHEAT, m);
|
simpleContainer.removeItemType(Items.WHEAT, m);
|
||||||
ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
|
ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
+ entity.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ villager.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
entity.spawnAtLocation(itemStack, 0.5F);
|
villager.spawnAtLocation(world, itemStack, 0.5F);
|
||||||
+ entity.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ villager.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
|
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 8df42121aa22ec9f95a1b8627b64b0ff71e36314..7b3d5322611990406028e59b1409907291e27b21 100644
|
index 705c26ceff9371b09311bd7fa796c0efde7ebfee..4f04170b3ec4ff59358e10ccfd0799af3ab590c3 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||||
@@ -554,11 +554,13 @@ public class Panda extends Animal {
|
@@ -540,7 +540,9 @@ public class Panda extends Animal {
|
||||||
List<ItemStack> list1 = loottable.getRandomItems(lootparams);
|
|
||||||
Iterator iterator1 = list1.iterator();
|
|
||||||
|
|
||||||
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
if (world1 instanceof ServerLevel worldserver) {
|
||||||
while (iterator1.hasNext()) {
|
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||||
ItemStack itemstack = (ItemStack) iterator1.next();
|
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
|
this.dropFromGiftLootTable(worldserver, BuiltInLootTables.PANDA_SNEEZE, this::spawnAtLocation);
|
||||||
this.spawnAtLocation(itemstack);
|
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
}
|
}
|
||||||
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@@ -664,7 +666,9 @@ public class Panda extends Animal {
|
||||||
@@ -682,7 +684,9 @@ public class Panda extends Animal {
|
ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||||
ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
|
||||||
|
|
||||||
if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
|
if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
|
||||||
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
this.spawnAtLocation(itemstack1);
|
this.spawnAtLocation(worldserver, itemstack1);
|
||||||
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
|
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
|
||||||
@@ -959,7 +963,9 @@ public class Panda extends Animal {
|
@@ -942,7 +946,9 @@ public class Panda extends Animal {
|
||||||
ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
|
ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||||
|
|
||||||
if (!itemstack.isEmpty()) {
|
if (!itemstack.isEmpty()) {
|
||||||
+ Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
Panda.this.spawnAtLocation(itemstack);
|
Panda.this.spawnAtLocation(getServerLevel(Panda.this.level()), itemstack);
|
||||||
+ Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
|
Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
|
||||||
int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
|
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
|
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 691d23bcd3e34a89e14c2e124595e076325dedbc..d2dfa49e124460f4762b950f9ded106d2ec15dc2 100644
|
index ec733e71e41a4c89ed9f35ad1d9d4fa912160d27..15a49e3541c8b45db5e472a64fa0cb94c5a72f67 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||||
@@ -310,7 +310,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
@@ -323,9 +323,11 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||||
@Override
|
@Override
|
||||||
protected void finishConversion(ServerLevel world) {
|
protected void finishConversion(ServerLevel world) {
|
||||||
PiglinAi.cancelAdmiring(this);
|
PiglinAi.cancelAdmiring(world, this);
|
||||||
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
this.inventory.removeAllItems().forEach(this::spawnAtLocation);
|
this.inventory.removeAllItems().forEach((itemstack) -> {
|
||||||
|
this.spawnAtLocation(world, itemstack);
|
||||||
|
});
|
||||||
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
super.finishConversion(world);
|
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
|
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 545e20e558d3bb934ec4bf32847c9fd83edfd85e..3ca643747535bf7b71e5877ca47f730a2aca4ba5 100644
|
index 42b1bd58c6e2c3bd1170171eabfefe315202f340..55868c82bf8bd61ce3494aa9f363c20c88ec6aa6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
@@ -271,7 +271,9 @@ public class PiglinAi {
|
@@ -273,7 +273,9 @@ public class PiglinAi {
|
||||||
|
|
||||||
private static void holdInOffhand(Piglin piglin, ItemStack stack) {
|
private static void holdInOffhand(ServerLevel world, Piglin piglin, ItemStack stack) {
|
||||||
if (PiglinAi.isHoldingItemInOffHand(piglin)) {
|
if (PiglinAi.isHoldingItemInOffHand(piglin)) {
|
||||||
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
piglin.spawnAtLocation(piglin.getItemInHand(InteractionHand.OFF_HAND));
|
piglin.spawnAtLocation(world, piglin.getItemInHand(InteractionHand.OFF_HAND));
|
||||||
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
}
|
}
|
||||||
|
|
||||||
piglin.holdInOffHand(stack);
|
piglin.holdInOffHand(stack);
|
||||||
@@ -331,7 +333,9 @@ public class PiglinAi {
|
@@ -333,7 +335,9 @@ public class PiglinAi {
|
||||||
|
|
||||||
protected static void cancelAdmiring(Piglin piglin) {
|
protected static void cancelAdmiring(ServerLevel world, Piglin piglin) {
|
||||||
if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) {
|
if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) {
|
||||||
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
piglin.spawnAtLocation(piglin.getOffhandItem());
|
piglin.spawnAtLocation(world, piglin.getOffhandItem());
|
||||||
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY);
|
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
|
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 f9bd6f5e54bdb4e2fe4cc73e54961721f440ef07..174d246b0a4d0fc9d769aad08da627ca8487bdf2 100644
|
index 4b9b961b1b910775788f85b13ee48abcc474daca..69a0a8aa7eec0a68a1460f6d6a4b604963b884c4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||||
@@ -230,7 +230,9 @@ public abstract class Raider extends PatrollingMonster {
|
@@ -233,7 +233,9 @@ public abstract class Raider extends PatrollingMonster {
|
||||||
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
||||||
|
|
||||||
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
|
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
|
||||||
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
|
||||||
this.spawnAtLocation(itemstack1);
|
this.spawnAtLocation(world, itemstack1);
|
||||||
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onItemPickup(item);
|
this.onItemPickup(itemEntity);
|
@ -5,25 +5,19 @@ Subject: [PATCH] Stinger API
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
index 19fb8acf614da707f49d922e520e4be93237b2cc..efac0d3ed78c621a52f905b5d7f267b4fb180e65 100644
|
index 00db6ba96bda7ceaae8bc69a6b3a42e7a3929485..9870222cc1c46bcc37f9d3d44881606f2b9d038e 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
|
||||||
@@ -362,6 +362,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -384,6 +384,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
}
|
public boolean isInvulnerable() {
|
||||||
// Paper end
|
return this.getHandle().isInvulnerableTo((ServerLevel) this.getHandle().level(), this.getHandle().damageSources().generic());
|
||||||
}
|
}
|
||||||
+ // Paper start - Bee Stinger API
|
+ // Paper start - Bee Stinger API
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public int getBeeStingerCooldown() {
|
+ public int getBeeStingerCooldown() {
|
||||||
+ return getHandle().removeStingerTime;
|
+ return getHandle().removeStingerTime;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
// Paper start - Add methods for working with arrows stuck in living entities
|
|
||||||
@Override
|
|
||||||
@@ -376,6 +381,34 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
||||||
}
|
|
||||||
// Paper end - Add methods for working with arrows stuck in living entities
|
|
||||||
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setBeeStingerCooldown(int ticks) {
|
+ public void setBeeStingerCooldown(int ticks) {
|
||||||
+ getHandle().removeStingerTime = ticks;
|
+ getHandle().removeStingerTime = ticks;
|
||||||
@ -51,7 +45,6 @@ index 19fb8acf614da707f49d922e520e4be93237b2cc..efac0d3ed78c621a52f905b5d7f267b4
|
|||||||
+ return this.getHandle().removeStingerTime;
|
+ return this.getHandle().removeStingerTime;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Bee Stinger API
|
+ // Paper end - Bee Stinger API
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(double amount) {
|
public void damage(double amount) {
|
||||||
this.damage(amount, this.getHandle().damageSources().generic());
|
|
@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bd
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 1b320ab17379da9b82320e63babb0f395d4b85a8..e09b0a624a80216db5b6f7882c3765f2eb967b06 100644
|
index d921b15100b83cb7073d79f2a1b2bfbdc7b745ca..35e5a3dc58f93b85f93ec5301cc9b5c7505503bc 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -307,6 +307,7 @@ public final class CraftServer implements Server {
|
@@ -310,6 +310,7 @@ public final class CraftServer implements Server {
|
||||||
public Set<String> activeCompatibilities = Collections.emptySet();
|
public Set<String> activeCompatibilities = Collections.emptySet();
|
||||||
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
|
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
|
||||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
@ -5,13 +5,13 @@ 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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 08c4d0b79dc1c6e51105487b96e9333a5dd904d7..44d1cd3e6047590a989a2b85c759be4c64125a47 100644
|
index e9e5b35cd09fe50ce4f2116ca5c38137408105bf..74b21852d9346708a62033c78fac04050b98c80b 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -397,7 +397,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -394,7 +394,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
--this.dropSpamTickCount;
|
this.tabSpamThrottler.tick(); // Paper - configurable tab spam limits
|
||||||
}
|
this.recipeSpamPackets.tick(); // Paper - auto recipe limit
|
||||||
|
this.dropSpamThrottler.tick();
|
||||||
- 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) {
|
||||||
+ 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.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
@ -49,10 +49,10 @@ index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 d1b21afe48dbe1e53d4a046434336be580497165..2dd10cada8d36ed5565481f3f5a5fba168ba9b26 100644
|
index 94cc69ed1ccbcfcc8f431762fef641c313b2f634..c680b311760601bb539d685bceddba6712d141d4 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
|
||||||
@@ -1422,7 +1422,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
@@ -1690,7 +1690,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
} else if (this.bedBlocked(blockposition, enumdirection)) {
|
} else if (this.bedBlocked(blockposition, enumdirection)) {
|
||||||
return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.OBSTRUCTED);
|
return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.OBSTRUCTED);
|
||||||
} else {
|
} else {
|
||||||
@ -61,7 +61,7 @@ index d1b21afe48dbe1e53d4a046434336be580497165..2dd10cada8d36ed5565481f3f5a5fba1
|
|||||||
if (this.level().isDay()) {
|
if (this.level().isDay()) {
|
||||||
return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
|
return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
|
||||||
} else {
|
} else {
|
||||||
@@ -2399,44 +2399,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
@@ -2640,44 +2640,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false);
|
this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ index d1b21afe48dbe1e53d4a046434336be580497165..2dd10cada8d36ed5565481f3f5a5fba1
|
|||||||
} else {
|
} else {
|
||||||
this.respawnPosition = null;
|
this.respawnPosition = null;
|
||||||
this.respawnDimension = Level.OVERWORLD;
|
this.respawnDimension = Level.OVERWORLD;
|
||||||
@@ -2444,6 +2450,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
@@ -2685,6 +2691,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
this.respawnForced = false;
|
this.respawnForced = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,12 +154,12 @@ index d1b21afe48dbe1e53d4a046434336be580497165..2dd10cada8d36ed5565481f3f5a5fba1
|
|||||||
|
|
||||||
public SectionPos getLastSectionPos() {
|
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
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 2b0eed116327e74ff66aa065e42899e74b90abf1..c7dc335d6da208c224d94256eab11b2c3c63745f 100644
|
index 55e1e8ab83e8ca44735a0b1a7365526d0a3b24e7..1b6540ae28d73501c59581b1864f0e01ab53e365 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -845,7 +845,7 @@ public abstract class PlayerList {
|
@@ -803,7 +803,7 @@ public abstract class PlayerList {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (dimensiontransition.missingRespawnBlock()) {
|
if (teleporttransition.missingRespawnBlock()) {
|
||||||
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
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, 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 - PlayerSetSpawnEvent
|
||||||
@ -167,17 +167,17 @@ index 2b0eed116327e74ff66aa065e42899e74b90abf1..c7dc335d6da208c224d94256eab11b2c
|
|||||||
|
|
||||||
int i = flag ? 1 : 0;
|
int i = flag ? 1 : 0;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
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 ba22ad1e4253477572d10d71db6db0ebc14d6755..94d067e9eeee73183de25165d8c97043fe256103 100644
|
index db26b5a0464bd6087eeacaf6dd61eba37365df92..9117c035d5a6ff114b028fad3380ceb1fc2b9691 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||||
@@ -89,9 +89,14 @@ public class RespawnAnchorBlock extends Block {
|
@@ -88,9 +88,14 @@ public class RespawnAnchorBlock extends Block {
|
||||||
ServerPlayer entityplayer = (ServerPlayer) player;
|
ServerPlayer entityplayer = (ServerPlayer) player;
|
||||||
|
|
||||||
if (entityplayer.getRespawnDimension() != world.dimension() || !pos.equals(entityplayer.getRespawnPosition())) {
|
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
|
- 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 - Add 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);
|
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;
|
return InteractionResult.SUCCESS_SERVER;
|
||||||
+ // Paper start - Add PlayerSetSpawnEvent
|
+ // Paper start - Add PlayerSetSpawnEvent
|
||||||
+ } else {
|
+ } else {
|
||||||
+ return InteractionResult.FAIL;
|
+ return InteractionResult.FAIL;
|
||||||
@ -187,10 +187,10 @@ index ba22ad1e4253477572d10d71db6db0ebc14d6755..94d067e9eeee73183de25165d8c97043
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index b747df28b862990d5db08329149272c67eb17d94..bc0d63f90e352ad4158d1dcc0f21a34954279095 100644
|
index 5347ad30130d598644902cdc8902e0b77ac4dfb1..b3efe7391b7e43327bcca419efe72811574c0664 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -1413,9 +1413,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -1426,9 +1426,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
@Override
|
@Override
|
||||||
public void setRespawnLocation(Location location, boolean override) {
|
public void setRespawnLocation(Location location, boolean override) {
|
||||||
if (location == null) {
|
if (location == null) {
|
@ -5,7 +5,7 @@ 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
|
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 1c8a08e317591413426285874de74f4de54efa07..542a5501ac94f57810d34e0f769a9a7855604f91 100644
|
index 8913f434967457a16dd708252834ba001ada1a03..b35b44f0776aeb95ef0eda666ba0b652c5e90274 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
@@ -495,15 +495,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -495,15 +495,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entity tracker passenger checks
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
index 9f04dc7817909d81f387b03bfc57d2d9a1d63478..7e8a43ea1b32f444fb66e270a5f6b48bf7bcd2a0 100644
|
index 52fcf6df392aaa795335ee9bb7ae406009e2fda1..cfb58901476b1f9bbffd205e82c92d39d587afab 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
@@ -71,7 +71,7 @@ public class ServerEntity {
|
@@ -75,7 +75,7 @@ public class ServerEntity {
|
||||||
private Vec3 lastSentMovement;
|
private Vec3 lastSentMovement;
|
||||||
private int tickCount;
|
private int tickCount;
|
||||||
private int teleportDelay;
|
private int teleportDelay;
|
@ -5,13 +5,13 @@ 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
|
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 3ca643747535bf7b71e5877ca47f730a2aca4ba5..d601bff8e8f62af78791ad357b51b92faf04e55f 100644
|
index 55868c82bf8bd61ce3494aa9f363c20c88ec6aa6..4f3048615a34fc2c067e09aec76af94cde6a74e0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
@@ -476,6 +476,7 @@ public class PiglinAi {
|
@@ -478,6 +478,7 @@ public class PiglinAi {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void angerNearbyPiglins(Player player, boolean blockOpen) {
|
public static void angerNearbyPiglins(ServerLevel world, Player player, boolean blockOpen) {
|
||||||
+ if (!player.level().paperConfig().entities.behavior.piglinsGuardChests) return; // Paper - Config option for Piglins guarding chests
|
+ 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<Piglin> list = player.level().getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D));
|
||||||
|
|
94
patches/server/0570-Add-EntityDamageItemEvent.patch
Normal file
94
patches/server/0570-Add-EntityDamageItemEvent.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
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] 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 f00b756fe5dad616323e3b11e35e27353f347042..8c9ae9ac38def29ae4cd8944395e566e434d46d0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
@@ -692,11 +692,11 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- public void hurtAndBreak(int amount, ServerLevel world, @Nullable ServerPlayer player, Consumer<Item> breakCallback) {
|
||||||
|
+ public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent
|
||||||
|
int j = this.processDurabilityChange(amount, world, player);
|
||||||
|
// CraftBukkit start
|
||||||
|
- if (player != null) {
|
||||||
|
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j);
|
||||||
|
+ if (player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), j); // Paper - Add EntityDamageItemEvent
|
||||||
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (j != event.getDamage() || event.isCancelled()) {
|
||||||
|
@@ -707,6 +707,14 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
}
|
||||||
|
|
||||||
|
j = event.getDamage();
|
||||||
|
+ // 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;
|
||||||
|
+ }
|
||||||
|
+ j = event.getDamage();
|
||||||
|
+ // Paper end - Add EntityDamageItemEvent
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -716,21 +724,21 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- private int processDurabilityChange(int baseDamage, ServerLevel world, @Nullable ServerPlayer player) {
|
||||||
|
- return !this.isDamageableItem() ? 0 : (player != null && player.hasInfiniteMaterials() ? 0 : (baseDamage > 0 ? EnchantmentHelper.processDurabilityChange(world, this, baseDamage) : baseDamage));
|
||||||
|
+ private int processDurabilityChange(int baseDamage, ServerLevel world, @Nullable LivingEntity player) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ return !this.isDamageableItem() ? 0 : (player instanceof ServerPlayer && player.hasInfiniteMaterials() ? 0 : (baseDamage > 0 ? EnchantmentHelper.processDurabilityChange(world, this, baseDamage) : baseDamage)); // Paper - Add EntityDamageItemEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
- private void applyDamage(int damage, @Nullable ServerPlayer player, Consumer<Item> breakCallback) {
|
||||||
|
- if (player != null) {
|
||||||
|
- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, damage);
|
||||||
|
+ private void applyDamage(int damage, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ if (player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, damage); // Paper - Add EntityDamageItemEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setDamageValue(damage);
|
||||||
|
if (this.isBroken()) {
|
||||||
|
Item item = this.getItem();
|
||||||
|
// CraftBukkit start - Check for item breaking
|
||||||
|
- if (this.count == 1 && player != null) {
|
||||||
|
- org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(player, this);
|
||||||
|
+ if (this.count == 1 && player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
||||||
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -768,7 +776,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||||
|
entityplayer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- this.hurtAndBreak(amount, worldserver, entityplayer, (item) -> {
|
||||||
|
+ this.hurtAndBreak(amount, worldserver, entity, (item) -> { // Paper - Add EntityDamageItemEvent
|
||||||
|
entity.onEquippedItemBroken(item, slot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java b/src/main/java/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java
|
||||||
|
index 0019c8548aa4901b248ced32cc1475ad14b725bf..7e21c8b10debd70c35a138c14b9b177ef6fff37a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/enchantment/effects/ChangeItemDamage.java
|
||||||
|
@@ -21,9 +21,9 @@ public record ChangeItemDamage(LevelBasedValue amount) implements EnchantmentEnt
|
||||||
|
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity user, Vec3 pos) {
|
||||||
|
ItemStack itemStack = context.itemStack();
|
||||||
|
if (itemStack.has(DataComponents.MAX_DAMAGE) && itemStack.has(DataComponents.DAMAGE)) {
|
||||||
|
- ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null;
|
||||||
|
+ // ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; // Paper - EntityDamageItemEvent - always pass in entity
|
||||||
|
int i = (int)this.amount.calculate(level);
|
||||||
|
- itemStack.hurtAndBreak(i, world, serverPlayer2, context.onBreak());
|
||||||
|
+ itemStack.hurtAndBreak(i, world, context.owner(), context.onBreak()); // Paper - EntityDamageItemEvent - always pass in entity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index da184893d617311a43f9ce176a965f8417a2876d..9844550e4ed6c150250b165acc26d52ec9401184 100644
|
index 42004784a5421bd27d0a4a2bf1c17d14341fc5a4..ea1492559653063bb14b934f4d40d910b81d8801 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3889,20 +3889,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4087,20 +4087,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<Entity> getIndirectPassengersStream() {
|
private Stream<Entity> getIndirectPassengersStream() {
|
||||||
@ -43,7 +43,7 @@ index da184893d617311a43f9ce176a965f8417a2876d..9844550e4ed6c150250b165acc26d52e
|
|||||||
return () -> {
|
return () -> {
|
||||||
return this.getIndirectPassengersStream().iterator();
|
return this.getIndirectPassengersStream().iterator();
|
||||||
};
|
};
|
||||||
@@ -3915,6 +3929,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4113,6 +4127,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasExactlyOnePlayerPassenger() {
|
public boolean hasExactlyOnePlayerPassenger() {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
index 7e8a43ea1b32f444fb66e270a5f6b48bf7bcd2a0..f3f93710846ce0f6d53845e0b49331646a4e8332 100644
|
index cfb58901476b1f9bbffd205e82c92d39d587afab..bc0f1aa61e68d2a8638d89c10bc5c71922d057f9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
@@ -116,7 +116,7 @@ public class ServerEntity {
|
@@ -120,7 +120,7 @@ public class ServerEntity {
|
||||||
if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
|
if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
|
||||||
ItemStack itemstack = entityitemframe.getItem();
|
ItemStack itemstack = entityitemframe.getItem();
|
||||||
|
|
@ -5,10 +5,10 @@ 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
|
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 8b0ccd1aa0f2f1d2326c6071f16e641afc101751..fca3786d0a3f99a3e61e7a4b2251361276eff9d7 100644
|
index 573b96c9e0c89860c3da031c5aa239f6a7ad0c6e..fd1f5de7dc151dfd187d23e022b2c5435ed8accc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||||
@@ -69,6 +69,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
@@ -76,6 +76,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void signalTo(BlockPos pos) {
|
public void signalTo(BlockPos pos) {
|
||||||
@ -20,7 +20,7 @@ index 8b0ccd1aa0f2f1d2326c6071f16e641afc101751..fca3786d0a3f99a3e61e7a4b22513612
|
|||||||
double d0 = (double) pos.getX();
|
double d0 = (double) pos.getX();
|
||||||
int i = pos.getY();
|
int i = pos.getY();
|
||||||
double d1 = (double) pos.getZ();
|
double d1 = (double) pos.getZ();
|
||||||
@@ -86,8 +91,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
@@ -93,8 +98,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||||
this.tz = d1;
|
this.tz = d1;
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Phoenix616 <max@themoep.de>
|
|
||||||
Date: Sun, 20 Jun 2021 16:35:42 +0100
|
|
||||||
Subject: [PATCH] Don't apply cramming damage to players
|
|
||||||
|
|
||||||
It does not make a lot of sense to damage players if they get crammed,
|
|
||||||
especially as the usecase of teleporting lots of players to the same
|
|
||||||
location isn't too uncommon and killing all those players isn't
|
|
||||||
really what one would expect to happen.
|
|
||||||
|
|
||||||
For those who really want it a config option is provided.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
index 9982940af7d10ca7799e2c21ac994ea3afa0b805..d1b21afe48dbe1e53d4a046434336be580497165 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
@@ -95,6 +95,7 @@ import net.minecraft.util.Mth;
|
|
||||||
import net.minecraft.util.RandomSource;
|
|
||||||
import net.minecraft.util.Unit;
|
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
|
||||||
+import net.minecraft.world.damagesource.DamageSources;
|
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
@@ -1545,7 +1546,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInvulnerableTo(DamageSource damageSource) {
|
|
||||||
- return super.isInvulnerableTo(damageSource) || this.isChangingDimension();
|
|
||||||
+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@ -1,89 +0,0 @@
|
|||||||
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] 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 d1eac70fbfe2d863d3a342ed0e83223c65c36c03..a98d76c90cd855e723e7a8d810eee88a882d8b5c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
@@ -646,14 +646,14 @@ public final class ItemStack implements DataComponentHolder {
|
|
||||||
return (Integer) this.getOrDefault(DataComponents.MAX_DAMAGE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- public void hurtAndBreak(int amount, ServerLevel world, @Nullable ServerPlayer player, Consumer<Item> breakCallback) {
|
|
||||||
+ public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent
|
|
||||||
if (this.isDamageableItem()) {
|
|
||||||
if (player == null || !player.hasInfiniteMaterials()) {
|
|
||||||
if (amount > 0) {
|
|
||||||
amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
|
|
||||||
// CraftBukkit start
|
|
||||||
- if (player != null) {
|
|
||||||
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount);
|
|
||||||
+ 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()) {
|
|
||||||
@@ -664,6 +664,14 @@ public final class ItemStack implements DataComponentHolder {
|
|
||||||
}
|
|
||||||
|
|
||||||
amount = event.getDamage();
|
|
||||||
+ // 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;
|
|
||||||
+ }
|
|
||||||
+ amount = event.getDamage();
|
|
||||||
+ // Paper end - Add EntityDamageItemEvent
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
if (amount <= 0) {
|
|
||||||
@@ -671,8 +679,8 @@ public final class ItemStack implements DataComponentHolder {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (player != null && amount != 0) {
|
|
||||||
- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, this.getDamageValue() + amount);
|
|
||||||
+ if (player instanceof ServerPlayer serverPlayer && amount != 0) { // Paper - Add EntityDamageItemEvent
|
|
||||||
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, this.getDamageValue() + amount); // Paper - Add EntityDamageItemEvent
|
|
||||||
}
|
|
||||||
|
|
||||||
int j = this.getDamageValue() + amount;
|
|
||||||
@@ -681,8 +689,8 @@ public final class ItemStack implements DataComponentHolder {
|
|
||||||
if (j >= this.getMaxDamage()) {
|
|
||||||
Item item = this.getItem();
|
|
||||||
// CraftBukkit start - Check for item breaking
|
|
||||||
- if (this.count == 1 && player != null) {
|
|
||||||
- org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(player, this);
|
|
||||||
+ if (this.count == 1 && player != null && player instanceof final ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
@@ -706,7 +714,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
||||||
entityplayer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
- this.hurtAndBreak(amount, worldserver, entityplayer, (item) -> {
|
|
||||||
+ this.hurtAndBreak(amount, worldserver, entity, (item) -> { // Paper - Add EntityDamageItemEvent
|
|
||||||
entity.onEquippedItemBroken(item, slot);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java b/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java
|
|
||||||
index 70796eef426eece0bc93a173f54e90645377b502..82ac989ca836e3beef7c3773db0183a7e51780e0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/effects/DamageItem.java
|
|
||||||
@@ -16,8 +16,8 @@ public record DamageItem(LevelBasedValue amount) implements EnchantmentEntityEff
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity user, Vec3 pos) {
|
|
||||||
- ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null;
|
|
||||||
- context.itemStack().hurtAndBreak((int)this.amount.calculate(level), world, serverPlayer2, context.onBreak());
|
|
||||||
+ // ServerPlayer serverPlayer2 = context.owner() instanceof ServerPlayer serverPlayer ? serverPlayer : null; // Paper - always pass in entity
|
|
||||||
+ context.itemStack().hurtAndBreak((int)this.amount.calculate(level), world, context.owner(), context.onBreak()); // Paper - always pass in entity
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
Loading…
Reference in New Issue
Block a user