Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Updated Upstream (Paper), Fix MC-252817, Implement Anti Shulker Dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Nov 6, 2022
1 parent 40e1f75 commit 69d16d0
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 41 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group = net.prismarineteam.prismarine
version = 1.19.2-R0.1-SNAPSHOT

paperCommit = 2b47227e382113e2faf68c941924b8426d7cc3a0
paperCommit = df5fb9475b9fa9eb4bf1d4840e31f8615fc4f7e3

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
16 changes: 10 additions & 6 deletions patches/api/0002-Purpur-API-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ From: AlphaKR93 <[email protected]>
Date: Sun, 30 Oct 2022 06:00:46 +0000
Subject: [PATCH] Purpur API Changes

Original by PurpurMC Team

Copyright (C) 2022 PurpurMC LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the Software), to deal
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

diff --git a/build.gradle.kts b/build.gradle.kts
index 780c9b40f69c247592c1fe469c05fd12e984b633..8e64ccdb928bc38cb703e60c8ec31339a6f6d894 100644
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0001-Pufferfish-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ index ff3eced0e20c39b825586897ee2fed01dd471d88..5c54a5da7fb50cd97799c5fa280a24d5
}
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 9ad7c417616e68b1d14a702aca38b2582feb896c..2e811de518dbc63e791508d060c9db64de48fdbb 100644
index d1edafb3e44a4d17586e0e9c4fca30389b529074..bf2998947f4165f9a661c8fc5f6b846ab9852370 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -334,7 +334,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Expand Down Expand Up @@ -2398,18 +2398,18 @@ index be97d38f45046a7f6d2337d879651f04cf9ff825..0b75caca3f77980505d0689601d920fb

