First batch of server patches

This commit is contained in:
Noah van der Aa 2024-10-22 19:28:57 +02:00
parent aecac94dbf
commit 1fd2daa6a6
1071 changed files with 335 additions and 257 deletions

View file

@ -67,7 +67,7 @@ repositories {
}
dependencies {
paramMappings("net.fabricmc:yarn:1.21.1+build.3:mergedv2")
paramMappings("net.fabricmc:yarn:1.21.2+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")

View file

@ -2611,7 +2611,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable {
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource {
public static final Logger LOGGER = LogUtils.getLogger();
+ public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper
@ -2639,10 +2639,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private ServerStatus.Players buildPlayerStatus() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
SpigotTimings.schedulerTimer.startTiming(); // Spigot
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
SpigotTimings.schedulerTimer.stopTiming(); // Spigot
+ io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
this.profiler.push("commandFunctions");
gameprofilerfiller.push("commandFunctions");
SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
this.getFunctions().tick();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -2725,8 +2725,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public String displayName;
+ public net.kyori.adventure.text.Component adventure$displayName; // Paper
public Component listName;
public int listOrder = 0;
public org.bukkit.Location compassTarget;
public int newExp = 0;
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
// CraftBukkit start
@ -3265,7 +3265,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity {
// CraftBukkit start
Player player = ((ServerPlayer) entityhuman).getBukkitEntity();
@ -3578,7 +3578,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.connection.send(io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, player.getX(), player.getY(), player.getZ(), seed, null));
+ }
+ }
+
@Override
public void playSound(Entity entity, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
}
+ @Override
+ public void playSound(final net.kyori.adventure.sound.Sound sound, final double x, final double y, final double z) {
+ org.spigotmc.AsyncCatcher.catchOp("play sound"); // Paper
@ -3604,10 +3610,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private java.util.function.BiConsumer<net.minecraft.network.protocol.Packet<?>, Float> playSound0(final double x, final double y, final double z) {
+ return (packet, distance) -> this.world.getServer().getPlayerList().broadcast(null, x, y, z, distance, this.world.dimension(), packet);
+ }
+ // Paper end
private static Map<String, GameRules.Key<?>> gamerules;
public static synchronized Map<String, GameRules.Key<?>> getGameRulesNMS() {
+ // Paper end - Adventure
+
private Map<String, GameRules.Key<?>> gamerules;
public synchronized Map<String, GameRules.Key<?>> getGameRulesNMS() {
if (this.gamerules != null) {
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public void setSendViewDistance(final int viewDistance) {
throw new UnsupportedOperationException("Not implemented yet");
@ -3694,7 +3701,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java
@@ -0,0 +0,0 @@ public abstract class CraftContainer<T extends BaseContainerBlockEntity> extends
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
}
}
+ // Paper start
@ -4201,7 +4208,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (player.getBukkitEntity().canSee(this)) {
player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle()));
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
this.getHandle().listOrder = order;
}
- private Component playerListHeader;
@ -4688,7 +4695,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure
CraftPlayer entity = victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage);
@@ -0,0 +0,0 @@ public class CraftEventFactory {
* Server methods
*/
@ -4825,7 +4832,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
Optional<HolderSet.Named<Enchantment>> optional = (allowTreasures) ? Optional.empty() : registry.registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.IN_ENCHANTING_TABLE);
Optional<HolderSet.Named<Enchantment>> optional = (allowTreasures) ? Optional.empty() : registry.lookupOrThrow(Registries.ENCHANTMENT).get(EnchantmentTags.IN_ENCHANTING_TABLE);
return CraftItemStack.asCraftMirror(EnchantmentHelper.enchantItem(source, craft.handle, level, registry, optional));
}
+
@ -5195,7 +5202,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasEnchantable() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.hasTooltipStyle() || this.hasItemModel() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isGlider() || this.hasDamageResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasUseRemainder() || this.hasUseCooldown() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasEquippable() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
}
+ // Paper start

View file

