Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -11,7 +11,7 @@
public class PersistentStructureLegacy {
private static final Map<String, String> CURRENT_TO_LEGACY_MAP = (Map) SystemUtils.make(Maps.newHashMap(), (hashmap) -> {
@@ -236,16 +240,16 @@
@@ -233,16 +237,16 @@
}
}

View File

@@ -4,8 +4,8 @@
private EnumBlockRotation rotation;
protected int genDepth;
private final WorldGenFeatureStructurePieceType type;
- private static final Set<Block> SHAPE_CHECK_BLOCKS = ImmutableSet.builder().add(Blocks.NETHER_BRICK_FENCE).add(Blocks.TORCH).add(Blocks.WALL_TORCH).add(Blocks.OAK_FENCE).add(Blocks.SPRUCE_FENCE).add(Blocks.DARK_OAK_FENCE).add(Blocks.ACACIA_FENCE).add(Blocks.BIRCH_FENCE).add(Blocks.JUNGLE_FENCE).add(Blocks.LADDER).add(Blocks.IRON_BARS).build();
+ public static final Set<Block> SHAPE_CHECK_BLOCKS = ImmutableSet.<Block>builder().add(Blocks.NETHER_BRICK_FENCE).add(Blocks.TORCH).add(Blocks.WALL_TORCH).add(Blocks.OAK_FENCE).add(Blocks.SPRUCE_FENCE).add(Blocks.DARK_OAK_FENCE).add(Blocks.ACACIA_FENCE).add(Blocks.BIRCH_FENCE).add(Blocks.JUNGLE_FENCE).add(Blocks.LADDER).add(Blocks.IRON_BARS).build(); // CraftBukkit - decompile error / PAIL private -> public
- private static final Set<Block> SHAPE_CHECK_BLOCKS = ImmutableSet.builder().add(Blocks.NETHER_BRICK_FENCE).add(Blocks.TORCH).add(Blocks.WALL_TORCH).add(Blocks.OAK_FENCE).add(Blocks.SPRUCE_FENCE).add(Blocks.DARK_OAK_FENCE).add(Blocks.PALE_OAK_FENCE).add(Blocks.ACACIA_FENCE).add(Blocks.BIRCH_FENCE).add(Blocks.JUNGLE_FENCE).add(Blocks.LADDER).add(Blocks.IRON_BARS).build();
+ public static final Set<Block> SHAPE_CHECK_BLOCKS = ImmutableSet.<Block>builder().add(Blocks.NETHER_BRICK_FENCE).add(Blocks.TORCH).add(Blocks.WALL_TORCH).add(Blocks.OAK_FENCE).add(Blocks.SPRUCE_FENCE).add(Blocks.DARK_OAK_FENCE).add(Blocks.PALE_OAK_FENCE).add(Blocks.ACACIA_FENCE).add(Blocks.BIRCH_FENCE).add(Blocks.JUNGLE_FENCE).add(Blocks.LADDER).add(Blocks.IRON_BARS).build(); // CraftBukkit - decompile error / PAIL private -> public
protected StructurePiece(WorldGenFeatureStructurePieceType worldgenfeaturestructurepiecetype, int i, StructureBoundingBox structureboundingbox) {
this.type = worldgenfeaturestructurepiecetype;

View File

@@ -52,4 +52,4 @@
+ // CraftBukkit end
if (this.isValid()) {
nbttagcompound.putString("id", structurepieceserializationcontext.registryAccess().registryOrThrow(Registries.STRUCTURE).getKey(this.structure).toString());
nbttagcompound.putString("id", structurepieceserializationcontext.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(this.structure).toString());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
@@ -284,7 +284,12 @@
@@ -285,7 +285,12 @@
BlockPosition blockposition1 = blockposition.below();
if (structureboundingbox.isInside(blockposition1)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
@@ -43,6 +43,10 @@
@@ -44,6 +44,10 @@
import net.minecraft.world.level.storage.loot.LootTables;
import org.slf4j.Logger;
@@ -11,7 +11,7 @@
public class MineshaftPieces {
static final Logger LOGGER = LogUtils.getLogger();
@@ -515,6 +519,8 @@
@@ -520,6 +524,8 @@
if (structureboundingbox.isInside(blockposition_mutableblockposition) && this.isInterior(generatoraccessseed, 1, 0, l, structureboundingbox)) {
this.hasPlacedSpider = true;
@@ -20,7 +20,7 @@
generatoraccessseed.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition_mutableblockposition);
@@ -523,6 +529,9 @@
@@ -528,6 +534,9 @@
tileentitymobspawner.setEntityId(EntityTypes.CAVE_SPIDER, randomsource);
}
@@ -30,7 +30,7 @@
}
}
}
@@ -814,11 +823,11 @@
@@ -819,11 +828,11 @@
public d(NBTTagCompound nbttagcompound) {
super(WorldGenFeatureStructurePieceType.MINE_SHAFT_ROOM, nbttagcompound);
@@ -44,7 +44,7 @@
List list = this.childEntranceBoxes;
Objects.requireNonNull(this.childEntranceBoxes);
@@ -924,7 +933,7 @@
@@ -929,7 +938,7 @@
@Override
protected void addAdditionalSaveData(StructurePieceSerializationContext structurepieceserializationcontext, NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(structurepieceserializationcontext, nbttagcompound);

View File

@@ -19,5 +19,5 @@
+ placeCraftBlockEntity(worldaccess, blockposition, craftChest, 2);
+ // CraftBukkit end
} else if ("drowned".equals(s)) {
EntityDrowned entitydrowned = (EntityDrowned) EntityTypes.DROWNED.create(worldaccess.getLevel());
EntityDrowned entitydrowned = (EntityDrowned) EntityTypes.DROWNED.create(worldaccess.getLevel(), EntitySpawnReason.STRUCTURE);

View File

@@ -3,7 +3,7 @@
@@ -100,7 +100,7 @@
entitywitch.setPersistenceRequired();
entitywitch.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null);
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EntitySpawnReason.STRUCTURE, (GroupDataEntity) null);
- generatoraccessseed.addFreshEntityWithPassengers(entitywitch);
+ generatoraccessseed.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
@@ -12,7 +12,7 @@
@@ -121,7 +121,7 @@
entitycat.setPersistenceRequired();
entitycat.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null);
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EntitySpawnReason.STRUCTURE, (GroupDataEntity) null);
- worldaccess.addFreshEntityWithPassengers(entitycat);
+ worldaccess.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
@@ -52,6 +52,12 @@
@@ -56,6 +56,12 @@
import net.minecraft.world.phys.shapes.VoxelShapeBitSet;
import net.minecraft.world.phys.shapes.VoxelShapeDiscrete;
@@ -13,7 +13,7 @@
public class DefinedStructure {
public static final String PALETTE_TAG = "palette";
@@ -70,6 +76,11 @@
@@ -74,6 +80,11 @@
private BaseBlockPosition size;
private String author;
@@ -25,7 +25,7 @@
public DefinedStructure() {
this.size = BaseBlockPosition.ZERO;
this.author = "?";
@@ -143,7 +154,7 @@
@@ -147,7 +158,7 @@
}
private static List<DefinedStructure.BlockInfo> buildInfoList(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) {
@@ -34,7 +34,7 @@
return definedstructure_blockinfo.pos.getY();
}).thenComparingInt((definedstructure_blockinfo) -> {
return definedstructure_blockinfo.pos.getX();
@@ -229,6 +240,19 @@
@@ -253,6 +264,19 @@
if (this.palettes.isEmpty()) {
return false;
} else {
@@ -54,7 +54,7 @@
List<DefinedStructure.BlockInfo> list = definedstructureinfo.getRandomPalette(this.palettes, blockposition).blocks();
if ((!list.isEmpty() || !definedstructureinfo.isIgnoreEntities() && !this.entityInfoList.isEmpty()) && this.size.getX() >= 1 && this.size.getY() >= 1 && this.size.getZ() >= 1) {
@@ -260,6 +284,20 @@
@@ -284,6 +308,20 @@
Clearable.tryClear(tileentity);
worldaccess.setBlock(blockposition2, Blocks.BARRIER.defaultBlockState(), 20);
}
@@ -75,7 +75,7 @@
if (worldaccess.setBlock(blockposition2, iblockdata, i)) {
j = Math.min(j, blockposition2.getX());
@@ -272,7 +310,7 @@
@@ -296,7 +334,7 @@
if (definedstructure_blockinfo.nbt != null) {
tileentity = worldaccess.getBlockEntity(blockposition2);
if (tileentity != null) {
@@ -84,7 +84,7 @@
definedstructure_blockinfo.nbt.putLong("LootTableSeed", randomsource.nextLong());
}
@@ -377,7 +415,7 @@
@@ -401,7 +439,7 @@
}
if (!definedstructureinfo.isIgnoreEntities()) {
@@ -93,14 +93,14 @@
}
return true;
@@ -479,11 +517,13 @@
@@ -503,11 +541,13 @@
}
private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
- try {
+ // CraftBukkit start
+ // try {
return EntityTypes.create(nbttagcompound, worldaccess.getLevel());
return EntityTypes.create(nbttagcompound, worldaccess.getLevel(), EntitySpawnReason.STRUCTURE);
- } catch (Exception exception) {
- return Optional.empty();
- }
@@ -111,7 +111,7 @@
}
public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) {
@@ -697,6 +737,11 @@
@@ -721,6 +761,11 @@
nbttagcompound.put("entities", nbttaglist3);
nbttagcompound.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ()));
@@ -123,7 +123,7 @@
return GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
}
@@ -736,6 +781,12 @@
@@ -760,6 +805,12 @@
}
}
@@ -136,11 +136,11 @@
}
private void loadPalette(HolderGetter<Block> holdergetter, NBTTagList nbttaglist, NBTTagList nbttaglist1) {
@@ -865,7 +916,7 @@
@@ -924,7 +975,7 @@
public IBlockData stateFor(int i) {
IBlockData iblockdata = (IBlockData) this.ids.byId(i);
- return iblockdata == null ? DefinedStructure.b.DEFAULT_BLOCK_STATE : iblockdata;
- return iblockdata == null ? DefinedStructure.c.DEFAULT_BLOCK_STATE : iblockdata;
+ return iblockdata == null ? DEFAULT_BLOCK_STATE : iblockdata; // CraftBukkit - decompile error
}

View File

@@ -21,5 +21,5 @@
+ return list.get(this.palette);
+ // CraftBukkit end
} else {
return (DefinedStructure.a) list.get(this.getRandom(blockposition).nextInt(i));
return (DefinedStructure.b) list.get(this.getRandom(blockposition).nextInt(i));
}