Skip to content

Commit

Permalink
Apply some feature patches
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Dec 16, 2024
1 parent 79ff0d4 commit 273ced9
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ index 03e2178430849d26c9826517e34ad069c94fc00a..11555ce7159ca6c8ddfe9691f86d3720
this.x = x;
this.y = y;
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index da264246f9d1909980c281248e64a522806b36f4..d3a22634c5e76cde78011aa6d40f67370763f83e 100644
index e0239091729f6be138c037951fd5c138497ee358..691fee2e2097244126f4fac0f5d00bf6916b9766 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -351,7 +351,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -350,7 +350,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end

public boolean isInWorldBounds(BlockPos pos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes

Expand All @@ -11,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 91a1330d7308c9faadaf773d056493e1df5dcd1e..1d7e9492a474c99dff372d6b57f1f195e42d5114 100644
index 678b3027e8c53e6021ea49afa69cdbe5f60dcf25..cce78d73e8adafd66d0f3ffb3fabb5e6c025c7df 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -2296,7 +2296,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2282,7 +2282,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}

map.carriedByPlayers.remove(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ index 9bbcafa8e70f95d5ab6318211a0265acbfc76b1c..f8f145cd9614f7e38d6aa72501fe3183
import org.slf4j.Logger;

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 678b3027e8c53e6021ea49afa69cdbe5f60dcf25..c2d9f1e6c68f4945e3b9e5b95326e8180fa7a0fb 100644
index cce78d73e8adafd66d0f3ffb3fabb5e6c025c7df..a4b523ac1926895ccc87464892fa81753ae8f73c 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
Expand Down Expand Up @@ -824,7 +824,7 @@ index c553cf0592dfa606dbbb1e6854d3377b9feb5efb..dec705ec57e4f63ef2ccaa87c5400c11
+
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index e0239091729f6be138c037951fd5c138497ee358..051a86e8a723aeb86ffa06e3cd5fab102a808cde 100644
index 691fee2e2097244126f4fac0f5d00bf6916b9766..25fb8a91bd3012da383711d58cc25cbada510f56 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -153,6 +153,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ index aadf2dccb996e422cacf8bb510cc642e69ee4972..d2d21fe8d7275b01454e09be252d7dd7

private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buffer) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index c2d9f1e6c68f4945e3b9e5b95326e8180fa7a0fb..bb43dff0d55af335ed54f3a8843633b20b7ee63b 100644
index a4b523ac1926895ccc87464892fa81753ae8f73c..ca9427a7eae9a66f4f1ccedda7b1def7ac2a88da 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -348,7 +348,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
Expand Down Expand Up @@ -222,7 +222,7 @@ index 2580b249d9a024400e295ca5beab551b3571ceb3..d227714de0fe13544779fae6cf0e9ff6
}
// Paper end - Send empty chunk
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 051a86e8a723aeb86ffa06e3cd5fab102a808cde..2c2eae0c8656055940c6e1457fc77a20bb58dd8e 100644
index 25fb8a91bd3012da383711d58cc25cbada510f56..872c3b8826f436b15f6ab0a3619692c5202eadc3 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -168,6 +168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Expand Down Expand Up @@ -260,7 +260,7 @@ index 051a86e8a723aeb86ffa06e3cd5fab102a808cde..2c2eae0c8656055940c6e1457fc77a20
if (blockState == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java
index f68f3f5e8ef39a0dc371e75110227a39791c04c8..254ca42e08148915b96ce77310a46e09de84ef53 100644
index 12d9b532e466ec4e46920d409b5f1b3ae60b80f8..bc688ad1097ef4159dfc5f96d963a9fa63262e20 100644
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -114,14 +114,14 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ If that serting is not enabled, collisions will be ignored for players, since
movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups.


diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index f70e77dcce4d94b06efd27273194ce95f4b336ec..0aed1e455dec32c3d53d8fb2f1047e1bf177f171 100644
index 2e5f1dc15ea6a20f8cbdef97ecbf00e5d56603cf..5a67aa9f1fe103e5622ed6fa93bc4bc25ddbb688 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -218,6 +218,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,20 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef

// Paper end - Mob Goal API
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 9338e63cc28413f5559bb0122ef5e04a84bd51d1..88e7e245824b670652878e03a2142a13e97508fe 100644
index eeba224bd575451ba6023df65ef9d9b97f7f1c71..0846ad1f26ee73d72c77b53579a00c321d696b73 100644
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -24,7 +24,9 @@ public class GoalSelector {
@@ -24,7 +24,8 @@ public class GoalSelector {
};
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
- private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
+ private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector
+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
+
private int curRate; // Paper - EAR 2

public void addGoal(int priority, Goal goal) {
this.availableGoals.add(new WrappedGoal(priority, goal));
@@ -45,18 +47,18 @@ public class GoalSelector {
@@ -62,18 +63,18 @@ public class GoalSelector {
this.availableGoals.removeIf(wrappedGoal1 -> wrappedGoal1.getGoal() == goal);
}

Expand Down Expand Up @@ -111,7 +110,7 @@ index 9338e63cc28413f5559bb0122ef5e04a84bd51d1..88e7e245824b670652878e03a2142a13
if (!flag.getOrDefault(flag1, NO_GOAL).canBeReplacedBy(goal)) {
return false;
}
@@ -70,7 +72,7 @@ public class GoalSelector {
@@ -87,7 +88,7 @@ public class GoalSelector {
profilerFiller.push("goalCleanup");

for (WrappedGoal wrappedGoal : this.availableGoals) {
Expand All @@ -120,7 +119,7 @@ index 9338e63cc28413f5559bb0122ef5e04a84bd51d1..88e7e245824b670652878e03a2142a13
wrappedGoal.stop();
}
}
@@ -80,11 +82,14 @@ public class GoalSelector {
@@ -97,11 +98,14 @@ public class GoalSelector {
profilerFiller.push("goalUpdate");

for (WrappedGoal wrappedGoalx : this.availableGoals) {
Expand All @@ -140,7 +139,7 @@ index 9338e63cc28413f5559bb0122ef5e04a84bd51d1..88e7e245824b670652878e03a2142a13
WrappedGoal wrappedGoal1 = this.lockedFlags.getOrDefault(flag, NO_GOAL);
wrappedGoal1.stop();
this.lockedFlags.put(flag, wrappedGoalx);
@@ -116,11 +121,11 @@ public class GoalSelector {
@@ -133,11 +137,11 @@ public class GoalSelector {
}

public void disableControlFlag(Goal.Flag flag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ creating too large of a packet to sed.
Co-authored-by: Spottedleaf <[email protected]>

diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 5d1943d37dfad0c12e77179f0866851532d983e9..0a7e6c639d5125a135a43476bbb2ef2d682f743c 100644
index 3aea76690bc3e35758d3bf274777130af17d8a0f..9e321ef1c3d5803519b243685f4ee598dc0cf640 100644
--- a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -27,6 +27,14 @@ public class ClientboundLevelChunkPacketData {
Expand All @@ -25,11 +25,11 @@ index 5d1943d37dfad0c12e77179f0866851532d983e9..0a7e6c639d5125a135a43476bbb2ef2d
+ }
+ // Paper end - Handle oversized block entities in chunks

public ClientboundLevelChunkPacketData(LevelChunk levelChunk) {
this.heightmaps = new CompoundTag();
@@ -40,8 +48,18 @@ public class ClientboundLevelChunkPacketData {
this.buffer = new byte[calculateChunkSize(levelChunk)];
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), levelChunk);
// Paper start - Anti-Xray - Add chunk packet info
@Deprecated @io.papermc.paper.annotation.DoNotUse
@@ -50,8 +58,18 @@ public class ClientboundLevelChunkPacketData {
}
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), levelChunk, chunkPacketInfo);
this.blockEntitiesData = Lists.newArrayList();
+ int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks

Expand All @@ -47,10 +47,10 @@ index 5d1943d37dfad0c12e77179f0866851532d983e9..0a7e6c639d5125a135a43476bbb2ef2d
}
}
diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index aadf2dccb996e422cacf8bb510cc642e69ee4972..5288de783481b7e932017c679b9eaa715b8826c6 100644
index d2d21fe8d7275b01454e09be252d7dd7710cdc2d..5eef540242413df3ed136aa8837866a94cc285b3 100644
--- a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -66,4 +66,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
@@ -84,4 +84,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
public ClientboundLightUpdatePacketData getLightData() {
return this.lightData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index 60952bd49a89b8d6247d0c8bac837e5b3d586a76..fe84fe69a2a9ed95ec45a9e5af6e6f5a
public static <K, V> Collector<Entry<? extends K, ? extends V>, ?, Map<K, V>> toMap() {
return Collectors.toMap(Entry::getKey, Entry::getValue);
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 88f8d462728231627c3ee7557518a2e04b4fd199..e118fd567427064c6ad6637f874ed146e67b2ee8 100644
index 9de400977ec33e485e87cdf1cf145588527e1e10..c83aeaf4e50dd7290c608dfe260a3bd2404b6004 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1392,7 +1392,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1385,7 +1385,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurtCurrentlyUsedShield(amount);
f1 = amount;
amount = 0.0F;
Expand All @@ -29,7 +29,7 @@ index 88f8d462728231627c3ee7557518a2e04b4fd199..e118fd567427064c6ad6637f874ed146
this.blockUsingShield(livingEntity);
}

@@ -1477,6 +1477,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1470,6 +1470,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
d = damageSource.getSourcePosition().x() - this.getX();
d1 = damageSource.getSourcePosition().z() - this.getZ();
}
Expand All @@ -44,7 +44,7 @@ index 88f8d462728231627c3ee7557518a2e04b4fd199..e118fd567427064c6ad6637f874ed146

this.knockback(0.4F, d, d1, damageSource.getDirectEntity(), damageSource.getDirectEntity() == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
if (!flag) {
@@ -2352,7 +2360,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2345,7 +2353,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
Entity entity = damageSource.getDirectEntity();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bypass the need to get a player chunk, then get the either,
then unwrap it...

diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index d310e7489fc4ecede8deef59241444769d87b0a1..f268808cb250e374f2d5652b20eece011e87dcfb 100644
index d310e7489fc4ecede8deef59241444769d87b0a1..796b5f8541b0cf84482ab2b5a60adde544d43593 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -218,6 +218,12 @@ public class ServerChunkCache extends ChunkSource {
Expand Down

0 comments on commit 273ced9

Please sign in to comment.