@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
+ }
+ // Paper end - Allow nerfed mobs to jump and float
ProfilerFiller gameprofilerfiller = this.level().getProfiler();
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("sensing");
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java

View file

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.7.1")
implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
@@ -0,0 +0,0 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -28);
deadline.add(Calendar.DAY_OF_YEAR, -3);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View file

@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
long l = minecraftserver.getWorldData().worldGenOptions().seed();

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -0,0 +0,0 @@ public class FishingHook extends Projectile {
this.noCulling = true;
this.currentState = FishingHook.FishHookState.FLYING;
this.luck = Math.max(0, luckBonus);
this.lureSpeed = Math.max(0, waitTimeReductionTicks);
+ // Paper start - Configurable fishing time ranges

View file

@ -143,8 +143,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
+ lastTick = currentTime;
this.nextTickTimeNanos += i;
this.startMetricsRecordingTick();
this.profiler.push("tick");
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -0,0 +0,0 @@ public class BuiltInRegistries {
Bootstrap.checkBootstrapCalled(() -> "registry " + key);
Bootstrap.checkBootstrapCalled(() -> "registry " + key.location());
ResourceLocation resourceLocation = key.location();
LOADERS.put(resourceLocation, () -> initializer.run(registry));
- WRITABLE_REGISTRY.register((ResourceKey<WritableRegistry<?>>)key, registry, RegistrationInfo.BUILT_IN);
@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return stream.<Pack>map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore?
}, this).thenCompose((immutablelist) -> {
MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist);
List<Registry.PendingTags<?>> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess());
diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/util/SortedArraySet.java
@ -101,9 +101,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
@@ -0,0 +0,0 @@ public class Pillager extends AbstractIllager implements CrossbowAttackMob, Inve
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Creaking.class, 8.0F, 1.0D, 1.2D));
- this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, this, 10.0F));
+ this.goalSelector.addGoal(2, new Raider.HoldGroundAttackGoal(this, 10.0F)); // Paper - decomp fix
this.goalSelector.addGoal(3, new RangedCrossbowAttackGoal<>(this, 1.0D, 8.0F));
@ -114,8 +114,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -0,0 +0,0 @@ public class ChunkStatusTasks {
if (protochunk instanceof ImposterProtoChunk) {
chunk1 = ((ImposterProtoChunk) protochunk).getWrapped();
if (protochunk instanceof ImposterProtoChunk protochunkextension) {
chunk1 = protochunkextension.getWrapped();
} else {
- chunk1 = new LevelChunk(worldserver, protochunk, (chunk1) -> {
+ chunk1 = new LevelChunk(worldserver, protochunk, ($) -> { // Paper - decompile fix

View file

@ -4419,6 +4419,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (Runtime.getRuntime().availableProcessors() > 4) {
thread.setPriority(8);
}
-
S s0 = serverFactory.apply(thread); // CraftBukkit - decompile error
atomicreference.set(s0);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
}
@ -4429,14 +4437,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json");
this.getProfileCache().save();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.debug("Autosave finished");
SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
-
this.profiler.push("tallying");
long j = Util.getNanos() - i;
int k = this.tickCount % 100;
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
@ -4563,7 +4563,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super(new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.worldGenContext = new WorldGenContext(world, chunkGenerator, structureTemplateManager, this.lightEngine, this.mainThreadMailbox);
this.chunksToEagerlySave.add(pos.toLong());
}
+ // Paper start
@ -4590,7 +4590,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this::onLevelChange, this);
+ // Paper start
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderCreate(this.level, holder);
+ // Paper end
@ -4607,49 +4607,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
do {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
this.flushWorker();
} else {
- this.visibleChunkMap.values().forEach(this::saveChunkIfNeeded);
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.getVisibleChunkHolders(this.level).forEach(this::saveChunkIfNeeded);
}
this.nextChunkSaveTime.clear();
long i = Util.getMillis();
- ObjectIterator objectiterator = this.visibleChunkMap.values().iterator();
+ Iterator<ChunkHolder> objectiterator = ca.spottedleaf.moonrise.common.util.ChunkSystem.getVisibleChunkHolders(this.level).iterator(); // Paper
}
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
- return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || !this.updatingChunkMap.isEmpty() || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.queueSorter.hasWork() || this.distanceManager.hasTickets();
+ return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || ca.spottedleaf.moonrise.common.util.ChunkSystem.hasAnyChunkHolders(this.level) || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.queueSorter.hasWork() || this.distanceManager.hasTickets(); // Paper
- return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || !this.updatingChunkMap.isEmpty() || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.worldgenTaskDispatcher.hasWork() || this.lightTaskDispatcher.hasWork() || this.distanceManager.hasTickets();
+ return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || ca.spottedleaf.moonrise.common.util.ChunkSystem.hasAnyChunkHolders(this.level) || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.queueSorter.hasWork() || this.lightTaskDispatcher.hasWork() || this.distanceManager.hasTickets(); // Paper
}
private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
- ObjectIterator<ChunkHolder> objectiterator = this.visibleChunkMap.values().iterator();
+ Iterator<ChunkHolder> objectiterator = ca.spottedleaf.moonrise.common.util.ChunkSystem.getVisibleChunkHolders(this.level).iterator(); // Paper
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.scheduleUnload(pos, chunk);
} else {
ChunkAccess ichunkaccess = holder.getLatestChunk();
- if (this.pendingUnloads.remove(pos, holder) && ichunkaccess != null) {
ChunkAccess ichunkaccess = chunk.getLatestChunk();
-
- if (this.pendingUnloads.remove(pos, chunk) && ichunkaccess != null) {
- LevelChunk chunk1;
+ // Paper start
+ boolean removed;
+ if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, holder);
+ if ((removed = this.pendingUnloads.remove(pos, chunk)) && ichunkaccess != null) {
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk);
+ // Paper end
LevelChunk chunk;
+ LevelChunk chunk;
if (ichunkaccess instanceof LevelChunk) {
chunk1 = (LevelChunk) ichunkaccess;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
this.nextChunkSaveTime.remove(ichunkaccess.getPos().toLong());
- }
+ } else if (removed) { // Paper start
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, holder);
@ -4735,14 +4729,6 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.LevelStorageSource;
public class ServerChunkCache extends ChunkSource {
+ public static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList();
private final DistanceManager distanceManager;
final ServerLevel level;
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@VisibleForDebug
@ -4829,13 +4815,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
public boolean isPositionTicking(long pos) {
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
if (!this.level.shouldTickBlocksAt(pos)) {
return false;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.convertable.dimensionType;
}
@ -4933,7 +4919,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
// 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) {
// IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
@ -5018,7 +5004,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
@Override
public void tell(R runnable) {
public void schedule(R runnable) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
@ -5286,15 +5272,15 @@ diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
@@ -0,0 +0,0 @@ import net.minecraft.core.Holder;
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.SectionPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.util.profiling.ProfilerFiller;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
@@ -0,0 +0,0 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
@@ -0,0 +0,0 @@ public class PathNavigationRegion implements CollisionGetter {
private ChunkAccess getChunk(int chunkX, int chunkZ) {
int i = chunkX - this.centerX;
int j = chunkZ - this.centerZ;
@ -5303,7 +5289,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ChunkAccess chunkAccess = this.chunks[i][j];
return (ChunkAccess)(chunkAccess != null ? chunkAccess : new EmptyLevelChunk(this.level, new ChunkPos(chunkX, chunkZ), this.plains.get()));
} else {
@@ -0,0 +0,0 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
@@ -0,0 +0,0 @@ public class PathNavigationRegion implements CollisionGetter {
}
}
@ -5352,9 +5338,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
this.legacySolid = this.calculateSolid();
}
this.occlusionShape = this.canOcclude ? ((Block) this.owner).getOcclusionShape(this.asState()) : Shapes.empty();
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.getBlock().getOcclusionShape(this.asState(), world, pos);
return this.occlusionShape;
}
- public boolean hasLargeCollisionShape() {
@ -5368,16 +5354,16 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
protected final ShortList[] postProcessing;
protected volatile boolean unsaved;
private volatile boolean unsaved;
private volatile boolean isLightCorrect;
- protected final ChunkPos chunkPos;
+ protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
private long inhabitedTime;
/** @deprecated */
@Nullable
@@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
// CraftBukkit end
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) {
@ -5505,7 +5491,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -0,0 +0,0 @@ public class ProtoChunk extends ChunkAccess {
return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks);
return new ChunkAccess.PackedTicks(this.blockTicks.pack(time), this.fluidTicks.pack(time));
}
+ // Paper start - If loaded util
@ -5717,8 +5703,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
@@ -0,0 +0,0 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
public int getMoonPhase() {
return this.handle.getMoonPhase();
public boolean isFluidAtPosition(BlockPos pos, Predicate<FluidState> state) {
return this.handle.isFluidAtPosition(pos, state);
}
+
+ // Paper start
@ -5741,6 +5727,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
}
+
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java

View file

@ -7334,7 +7334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
return nmsItemStack.getItem().getDescriptionId();
}
+ // Paper start
+ @Override

View file

@ -24,8 +24,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
implementation("org.ow2.asm:asm-commons:9.7.1")
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -5188,12 +5188,12 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs
// 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) {
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs
this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@ -5218,8 +5218,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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) {
+ 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
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, 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
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
+ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen;
@ -5236,7 +5236,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.console.paperConfigurations.reloadConfigs(this.console);
for (ServerLevel world : this.console.getAllLevels()) {
world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
world.setSpawnSettings(config.spawnMonsters);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java

View file

@ -1587,8 +1587,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
@Override
public boolean isSpawningAnimals() {
return this.getProperties().spawnAnimals && super.isSpawningAnimals();
public boolean isSpawningMonsters() {
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
diff --git a/src/main/java/net/neoforged/art/internal/RenamerImpl.java b/src/main/java/net/neoforged/art/internal/RenamerImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View file

@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private final Builder<LootItemFunction> functions = ImmutableList.builder();
+ private final ImmutableList.Builder<LootPool> pools = ImmutableList.builder();
+ private final ImmutableList.Builder<LootItemFunction> functions = ImmutableList.builder();
private LootContextParamSet paramSet;
private ContextKeySet paramSet;
private Optional<ResourceLocation> randomSequence;
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java

View file

@ -616,7 +616,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@DefaultQualifier(NonNull.class)
public final class MappingEnvironment {
+ public static final boolean DISABLE_PLUGIN_REMAPPING = Boolean.getBoolean("paper.disablePluginRemapping");
+ public static final String LEGACY_CB_VERSION = "v1_21_R1";
+ public static final String LEGACY_CB_VERSION = "v1_21_R2";
private static final @Nullable String MAPPINGS_HASH = readMappingsHash();
private static final boolean REOBF = checkReobf();

View file

@ -47,8 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ implementation("org.ow2.asm:asm-commons:9.7.1")
+ implementation("commons-lang:commons-lang:2.6")
+ runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
+ runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
+ runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
+ runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
+
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+}
+
+paperweight {
+ craftBukkitPackageVersion.set("v1_21_R1") // also needs to be updated in MappingEnvironment
+ craftBukkitPackageVersion.set("v1_21_R2") // also needs to be updated in MappingEnvironment
+}
+
+tasks.jar {
@ -192,7 +192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <api.version>unknown</api.version>
- <bt.name>git</bt.name>
- <minecraft_version>1_21_R1</minecraft_version>
- <minecraft_version>1_21_R2</minecraft_version>
- <maven.compiler.release>21</maven.compiler.release>
- </properties>
-
@ -235,7 +235,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <version>9.7.1</version>
- <scope>compile</scope>
- </dependency>
- <!-- Mojang depends -->
- <!-- Start Mojang depends -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.13.4</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.13.4</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.13.4.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.github.oshi</groupId>
- <artifactId>oshi-core</artifactId>
@ -243,15 +261,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.github.stephenc.jcip</groupId>
- <artifactId>jcip-annotations</artifactId>
- <version>1.0-1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.microsoft.azure</groupId>
- <artifactId>msal4j</artifactId>
- <version>1.15.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.mojang</groupId>
- <artifactId>authlib</artifactId>
- <version>6.0.54</version>
- <version>6.0.55</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.mojang</groupId>
- <artifactId>brigadier</artifactId>
- <version>1.2.9</version>
- <version>1.3.10</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
@ -262,8 +292,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- </dependency>
- <dependency>
- <groupId>com.mojang</groupId>
- <artifactId>jtracy</artifactId>
- <version>1.0.29</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.mojang</groupId>
- <artifactId>logging</artifactId>
- <version>1.2.7</version>
- <version>1.4.9</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.nimbusds</groupId>
- <artifactId>content-type</artifactId>
- <version>2.3</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.nimbusds</groupId>
- <artifactId>lang-tag</artifactId>
- <version>1.7</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.nimbusds</groupId>
- <artifactId>nimbus-jose-jwt</artifactId>
- <version>9.37.3</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.nimbusds</groupId>
- <artifactId>oauth2-oidc-sdk</artifactId>
- <version>11.9.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
@ -353,6 +413,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.minidev</groupId>
- <artifactId>accessors-smart</artifactId>
- <version>2.5.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.minidev</groupId>
- <artifactId>json-smart</artifactId>
- <version>2.5.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
- <version>5.0.4</version>
@ -366,6 +438,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <version>2.22.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>2.22.1</version>
- <scope>compile</scope>
@ -377,17 +455,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>2.0.9</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.lz4</groupId>
- <artifactId>lz4-java</artifactId>
- <version>1.8.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>2.0.9</version>
- <scope>compile</scope>
- </dependency>
- <!-- End Mojang depends -->
- <!-- deprecated API depend -->
- <dependency>
- <groupId>commons-lang</groupId>
@ -411,13 +490,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency>
- <groupId>org.xerial</groupId>
- <artifactId>sqlite-jdbc</artifactId>
- <version>3.46.0.0</version>
- <version>3.46.1.3</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId>
- <version>8.4.0</version>
- <version>9.1.0</version>
- <scope>runtime</scope>
- </dependency>
- <!-- add these back in as they are not exposed by the API -->

View file

@ -395,7 +395,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
- TagKey<FluidType> fluidTagKey = TagKey.create(Registries.FLUID, key);
+ TagKey<net.minecraft.world.level.material.Fluid> fluidTagKey = TagKey.create(Registries.FLUID, key); // Paper - address remapping issues
if (BuiltInRegistries.FLUID.getTag(fluidTagKey).isPresent()) {
if (BuiltInRegistries.FLUID.get(fluidTagKey).isPresent()) {
return new CraftFluidTag(BuiltInRegistries.FLUID, fluidTagKey);
}
}
@ -403,7 +403,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type");
- TagKey<EntityTypes<?>> entityTagKey = TagKey.create(Registries.ENTITY_TYPE, key);
+ TagKey<net.minecraft.world.entity.EntityType<?>> entityTagKey = TagKey.create(Registries.ENTITY_TYPE, key); // Paper - address remapping issues
if (BuiltInRegistries.ENTITY_TYPE.getTag(entityTagKey).isPresent()) {
if (BuiltInRegistries.ENTITY_TYPE.get(entityTagKey).isPresent()) {
return new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey);
}
}
@ -429,14 +429,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/test/java/org/bukkit/support/RegistryHelper.java
+++ b/src/test/java/org/bukkit/support/RegistryHelper.java
@@ -0,0 +0,0 @@ public final class RegistryHelper {
private static LayeredRegistryAccess<RegistryLayer> createLayers(MultiPackResourceManager resourceManager) {
// add tags and loot tables for unit tests
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
List<HolderLookup.RegistryLookup<?>> list1 = TagLoader.buildUpdatedLookups(iregistrycustom_dimension, list);
RegistryAccess.Frozen iregistrycustom_dimension1 = RegistryDataLoader.load((ResourceManager) ireloadableresourcemanager, list1, RegistryDataLoader.WORLDGEN_REGISTRIES);
LayeredRegistryAccess<RegistryLayer> layers = layeredregistryaccess.replaceFrom(RegistryLayer.WORLDGEN, iregistrycustom_dimension1);
+ // Paper start - load registry here to ensure bukkit object registry are correctly delayed if needed
+ try {
+ Class.forName("org.bukkit.Registry");
+ } catch (final ClassNotFoundException ignored) {}
+ // Paper end - load registry here to ensure bukkit object registry are correctly delayed if needed
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
return layers;
return layers.compositeAccess().freeze();
}
@@ -0,0 +0,0 @@ public final class RegistryHelper {
List<HolderLookup.RegistryLookup<?>> list1 = TagLoader.buildUpdatedLookups(iregistrycustom_dimension, list);
RegistryAccess.Frozen iregistrycustom_dimension1 = RegistryDataLoader.load((ResourceManager) ireloadableresourcemanager, list1, RegistryDataLoader.WORLDGEN_REGISTRIES);
LayeredRegistryAccess<RegistryLayer> layers = layeredregistryaccess.replaceFrom(RegistryLayer.WORLDGEN, iregistrycustom_dimension1);
+ // Paper start - load registry here to ensure bukkit object registry are correctly delayed if needed
+ try {
+ Class.forName("org.bukkit.Registry");
+ } catch (final ClassNotFoundException ignored) {}
+ // Paper end - load registry here to ensure bukkit object registry are correctly delayed if needed
RegistryHelper.registry = layers.compositeAccess().freeze();
// Register vanilla pack
RegistryHelper.dataPack = ReloadableServerResources.loadResources(ireloadableresourcemanager, layers, list, featureFlagSet, Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();

View file

@ -724,7 +724,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable {
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
@ -761,21 +761,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void waitUntilNextTick() {
- this.runAllTasks();
+ //this.executeAll(); // Paper - move this into the tick method for timings
+ //this.runAllTasks(); // Paper - move this into the tick method for timings
this.waitingForNextTick = true;
try {
this.managedBlock(() -> {
- return !this.haveTime();
+ return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
});
}
} finally {
this.waitingForNextTick = false;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
- org.spigotmc.WatchdogThread.tick(); // Spigot
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
long i = Util.getNanos();
int j = this.pauseWhileEmptySeconds() * 20;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
+ // Paper start - move oversleep into full server tick
+ isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
+ this.managedBlock(() -> {
@ -788,34 +797,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.tickRateManager.tick();
this.tickChildren(shouldKeepTicking);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.autosavePeriod > 0 && this.ticksUntilAutosave <= 0) {
this.ticksUntilAutosave = this.autosavePeriod;
// CraftBukkit end
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
this.saveEverything(true, false, false);
this.profiler.pop();
MinecraftServer.LOGGER.debug("Autosave finished");
- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
ProfilerFiller gameprofilerfiller = Profiler.get();
+ // Paper start - move executeAll() into full server tick timing
+ try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
+ this.runAllTasks();
+ }
+ // Paper end
this.profiler.push("tallying");
long j = Util.getNanos() - i;
int k = this.tickCount % 100;
gameprofilerfiller.push("tallying");
long k = Util.getNanos() - i;
int l = this.tickCount % 100;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
this.logTickMethodTime(i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
gameprofilerfiller.pop();
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot
- org.spigotmc.CustomTimingsHandler.tick(); // Spigot
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
private void autoSave() {
this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot
MinecraftServer.LOGGER.debug("Autosave started");
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.saveEverything(true, false, false);
gameprofilerfiller.pop();
MinecraftServer.LOGGER.debug("Autosave finished");
- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
private void logTickMethodTime(long tickStartTime) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
@ -823,17 +837,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
});
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
this.profiler.push("commandFunctions");
gameprofilerfiller.push("commandFunctions");
- SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
this.getFunctions().tick();
- SpigotTimings.commandFunctionsTimer.stopTiming(); // Spigot
+ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
this.profiler.popPush("levels");
gameprofilerfiller.popPush("levels");
Iterator iterator = this.getAllLevels().iterator();
// CraftBukkit start
@ -852,7 +866,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
}
}
- SpigotTimings.timeUpdateTimer.stopTiming(); // Spigot
@ -863,13 +877,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.profiler.popPush("connection");
gameprofilerfiller.popPush("connection");
- SpigotTimings.connectionTimer.startTiming(); // Spigot
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
this.getConnection().tick();
this.tickConnection();
- SpigotTimings.connectionTimer.stopTiming(); // Spigot
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Paper
this.profiler.popPush("players");
gameprofilerfiller.popPush("players");
- SpigotTimings.playerListTimer.startTiming(); // Spigot
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
this.playerList.tick();
@ -879,7 +893,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
GameTestTicker.SINGLETON.tick();
}
this.profiler.popPush("server gui refresh");
gameprofilerfiller.popPush("server gui refresh");
- SpigotTimings.tickablesTimer.startTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
@ -889,7 +903,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- SpigotTimings.tickablesTimer.stopTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
this.profiler.popPush("send chunks");
gameprofilerfiller.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -1051,7 +1065,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks");
gameprofilerfiller.popPush("chunks");
if (tickChunks) {
+ this.level.timings.chunks.startTiming(); // Paper - timings
this.tickChunks();
@ -1063,52 +1077,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level.timings.doChunkUnload.startTiming(); // Spigot
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("filteringLoadedChunks");
List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(this.chunkMap.size());
Iterator iterator = this.chunkMap.getChunks().iterator();
gameprofilerfiller.pop();
this.clearCache();
}
+ if (this.level.getServer().tickRateManager().runsNormally()) this.level.timings.chunkTicks.startTiming(); // Paper
while (iterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) iterator.next();
private void tickChunks() {
long i = this.level.getGameTime();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
LevelChunk chunk = playerchunk.getTickingChunk();
if (chunk != null) {
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
playerchunk.broadcastChanges(chunk);
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
}
}
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
if (this.level.tickRateManager().runsNormally()) {
gameprofilerfiller.popPush("naturalSpawnCount");
private void tickChunks(ProfilerFiller profiler, long timeDelta, List<LevelChunk> chunks) {
profiler.popPush("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int k = this.distanceManager.getNaturalSpawnChunkCount();
NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
int j = this.distanceManager.getNaturalSpawnChunkCount();
NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(j, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("spawnAndTick");
profiler.popPush("spawnAndTick");
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
}
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
- this.level.timings.doTickTiles.startTiming(); // Spigot
this.level.tickChunk(chunk1, l);
this.level.tickChunk(chunk, k);
- this.level.timings.doTickTiles.stopTiming(); // Spigot
}
}
}
+ this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners");
+ this.level.timings.chunkTicks.stopTiming(); // Paper
+
profiler.popPush("customSpawners");
if (flag) {
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
+ } // Paper - timings
}
+ }
}
gameprofilerfiller.popPush("broadcast");
list.forEach((chunkproviderserver_a1) -> {
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
chunkproviderserver_a1.holder.broadcastChanges(chunkproviderserver_a1.chunk);
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
});
gameprofilerfiller.pop();
gameprofilerfiller.pop();
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
@ -1130,16 +1146,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
import org.bukkit.craftbukkit.util.WorldUUID;
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
gameprofilerfiller.popPush("tickPending");
gameprofilerfiller.push("tickPending");
- this.timings.doTickPending.startTiming(); // Spigot
+ this.timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
}
@ -1160,7 +1176,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
gameprofilerfiller.popPush("blockEvents");
if (flag) {
this.timings.doSounds.startTiming(); // Spigot
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
gameprofilerfiller.popPush("tickBlocks");
@ -1168,7 +1184,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (randomTickSpeed > 0) {
LevelChunkSection[] achunksection = chunk.getSections();
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
@ -1176,7 +1192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
gameprofilerfiller.pop();
}
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public void tickNonPassenger(Entity entity) {
@ -1198,9 +1214,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ try {
+ // Paper end - timings
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler();
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.tickPassenger(entity, entity1);
}
@ -1209,7 +1225,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
@ -1217,7 +1233,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
@ -1322,19 +1338,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void move(MoverType movementType, Vec3 movement) {
public void move(MoverType type, Vec3 movement) {
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.level().getProfiler().pop();
gameprofilerfiller.pop();
}
}
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
}
private boolean isStateClimbable(BlockState state) {
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission moveEffect, Vec3 movement, BlockPos landingPos, BlockState landingState) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
@ -1342,7 +1358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional<ResourceKey<LootTable>> lootTable, FeatureFlagSet requiredFeatures) {
+ // Paper start
+ this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, requiredFeatures, "custom");
+ }
@ -1351,6 +1367,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick");
+ this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick");
+ this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick");
+ this.id = id;
+ // Paper end
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
this.factory = factory;
@ -1364,16 +1381,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final co.aikar.timings.Timing inactiveTickTimer;
+ public final co.aikar.timings.Timing passengerTickTimer;
+ public final co.aikar.timings.Timing passengerInactiveTickTimer;
+ private final String id;
+ // Paper end
public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
}
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
Util.fetchChoiceType(References.ENTITY_TREE, id);
Util.fetchChoiceType(References.ENTITY_TREE, registryKey.location().toString());
}
- return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, this.requiredFeatures);
+ return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, this.requiredFeatures, id); // Paper - add id
- return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, (String) this.descriptionId.get(registryKey), (Optional) this.lootTable.get(registryKey), this.requiredFeatures);
+ return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, (String) this.descriptionId.get(registryKey), (Optional) this.lootTable.get(registryKey), this.requiredFeatures, this.id); // Paper - add id
}
}
@ -1409,35 +1427,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
double d0 = this.getX() - this.xo;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.refreshDimensions();
}
this.elytraAnimationState.tick();
- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
}
public void detectEquipmentUpdatesPublic() { // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
ProfilerFiller gameprofilerfiller = Profiler.get();
this.setDeltaMovement(d0, d1, d2);
this.level().getProfiler().push("ai");
gameprofilerfiller.push("ai");
- SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.serverAiStep();
this.level().getProfiler().pop();
gameprofilerfiller.pop();
}
- SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.level().getProfiler().pop();
this.level().getProfiler().push("jump");
gameprofilerfiller.pop();
gameprofilerfiller.push("jump");
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.resetFallDistance();
}
- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
label104:
label112:
{
LivingEntity entityliving = this.getControllingPassenger();
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -1446,8 +1464,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
this.applyEffectsFromBlocks();
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
@ -1455,9 +1473,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.pushEntities();
- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
this.level().getProfiler().pop();
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
gameprofilerfiller.pop();
world = this.level();
if (world instanceof ServerLevel worldserver) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
@ -1523,8 +1541,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
@Nullable
private String descriptionId;
@Nullable
private Item item;
private static final int CACHE_SIZE = 256;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@ -1563,32 +1581,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -0,0 +0,0 @@ public class ChunkSerializer {
ListTag nbttaglist1 = ChunkSerializer.getListOfCompoundsOrNull(nbt, "block_entities");
return nbttaglist == null && nbttaglist1 == null ? null : (chunk) -> {
- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot
if (nbttaglist != null) {
world.addLegacyChunkEntities(EntityType.loadEntitiesRecursive(nbttaglist, world));
}
- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot
- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot
if (nbttaglist1 != null) {
for (int i = 0; i < nbttaglist1.size(); ++i) {
CompoundTag nbttagcompound1 = nbttaglist1.getCompound(i);
@@ -0,0 +0,0 @@ public class ChunkSerializer {
}
}
}
- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot
};
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@ -1869,7 +1861,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.pending.addAll(temp);
temp.clear();
+ MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
this.debugHead = this.debugHead.getNextHead(currentTick);
this.debugHead = this.debugHead.getNextHead(this.currentTick);
}
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies {
implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")

Some files were not shown because too many files have changed in this diff Show more