1.21.6 dev

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Bjarne Koll
2025-05-28 13:23:32 +02:00
committed by Nassim Jahnke
parent 39203a65e0
commit a24f9b204c
788 changed files with 41006 additions and 6324 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -64,7 +_,7 @@
@@ -65,7 +_,7 @@
protected final ShortList[] postProcessing;
private volatile boolean unsaved;
private volatile boolean isLightCorrect;
@@ -9,7 +9,7 @@
private long inhabitedTime;
@Nullable
@Deprecated
@@ -82,6 +_,11 @@
@@ -83,6 +_,11 @@
public final Map<BlockPos, BlockEntity> blockEntities = new Object2ObjectOpenHashMap<>();
protected final LevelHeightAccessor levelHeightAccessor;
protected final LevelChunkSection[] sections;
@@ -21,7 +21,7 @@
public ChunkAccess(
ChunkPos chunkPos,
@@ -92,7 +_,8 @@
@@ -93,7 +_,8 @@
@Nullable LevelChunkSection[] sections,
@Nullable BlendingData blendingData
) {
@@ -31,7 +31,7 @@
this.upgradeData = upgradeData;
this.levelHeightAccessor = levelHeightAccessor;
this.sections = new LevelChunkSection[levelHeightAccessor.getSectionsCount()];
@@ -109,6 +_,7 @@
@@ -110,6 +_,7 @@
}
replaceMissingSections(biomeRegistry, this.sections);
@@ -39,7 +39,7 @@
}
private static void replaceMissingSections(Registry<Biome> biomeRegistry, LevelChunkSection[] sections) {
@@ -123,6 +_,8 @@
@@ -124,6 +_,8 @@
return GameEventListenerRegistry.NOOP;
}
@@ -48,7 +48,7 @@
@Nullable
public BlockState setBlockState(BlockPos pos, BlockState state) {
return this.setBlockState(pos, state, 3);
@@ -278,6 +_,7 @@
@@ -275,6 +_,7 @@
public boolean tryMarkSaved() {
if (this.unsaved) {
this.unsaved = false;
@@ -56,7 +56,7 @@
return true;
} else {
return false;
@@ -285,7 +_,7 @@
@@ -282,7 +_,7 @@
}
public boolean isUnsaved() {
@@ -65,7 +65,7 @@
}
public abstract ChunkStatus getPersistedStatus();
@@ -451,6 +_,22 @@
@@ -448,6 +_,22 @@
throw new ReportedException(crashReport);
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -77,7 +_,7 @@
@@ -79,7 +_,7 @@
};
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel = Maps.newHashMap();
public boolean loaded;
@@ -9,7 +9,7 @@
@Nullable
private Supplier<FullChunkStatus> fullStatus;
@Nullable
@@ -86,6 +_,14 @@
@@ -88,6 +_,14 @@
private final LevelChunkTicks<Block> blockTicks;
private final LevelChunkTicks<Fluid> fluidTicks;
private LevelChunk.UnsavedListener unsavedListener = chunkPos -> {};
@@ -24,7 +24,7 @@
public LevelChunk(Level level, ChunkPos pos) {
this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null);
@@ -103,7 +_,7 @@
@@ -105,7 +_,7 @@
@Nullable BlendingData blendingData
) {
super(pos, data, level, level.registryAccess().lookupOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData);
@@ -33,7 +33,7 @@
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>();
for (Heightmap.Types types : Heightmap.Types.values()) {
@@ -155,6 +_,10 @@
@@ -157,6 +_,10 @@
this.skyLightSources = chunk.skyLightSources;
this.setLightCorrect(chunk.isLightCorrect());
this.markUnsaved();
@@ -44,7 +44,7 @@
}
public void setUnsavedListener(LevelChunk.UnsavedListener unsavedListener) {
@@ -163,6 +_,12 @@
@@ -165,6 +_,12 @@
unsavedListener.setUnsaved(this.chunkPos);
}
}
@@ -57,7 +57,7 @@
@Override
public void markUnsaved() {
@@ -196,8 +_,28 @@
@@ -198,8 +_,28 @@
: super.getListenerRegistry(sectionY);
}
@@ -86,7 +86,7 @@
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
@@ -232,28 +_,42 @@
@@ -234,28 +_,42 @@
}
}
@@ -131,7 +131,7 @@
}
@Nullable
@@ -313,7 +_,7 @@
@@ -315,7 +_,7 @@
if (!section.getBlockState(i, i1, i2).is(block)) {
return null;
} else {
@@ -140,7 +140,7 @@
state.onPlace(this.level, pos, blockState, flag1);
}
@@ -367,7 +_,12 @@
@@ -369,7 +_,12 @@
@Nullable
public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) {
@@ -154,7 +154,7 @@
if (blockEntity == null) {
CompoundTag compoundTag = this.pendingBlockEntities.remove(pos);
if (compoundTag != null) {
@@ -421,7 +_,13 @@
@@ -424,7 +_,13 @@
BlockPos blockPos = blockEntity.getBlockPos();
BlockState blockState = this.getBlockState(blockPos);
if (!blockState.hasBlockEntity()) {
@@ -169,7 +169,7 @@
} else {
BlockState blockState1 = blockEntity.getBlockState();
if (blockState != blockState1) {
@@ -469,6 +_,11 @@
@@ -472,6 +_,11 @@
public void removeBlockEntity(BlockPos pos) {
if (this.isInLevel()) {
BlockEntity blockEntity = this.blockEntities.remove(pos);
@@ -181,7 +181,7 @@
if (blockEntity != null) {
if (this.level instanceof ServerLevel serverLevel) {
this.removeGameEventListener(blockEntity, serverLevel);
@@ -511,6 +_,65 @@
@@ -514,6 +_,65 @@
}
}
@@ -247,7 +247,7 @@
public boolean isEmpty() {
return false;
}
@@ -719,23 +_,24 @@
@@ -726,23 +_,24 @@
if (this.blockEntity.getType().isValid(blockState)) {
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity);
this.loggedInvalidBlockState = false;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -30,14 +_,14 @@
@@ -29,14 +_,14 @@
public final IdMap<T> registry;
private volatile PalettedContainer.Data<T> data;
private final PalettedContainer.Strategy strategy;
@@ -18,7 +18,7 @@
}
public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> registry, Codec<T> codec, PalettedContainer.Strategy strategy, T value) {
@@ -99,7 +_,7 @@
@@ -98,7 +_,7 @@
}
@Override
@@ -27,7 +27,7 @@
PalettedContainer.Data<T> data = this.data;
PalettedContainer.Data<T> data1 = this.createOrReuseData(data, bits);
data1.copyFrom(data.palette, data.storage);
@@ -107,7 +_,7 @@
@@ -106,7 +_,7 @@
return data1.palette.idFor(objectAdded);
}
@@ -36,7 +36,7 @@
this.acquire();
Object var5;
@@ -130,7 +_,7 @@
@@ -129,7 +_,7 @@
return this.data.palette.valueFor(andSet);
}
@@ -45,7 +45,7 @@
this.acquire();
try {
@@ -163,7 +_,7 @@
@@ -162,7 +_,7 @@
set.forEach(id -> consumer.accept(palette.valueFor(id)));
}
@@ -54,7 +54,7 @@
this.acquire();
try {
@@ -178,7 +_,7 @@
@@ -177,7 +_,7 @@
}
@Override
@@ -63,7 +63,7 @@
this.acquire();
try {
@@ -226,7 +_,7 @@
@@ -225,7 +_,7 @@
}
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -85,14 +_,33 @@
@@ -90,14 +_,33 @@
return new ChunkAccess.PackedTicks(this.blockTicks.pack(gametime), this.fluidTicks.pack(gametime));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
@@ -35,7 +_,7 @@
@@ -40,7 +_,7 @@
WorldGenContext worldGenContext, ChunkStep step, StaticCache2D<GenerationChunkHolder> cache, ChunkAccess chunk
) {
ServerLevel serverLevel = worldGenContext.level();
@@ -9,15 +9,15 @@
worldGenContext.generator()
.createStructures(
serverLevel.registryAccess(),
@@ -198,7 +_,58 @@
@@ -207,7 +_,58 @@
public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) {
if (!entityTags.isEmpty()) {
- level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD));
public static void postLoadProtoChunk(ServerLevel level, ValueInput.ValueInputList input) {
if (!input.isEmpty()) {
- level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(input, level, EntitySpawnReason.LOAD));
- }
- }
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
+ level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD).filter((entity) -> {
+ level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(input, level, EntitySpawnReason.LOAD).filter((entity) -> {
+ boolean needsRemoval = false;
+ net.minecraft.server.dedicated.DedicatedServer server = level.getCraftServer().getServer();
+ if (!level.getChunkSource().spawnFriendlies && (entity instanceof net.minecraft.world.entity.animal.Animal || entity instanceof net.minecraft.world.entity.animal.WaterAnimal)) {

View File

@@ -17,7 +17,7 @@
+ // CraftBukkit end
) {
int version = getVersion(chunkData);
if (version == SharedConstants.getCurrentVersion().getDataVersion().getVersion()) {
if (version == SharedConstants.getCurrentVersion().dataVersion().version()) {
return chunkData;
} else {
try {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -91,6 +_,7 @@
@@ -93,6 +_,7 @@
List<CompoundTag> entities,
List<CompoundTag> blockEntities,
CompoundTag structureData
@@ -8,7 +8,7 @@
) {
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(
Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()
@@ -109,12 +_,38 @@
@@ -111,12 +_,38 @@
public static final String BLOCK_LIGHT_TAG = "BlockLight";
public static final String SKY_LIGHT_TAG = "SkyLight";
@@ -26,7 +26,7 @@
+ // Paper end - guard against serializing mismatching coordinates
+
+ // Paper start - Do not let the server load chunks from newer versions
+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion();
+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end - Do not let the server load chunks from newer versions
+
@@ -48,7 +48,7 @@
long longOr = tag.getLongOr("LastUpdate", 0L);
long longOr1 = tag.getLongOr("InhabitedTime", 0L);
ChunkStatus chunkStatus = tag.read("Status", ChunkStatus.CODEC).orElse(ChunkStatus.EMPTY);
@@ -154,7 +_,7 @@
@@ -156,7 +_,7 @@
ListTag listOrEmpty2 = tag.getListOrEmpty("sections");
List<SerializableChunkData.SectionData> list5 = new ArrayList<>(listOrEmpty2.size());
Registry<Biome> registry = registries.lookupOrThrow(Registries.BIOME);
@@ -57,7 +57,7 @@
for (int i2 = 0; i2 < listOrEmpty2.size(); i2++) {
Optional<CompoundTag> compound = listOrEmpty2.getCompound(i2);
@@ -174,7 +_,7 @@
@@ -176,7 +_,7 @@
Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES
)
);
@@ -66,7 +66,7 @@
.map(
compoundTag1 -> codec.parse(NbtOps.INSTANCE, compoundTag1)
.promotePartial(string -> logErrors(chunkPos, byteOr, string))
@@ -215,6 +_,7 @@
@@ -217,6 +_,7 @@
list3,
list4,
compoundOrEmpty
@@ -74,7 +74,7 @@
);
}
}
@@ -292,6 +_,12 @@
@@ -294,6 +_,12 @@
}
}
@@ -87,7 +87,7 @@
chunkAccess.setLightCorrect(this.lightCorrect);
EnumSet<Heightmap.Types> set = EnumSet.noneOf(Heightmap.Types.class);
@@ -346,6 +_,12 @@
@@ -348,6 +_,12 @@
);
}
@@ -100,7 +100,7 @@
public static SerializableChunkData copyOf(ServerLevel level, ChunkAccess chunk) {
if (!chunk.canBeSerialized()) {
throw new IllegalArgumentException("Chunk can't be serialized: " + chunk);
@@ -404,6 +_,12 @@
@@ -406,6 +_,12 @@
CompoundTag compoundTag = packStructureData(
StructurePieceSerializationContext.fromLevel(level), pos, chunk.getAllStarts(), chunk.getAllReferences()
);
@@ -113,7 +113,7 @@
return new SerializableChunkData(
level.registryAccess().lookupOrThrow(Registries.BIOME),
pos,
@@ -423,6 +_,7 @@
@@ -425,6 +_,7 @@
list2,
list1,
compoundTag
@@ -121,7 +121,7 @@
);
}
}
@@ -489,6 +_,11 @@
@@ -491,6 +_,11 @@
this.heightmaps.forEach((types, longs) -> compoundTag2.put(types.getSerializationKey(), new LongArrayTag(longs)));
compoundTag.put("Heightmaps", compoundTag2);
compoundTag.put("structures", this.structureData);
@@ -133,7 +133,7 @@
return compoundTag;
}
@@ -562,6 +_,12 @@
@@ -572,6 +_,12 @@
} else {
StructureStart structureStart = StructureStart.loadStaticStart(context, compoundOrEmpty.getCompoundOrEmpty(string), seed);
if (structureStart != null) {