mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
(Almost) all patches applied
This commit is contained in:
parent
2debcaff9d
commit
6da0d8cc91
@ -61,7 +61,7 @@ index ed8e875fff01c6b464fbaefbb0a3f417f9d67a72..aba5f694b25507c9ab2e214bc1f25e0a
|
||||
|
||||
public <T extends Entity> List<? extends T> getEntities(EntityTypeTest<Entity, T> filter, Predicate<? super T> predicate) {
|
||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..868c9bbb12c8cfe76abb62774cf08102b727063b 100644
|
||||
index 0382b6597a130d746f8954a93a756a9d1ac81d50..cb39c629af1827078f35904a373d35a63fea17ff 100644
|
||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -116,7 +116,13 @@ public class WorldUpgrader {
|
||||
|
@ -81,51 +81,10 @@ index abb9a86cd42a34cf722a312068134e820ac21956..3b6ebe8f9575783a1607eb6667554ca6
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 88fc56fa521c36accd807ca1704136f29733e52f..32076a765d48d59b339d600f69afa85edbcf833c 100644
|
||||
index 88fc56fa521c36accd807ca1704136f29733e52f..a771f78f63e4f26c0ba411a3c355f8dfbb5f4a61 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -45,7 +45,6 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.ConnectionProtocol;
|
||||
import net.minecraft.network.TickablePacketListener;
|
||||
-import net.minecraft.network.chat.ChatDecorator;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.LastSeenMessages;
|
||||
@@ -63,7 +62,6 @@ import net.minecraft.network.protocol.PacketUtils;
|
||||
import net.minecraft.network.protocol.common.ServerboundClientInformationPacket;
|
||||
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.configuration.ConfigurationProtocols;
|
||||
-import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockChangedAckPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket;
|
||||
@@ -185,7 +183,6 @@ import net.minecraft.world.level.block.entity.CrafterBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.JigsawBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.StructureBlockEntity;
|
||||
-import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
@@ -216,7 +213,6 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemType;
|
||||
-import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
@@ -231,8 +227,6 @@ import org.bukkit.event.inventory.InventoryCreativeEvent;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.inventory.SmithItemEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
-import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
-import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
@@ -2010,6 +2004,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -2010,6 +2010,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
|
||||
if (cancelled) {
|
||||
@ -133,7 +92,7 @@ index 88fc56fa521c36accd807ca1704136f29733e52f..32076a765d48d59b339d600f69afa85e
|
||||
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
||||
return;
|
||||
}
|
||||
@@ -2794,7 +2789,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -2794,7 +2795,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
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)) {
|
||||
|
@ -34,7 +34,7 @@ index 7a0c1a55a211035bbca7b97293e94b04ae308bae..c3800bdd5096cb06e085e28f6bf0f655
|
||||
if (optional.isPresent()) {
|
||||
RecipeHolder<CraftingRecipe> recipeholder = (RecipeHolder) optional.get();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
index 113460eff5121788fce44d6569ec07deb9701b20..accf752e7615f775483830f81bd0df30e40d3c7f 100644
|
||||
index fef82418358ecf19d367dafbec159bd78ea97494..f17ff5988d826c8fad68f6bf7bac1d06edae01ae 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
@@ -58,7 +58,7 @@ public class ResultSlot extends Slot {
|
||||
@ -47,27 +47,18 @@ index 113460eff5121788fce44d6569ec07deb9701b20..accf752e7615f775483830f81bd0df30
|
||||
for (int i = 0; i < nonNullList.size(); i++) {
|
||||
ItemStack itemStack = this.craftSlots.getItem(i);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
index a0ab3c55826af292d1cdac05648139b4d31f1376..d87124f5356180a37e581febc6141fdc5f1395a7 100644
|
||||
index 0126b88f60904dfbf1e29eb3b89a985061d91f91..a42c7be84e10a06303a7fc23236ac4d84e8323c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
@@ -122,13 +122,16 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
RecipeHolder<T> recipeholder = (RecipeHolder) map.get(id);
|
||||
@@ -116,6 +116,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
RecipeHolder<T> recipeholder = this.byKeyTyped(type, id);
|
||||
|
||||
if (recipeholder != null && recipeholder.value().matches(inventory, world)) {
|
||||
+ inventory.setCurrentRecipe(recipeholder); // Paper - Perf: Improve mass crafting
|
||||
return Optional.of(Pair.of(id, recipeholder));
|
||||
return Optional.of(recipeholder);
|
||||
}
|
||||
}
|
||||
|
||||
+ inventory.setCurrentRecipe(null); // Paper - Perf: Improve mass crafting;; clear before it might be set again
|
||||
return map.entrySet().stream().filter((entry) -> {
|
||||
return ((RecipeHolder) entry.getValue()).value().matches(inventory, world);
|
||||
}).findFirst().map((entry) -> {
|
||||
+ inventory.setCurrentRecipe(entry.getValue()); // Paper - Perf: Improve mass crafting
|
||||
return Pair.of((ResourceLocation) entry.getKey(), (RecipeHolder) entry.getValue());
|
||||
});
|
||||
}
|
||||
@@ -150,7 +153,12 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
@@ -147,7 +148,12 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
}
|
||||
|
||||
public <C extends Container, T extends Recipe<C>> NonNullList<ItemStack> getRemainingItemsFor(RecipeType<T> type, C inventory, Level world) {
|
@ -34,10 +34,10 @@ The results indicate that this logic is 5 times faster than Vanilla
|
||||
and 2.3 times faster than Lithium.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca18b0bc97 100644
|
||||
index 6bd6533e314b64d3512cbb46f5174a4956c323b2..46a14da698eff141b7379aa9c159e6a5c5f7d84c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -111,6 +111,271 @@ public class Explosion {
|
||||
@@ -112,6 +112,271 @@ public class Explosion {
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
return (ExplosionDamageCalculator) (entity == null ? Explosion.EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity));
|
||||
}
|
||||
@@ -171,40 +436,88 @@ public class Explosion {
|
||||
@@ -172,40 +437,88 @@ public class Explosion {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@ -420,7 +420,7 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
set.add(blockposition);
|
||||
// Paper start - prevent headless pistons from forming
|
||||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
||||
@@ -215,11 +528,12 @@ public class Explosion {
|
||||
@@ -216,11 +529,12 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
// Paper end - prevent headless pistons from forming
|
||||
@ -436,7 +436,7 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,6 +553,8 @@ public class Explosion {
|
||||
@@ -240,6 +554,8 @@ public class Explosion {
|
||||
Vec3 vec3d = new Vec3(this.x, this.y, this.z);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@ -445,7 +445,7 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -274,11 +590,11 @@ public class Explosion {
|
||||
@@ -275,11 +591,11 @@ public class Explosion {
|
||||
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
|
||||
// Calculate damage separately for each EntityComplexPart
|
||||
if (list.contains(entityComplexPart)) {
|
||||
@ -459,16 +459,16 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
}
|
||||
|
||||
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
|
||||
@@ -287,7 +603,7 @@ public class Explosion {
|
||||
@@ -288,7 +604,7 @@ public class Explosion {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
|
||||
+ double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity, blockCache, blockPos); // Paper - Optimize explosions
|
||||
- double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity) * (double) this.damageCalculator.getKnockbackMultiplier(entity); // Paper - Optimize explosions
|
||||
+ double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity, blockCache, blockPos) * (double) this.damageCalculator.getKnockbackMultiplier(entity); // Paper - Optimize explosions
|
||||
double d13;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -334,6 +650,9 @@ public class Explosion {
|
||||
@@ -337,6 +653,9 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
}
|
||||
|
||||
public void finalizeExplosion(boolean particles) {
|
||||
@@ -547,14 +866,14 @@ public class Explosion {
|
||||
@@ -550,14 +869,14 @@ public class Explosion {
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
@ -497,11 +497,11 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
index 4085949accf23728de9a2ff14249cd6ca9b71f8a..5b93c038331c1750260a42726f5bfb97998d93a9 100644
|
||||
index 0ef9b402d129b072134688c06719a56328581158..1eb259b48bcab6172c15546744eea410c6a3e1fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
@@ -22,11 +22,17 @@ public class ExplosionDamageCalculator {
|
||||
return true;
|
||||
@@ -26,11 +26,17 @@ public class ExplosionDamageCalculator {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
|
@ -44,10 +44,10 @@ index c3ce8a42dddd76b7189ad5685b23f9d9f8ccadb3..f164256d59b761264876ca0c85f812d1
|
||||
|
||||
public TrackedChunk getChunk(final ChunkPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754b4fcd1e8 100644
|
||||
index 13d15a135dd0373bef4a5ac9ffb56dbbf53353a0..472b9494f8a34a8ba90d6a2936b0db7530a229ad 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -79,11 +79,19 @@ public class ChunkHolder {
|
||||
@@ -77,11 +77,19 @@ public class ChunkHolder {
|
||||
|
||||
// Paper start
|
||||
public void onChunkAdd() {
|
||||
@ -69,7 +69,7 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -230,7 +238,7 @@ public class ChunkHolder {
|
||||
@@ -216,7 +224,7 @@ public class ChunkHolder {
|
||||
|
||||
if (i < 0 || i >= this.changedBlocksPerSection.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296
|
||||
if (this.changedBlocksPerSection[i] == null) {
|
||||
@ -78,7 +78,7 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
|
||||
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
|
||||
}
|
||||
|
||||
@@ -254,6 +262,7 @@ public class ChunkHolder {
|
||||
@@ -236,6 +244,7 @@ public class ChunkHolder {
|
||||
int k = this.lightEngine.getMaxLightSection();
|
||||
|
||||
if (y >= j && y <= k) {
|
||||
@ -86,10 +86,10 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
|
||||
int l = y - j;
|
||||
|
||||
if (lightType == LightLayer.SKY) {
|
||||
@@ -268,8 +277,19 @@ public class ChunkHolder {
|
||||
@@ -254,9 +263,19 @@ public class ChunkHolder {
|
||||
this.broadcast(this.getPlayers(onChunkViewEdge), packet); // Paper - rewrite chunk system
|
||||
}
|
||||
}
|
||||
|
||||
// Paper end - starlight
|
||||
+ // Paper start - optimise chunk tick iteration
|
||||
+ public final boolean needsBroadcastChanges() {
|
||||
+ return this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty();
|
||||
@ -100,7 +100,7 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
|
||||
+ this.chunkMap.needsChangeBroadcasting.add(this);
|
||||
+ }
|
||||
+ // Paper end - optimise chunk tick iteration
|
||||
+
|
||||
|
||||
public void broadcastChanges(LevelChunk chunk) {
|
||||
- if (this.hasChangedSections || !this.skyChangedLightSectionFilter.isEmpty() || !this.blockChangedLightSectionFilter.isEmpty()) {
|
||||
+ if (this.needsBroadcastChanges()) { // Paper - optimise chunk tick iteration; moved into above, other logic needs to call
|
||||
@ -108,10 +108,10 @@ index 2b998bdbe49bf8211b755e0eb7c1bf13ac280eab..627a88ec8c3b215b19b55a6d461c8754
|
||||
List list;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 284f9548d62f9230c668bb1adb8cb8084b7cef7c..12109446fc76a39faee6cda042ca48b3fd3809f4 100644
|
||||
index 9bb56d235a7614cefcd0551a455f9c4ddadb1db0..39cf2abd9aacb5584467f6cde3d7b6e5b1912e96 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -191,6 +191,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -194,6 +194,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerEntityTrackerTrackMaps[i].remove(player);
|
||||
}
|
||||
// Paper end - use distance map to optimise tracker
|
||||
@ -119,7 +119,7 @@ index 284f9548d62f9230c668bb1adb8cb8084b7cef7c..12109446fc76a39faee6cda042ca48b3
|
||||
}
|
||||
|
||||
void updateMaps(ServerPlayer player) {
|
||||
@@ -240,6 +241,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -243,6 +244,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
public final io.papermc.paper.util.player.NearbyPlayers nearbyPlayers;
|
||||
// Paper end
|
||||
@ -129,8 +129,8 @@ index 284f9548d62f9230c668bb1adb8cb8084b7cef7c..12109446fc76a39faee6cda042ca48b3
|
||||
+ // Paper end - optimise chunk tick iteration
|
||||
|
||||
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
|
||||
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
||||
@@ -408,7 +413,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
super(new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
||||
@@ -411,7 +416,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
// Paper end - Optional per player mob spawns
|
||||
|
||||
@ -140,10 +140,10 @@ index 284f9548d62f9230c668bb1adb8cb8084b7cef7c..12109446fc76a39faee6cda042ca48b3
|
||||
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
|
||||
double d2 = d0 - entity.getX();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index c80a625f7289e3bb33c6851d2072957e153ca1fb..7c425ac50c83757b66a2178bc19d4c920b82f12f 100644
|
||||
index ed5154e41ca858f4d6b4d1c276c66831c038d2a6..cdb3c2cde5d9133ef60cf96d91762e6a7c8aeb4a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -50,7 +50,7 @@ public abstract class DistanceManager {
|
||||
@@ -49,7 +49,7 @@ public abstract class DistanceManager {
|
||||
private static final int INITIAL_TICKET_LIST_CAPACITY = 4;
|
||||
final Long2ObjectMap<ObjectSet<ServerPlayer>> playersPerChunk = new Long2ObjectOpenHashMap();
|
||||
// Paper - rewrite chunk system
|
||||
@ -187,10 +187,10 @@ index c80a625f7289e3bb33c6851d2072957e153ca1fb..7c425ac50c83757b66a2178bc19d4c92
|
||||
|
||||
public String getDebugStatus() {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f9edf9ce7 100644
|
||||
index 18640c8681f6a3b2276123d19e3e8f0a8c630b41..b99f50604bafecbc68835974c9ed0caa91911a40 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -508,18 +508,10 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -506,18 +506,10 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
gameprofilerfiller.push("filteringLoadedChunks");
|
||||
@ -209,9 +209,9 @@ index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f
|
||||
- }
|
||||
+ // Paper - optimise chunk tick iteration
|
||||
|
||||
if (this.level.getServer().tickRateManager().runsNormally()) {
|
||||
if (this.level.tickRateManager().runsNormally()) {
|
||||
gameprofilerfiller.popPush("naturalSpawnCount");
|
||||
@@ -554,38 +546,109 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -552,38 +544,109 @@ public class ServerChunkCache extends ChunkSource {
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||
|
||||
@ -337,7 +337,7 @@ index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f
|
||||
this.level.timings.chunkTicks.stopTiming(); // Paper
|
||||
|
||||
gameprofilerfiller.popPush("customSpawners");
|
||||
@@ -597,11 +660,23 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -595,11 +658,23 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
|
||||
gameprofilerfiller.popPush("broadcast");
|
||||
@ -365,10 +365,10 @@ index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 17a6d43685f35a6978c2d941876a1f8a9a2c8b42..b3781efbd3edcf102fe1bda5d6149915dc1127c6 100644
|
||||
index ed42a78aebeda86b77f27cba4fcefbc6c17f86fc..49d612c1b84fe4f2335c9cf91cce5f60b6779ff6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -325,6 +325,9 @@ public class ServerPlayer extends Player {
|
||||
@@ -341,6 +341,9 @@ public class ServerPlayer extends Player {
|
||||
});
|
||||
}
|
||||
// Paper end - replace player chunk loader
|
@ -8,10 +8,10 @@ Areas affected by lag comepnsation:
|
||||
- Eating food items
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 2f263ef5120982b3167ab008a0e22b8cbc9b9fdd..f03f6922d15541c5491e5b37a3efa7ef0abef211 100644
|
||||
index 1adcbfb16ea1fe3378cde7c53e8868840eade963..5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -318,6 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
@ -19,19 +19,19 @@ index 2f263ef5120982b3167ab008a0e22b8cbc9b9fdd..f03f6922d15541c5491e5b37a3efa7ef
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -1693,6 +1694,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1757,6 +1758,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
||||
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||
+ worldserver.updateLagCompensationTick(); // Paper - lag compensation
|
||||
|
||||
this.profiler.push(() -> {
|
||||
return worldserver + " " + worldserver.dimension().location();
|
||||
String s = String.valueOf(worldserver);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c9405cbea1202e5603dde42637cf2a78592b92e1..8a5abc320137d045acba0c87cef9f2912d78b6fb 100644
|
||||
index a2a5a43c5e73ba2cccbec4e1ac563f692ae901b5..14e37f4720f35c5aca1f31f1de5f60f7d9ef06cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -565,6 +565,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return player != null && player.level() == this ? player : null;
|
||||
}
|
||||
// Paper end - optimise getPlayerByUUID
|
||||
@ -50,10 +50,10 @@ index c9405cbea1202e5603dde42637cf2a78592b92e1..8a5abc320137d045acba0c87cef9f291
|
||||
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index ef3048a4748113538a0ee0af5b526b2cd51d5c29..a7b217ddbcbf92513bd38101fdfca2075505e267 100644
|
||||
index 3b6ebe8f9575783a1607eb6667554ca66de94271..969e64364cdc9ef419328ba3a3a9444cc83af813 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -124,7 +124,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -127,7 +127,7 @@ public class ServerPlayerGameMode {
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@ -63,10 +63,10 @@ index ef3048a4748113538a0ee0af5b526b2cd51d5c29..a7b217ddbcbf92513bd38101fdfca207
|
||||
|
||||
if (this.hasDelayedDestroy) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d8a7d066c 100644
|
||||
index 9ff43ff4076c658b8561c5a7abd067423830f964..1ba83df3c2717dbd027b02d4d69e50091977d35f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3849,6 +3849,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3833,6 +3833,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
|
||||
}
|
||||
// Paper end - Properly cancel usable items
|
||||
@ -77,7 +77,7 @@ index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d
|
||||
private void updatingUsingItem() {
|
||||
if (this.isUsingItem()) {
|
||||
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||
@@ -3867,7 +3871,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3851,7 +3855,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.triggerItemUseEffects(stack, 5);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d
|
||||
this.completeUsingItem();
|
||||
}
|
||||
|
||||
@@ -3915,7 +3924,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3897,7 +3906,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper - Prevent consuming the wrong itemstack
|
||||
this.useItem = itemstack;
|
||||
@ -103,7 +103,7 @@ index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d
|
||||
if (!this.level().isClientSide) {
|
||||
this.setLivingEntityFlag(1, true);
|
||||
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
||||
@@ -3940,7 +3952,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3922,7 +3934,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
@ -115,7 +115,7 @@ index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4075,7 +4090,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4057,7 +4072,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.useItem = ItemStack.EMPTY;
|
@ -8,10 +8,10 @@ we can instead use the nearby player tracking system to reduce
|
||||
the number of tests per search.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 8a5abc320137d045acba0c87cef9f2912d78b6fb..6907d1be36fbdf0856c0e11983218d2fd1f9cb46 100644
|
||||
index 14e37f4720f35c5aca1f31f1de5f60f7d9ef06cd..16387f864b24c649927d5883d8158b0f7e6d0854 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -576,6 +576,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -581,6 +581,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
this.lagCompensationTick = (System.nanoTime() - net.minecraft.server.MinecraftServer.SERVER_INIT) / (java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(50L));
|
||||
}
|
||||
// Paper end - lag compensation
|
@ -9,10 +9,10 @@ creating too large of a packet to sed.
|
||||
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
index 454bec4f8843e7e4e42cd8a8132b557ead292dcc..76bde683d193b37e563a67c1c7b9bdcf17d64524 100644
|
||||
index 05e29a703f022b5047262bae8caef33d9dfb9035..2501fbaf497d226051800c53d60a39bbc80db91c 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||
@@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData {
|
||||
@@ -27,6 +27,14 @@ public class ClientboundLevelChunkPacketData {
|
||||
private final CompoundTag heightmaps;
|
||||
private final byte[] buffer;
|
||||
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
|
||||
@ -27,7 +27,7 @@ index 454bec4f8843e7e4e42cd8a8132b557ead292dcc..76bde683d193b37e563a67c1c7b9bdcf
|
||||
|
||||
// Paper start - Anti-Xray - Add chunk packet info
|
||||
@Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); }
|
||||
@@ -47,8 +55,18 @@ public class ClientboundLevelChunkPacketData {
|
||||
@@ -50,8 +58,18 @@ public class ClientboundLevelChunkPacketData {
|
||||
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo);
|
||||
// Paper end
|
||||
this.blockEntitiesData = Lists.newArrayList();
|
||||
@ -47,10 +47,10 @@ index 454bec4f8843e7e4e42cd8a8132b557ead292dcc..76bde683d193b37e563a67c1c7b9bdcf
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
index 6412dff5ed0505f62dd5b71ab9606257858a7317..fc230d835f9aa526a4b179d36d921f0fec348aa8 100644
|
||||
index 8ead66c134688b11dca15f6509147e726f182e6a..cfcac0fdc130120cb1f8d97c6353d93db7ddf81b 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
@@ -74,4 +74,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
|
||||
@@ -83,4 +83,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
|
||||
public ClientboundLightUpdatePacketData getLightData() {
|
||||
return this.lightData;
|
||||
}
|
@ -9,7 +9,7 @@ Configurable under
|
||||
`send-full-pos-for-hard-colliding-entities`
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 9154af6523f4eaab1636e0bad30f743244e47471..529ab44baaf573b97cf7e89560c548642733188f 100644
|
||||
index 22eec853588ded2d255ab69d408f8e987832abe2..4f103f731623a8570238a6867fda1c5f83fca4e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -183,7 +183,7 @@ public class ServerEntity {
|
Loading…
Reference in New Issue
Block a user