private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 3b144c820531122eb37d41be06c182b5f5dc0724..1eb912ad97f9663bf6bd336ad739f2552b0a5c9b 100644
index 2358bb1788cfb902bac9b3b7588954af2d2cd823..163f14b4e1ca99d75e5d8e14190f7b91cb58e8f3 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -165,6 +165,7 @@ public class ServerEntity {
@@ -166,6 +166,7 @@ public class ServerEntity {
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;

if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround() && !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
+ if (flag2 || flag3 || this.entity instanceof AbstractArrow) { // Pufferfish
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
if (flag2) {
packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround());
@@ -174,6 +175,7 @@ public class ServerEntity {
@@ -175,6 +176,7 @@ public class ServerEntity {
} else {
packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.isOnGround());
}
Expand Down Expand Up @@ -2475,7 +2475,7 @@ index 8b3e703ebb497b9166bd211b4247a78891b61aeb..94f4a5bfd2af8389a99f80bab4eceac1
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9ad36447e82a3504576f6c10cb297514a2f69289..4e615e5d5b8d79f6eaac2136be03961415fd093e 100644
index 4ab50df1e4c855587ef030cf3f2a1502798cb721..21c482725d2504b0aedb83ed2a7954b19c11bb61 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1216,6 +1216,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Expand Down
34 changes: 19 additions & 15 deletions patches/server/0002-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ From: AlphaKR93 <[email protected]>
Date: Sun, 30 Oct 2022 06:00:46 +0000
Subject: [PATCH] Purpur Server Changes

Original by PurpurMC Team

Copyright (C) 2022 PurpurMC LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the Software), to deal
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

diff --git a/build.gradle.kts b/build.gradle.kts
index 5b43f5c27ce903c53cbce245477fbdefdc88733f..40e47799426ba0180c15204241d7687071908543 100644
Expand Down Expand Up @@ -1627,7 +1631,7 @@ index a32cfa75a9bea896f558bab646d0868391b069a9..01ca7156d86243a80cd343a2a66be9eb
public final boolean spawnNpcs = this.get("spawn-npcs", true);
public final boolean pvp = this.get("pvp", true);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2e811de518dbc63e791508d060c9db64de48fdbb..2182ee049defee88067aa61cee42d3a0122061b7 100644
index bf2998947f4165f9a661c8fc5f6b846ab9852370..c1db2333ce5fe87fd1ce059cbd8ae6d77abf6f06 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -606,20 +606,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Expand Down Expand Up @@ -1923,7 +1927,7 @@ index 0b75caca3f77980505d0689601d920fb50f7ac4d..9d13ef8c597b9ca11280ad1d3249d13b
}

diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..3441339e1ba5efb0e25c16fa13cb65d2fbdafc42 100644
index 163f14b4e1ca99d75e5d8e14190f7b91cb58e8f3..7880cdcaf12197f6b36777c51b2859f2463f1595 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -65,7 +65,7 @@ public class ServerEntity {
Expand All @@ -1932,9 +1936,9 @@ index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..3441339e1ba5efb0e25c16fa13cb65d2
// CraftBukkit start
- final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package
+ public final Set<ServerPlayerConnection> trackedPlayers; // Paper - private -> package // Purpur - package -> public
public boolean clearDirtyEntityData = true; // Paper

public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 94f4a5bfd2af8389a99f80bab4eceac1f075512e..c888e654ab9449bfdc7dfe16078eb0786ae6c15e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
Expand Down Expand Up @@ -2832,7 +2836,7 @@ index 80c1e0e47818486a68e0114b063395290365346b..c677a55db62b4d197eeb1bf5d929e240
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
hasSetFarWarned = true;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4e615e5d5b8d79f6eaac2136be03961415fd093e..66c632f9a824e705420b9bb86de294f0e7305c50 100644
index 21c482725d2504b0aedb83ed2a7954b19c11bb61..257daaf0881b1af992a20df83be3846e0d58de66 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -260,6 +260,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Expand Down Expand Up @@ -3174,8 +3178,8 @@ index 4e615e5d5b8d79f6eaac2136be03961415fd093e..66c632f9a824e705420b9bb86de294f0
+
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
ServerGamePacketListenerImpl.this.send(new ClientboundAddEntityPacket(entity));
@@ -3571,11 +3665,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start
@@ -3572,11 +3666,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
for (int i = 0; i < signText.size(); ++i) {
FilteredText filteredtext = (FilteredText) signText.get(i);

Expand All @@ -3196,7 +3200,7 @@ index 4e615e5d5b8d79f6eaac2136be03961415fd093e..66c632f9a824e705420b9bb86de294f0
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
this.cserver.getPluginManager().callEvent(event);
@@ -3597,6 +3697,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3598,6 +3698,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic

@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
Expand All @@ -3213,15 +3217,15 @@ index 4e615e5d5b8d79f6eaac2136be03961415fd093e..66c632f9a824e705420b9bb86de294f0
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
@@ -3647,6 +3757,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3648,6 +3758,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");

private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
+ private static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur

@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@@ -3671,6 +3782,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3672,6 +3783,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0010-Slice-Server-Patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0011 - Packet obfuscation and reduction

diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
index bf838c097aeb79fbe82c0b6cdf3315acf03474cd..88c488cc9bcbfdec50654a8d67ebbd65b325cedf 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
@@ -27,6 +27,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi

}

Expand Down Expand Up @@ -158,10 +158,10 @@ index 1c4e812c8b3f85ac5d69b637eb43d4b9751ad150..03b6ad0064d1d201f317f1c168f07834
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 3441339e1ba5efb0e25c16fa13cb65d2fbdafc42..5f209e0dcd42ad0af8aa2252f7cc19a53588c2ae 100644
index 7880cdcaf12197f6b36777c51b2859f2463f1595..b79e12cab036339aca73bdda639a877cdddc3f75 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -362,6 +362,21 @@ public class ServerEntity {
@@ -363,6 +363,21 @@ public class ServerEntity {
SynchedEntityData datawatcher = this.entity.getEntityData();

if (datawatcher.isDirty()) {
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0011-Petal-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ index f597d65d56964297eeeed6c7e77703764178fee0..f406dc012fd9722feed630ddfba11862
public ChunkHolder.FullChunkStatus status;

diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2182ee049defee88067aa61cee42d3a0122061b7..1ba2611933f8d24d70cb53de495e7c17ccd74868 100644
index c1db2333ce5fe87fd1ce059cbd8ae6d77abf6f06..26dbedad2781479626a73e016f589ab6c16c74a1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1236,8 +1236,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Expand Down Expand Up @@ -641,10 +641,10 @@ index ca42c2642a729b90d22b968af7258f3aee72e14b..ba1ae37d5605355a89d8e186d057174d
public boolean visible = true;

diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 869b85b4c482d8bd0a48b948cffcf36289bceab0..6760ef1dee40fb6bff29415c3ac33bab5ff22b10 100644
index b79e12cab036339aca73bdda639a877cdddc3f75..b02cd7bed470c9c6dcbd986a24637fe2874ee9ca 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -249,14 +249,15 @@ public class ServerEntity {
@@ -250,14 +250,15 @@ public class ServerEntity {

public void removePairing(ServerPlayer player) {
this.entity.stopSeenByPlayer(player);
Expand All @@ -662,7 +662,7 @@ index 869b85b4c482d8bd0a48b948cffcf36289bceab0..6760ef1dee40fb6bff29415c3ac33bab
this.entity.startSeenByPlayer(player);
}

@@ -377,19 +378,24 @@ public class ServerEntity {
@@ -378,19 +379,24 @@ public class ServerEntity {
}
} else
// Prismarine end
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0012-Do-not-send-useless-entity-packets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 40720fd24ce9b404786d4145e21f3c0f5a382475..10ffaeec14d3fb62407d42c6213b15860ac58d93 100644
index b02cd7bed470c9c6dcbd986a24637fe2874ee9ca..f2a513cea03f7849f4c76ff3c9a3f3130b57c077 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -181,6 +181,7 @@ public class ServerEntity {
@@ -182,6 +182,7 @@ public class ServerEntity {
this.teleportDelay = 0;
packet1 = new ClientboundTeleportEntityPacket(this.entity);
}
+ if (net.prismarineteam.prismarine.PrismarineConfig.doNotSendUselessEntityPackets && isUselessEntityPacket(packet1)) packet1 = null; // Prismarine
}

if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
@@ -247,6 +248,22 @@ public class ServerEntity {
@@ -248,6 +249,22 @@ public class ServerEntity {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ index 245ffd8d8db27b598f1c6f491ff451c6734f1ed0..31764760577ee5972c3511d72272fd49
// Purpur end
Item item = stack.getItem();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5d50fe8439760ec023f560b0a306fa9516b9ec75..65903ecbae4da86bf40b222dddf1b3925b1ba0aa 100644
index a3892aa3e4005974d00bc1f05b98311bc3e7789d..f408872a98a4efec021e567d6b71763c90365aba 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3578,6 +3578,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3579,6 +3579,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}

Expand Down
Loading

0 comments on commit 69d16d0

Please sign in to comment.