mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +01:00
net.minecraft.world.level.levelgen.structure.structures
This commit is contained in:
parent
ce87e69d53
commit
ca35cc216e
18 changed files with 202 additions and 297 deletions
|
@ -146,7 +146,7 @@ tasks.register("checkWork") {
|
|||
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
|
||||
}
|
||||
|
||||
val input = layout.cache.resolve("last-updating-folder").readText()
|
||||
val input = layout.cache.resolve("last-updating-folder").readText().trim()
|
||||
val patchFolder = layout.projectDirectory.file("paper-server/patches/sources").convertToPath().resolve(input)
|
||||
val sourceFolder = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input)
|
||||
val targetFolder = expandUserHome(
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
@@ -68,6 +68,15 @@
|
||||
@@ -65,6 +_,15 @@
|
||||
|
||||
private static void placeSuspiciousSand(BoundingBox box, WorldGenLevel world, BlockPos pos) {
|
||||
if (box.isInside(pos)) {
|
||||
private static void placeSuspiciousSand(BoundingBox boundingBox, WorldGenLevel worldGenLevel, BlockPos pos) {
|
||||
if (boundingBox.isInside(pos)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (world instanceof org.bukkit.craftbukkit.util.TransformerGeneratorAccess transformerAccess) {
|
||||
+ org.bukkit.craftbukkit.block.CraftBrushableBlock brushableState = (org.bukkit.craftbukkit.block.CraftBrushableBlock) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(world, pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), null);
|
||||
+ if (worldGenLevel instanceof org.bukkit.craftbukkit.util.TransformerGeneratorAccess transformerAccess) {
|
||||
+ org.bukkit.craftbukkit.block.CraftBrushableBlock brushableState = (org.bukkit.craftbukkit.block.CraftBrushableBlock) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldGenLevel, pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), null);
|
||||
+ brushableState.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY));
|
||||
+ brushableState.setSeed(pos.asLong());
|
||||
+ transformerAccess.setCraftBlock(pos, brushableState, 2);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setBlock(pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), 2);
|
||||
world.getBlockEntity(pos, BlockEntityType.BRUSHABLE_BLOCK).ifPresent((brushableblockentity) -> {
|
||||
brushableblockentity.setLootTable(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY, pos.asLong());
|
||||
worldGenLevel.setBlock(pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), 2);
|
||||
worldGenLevel.getBlockEntity(pos, BlockEntityType.BRUSHABLE_BLOCK)
|
||||
.ifPresent(brushableBlockEntity -> brushableBlockEntity.setLootTable(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY, pos.asLong()));
|
|
@ -0,0 +1,14 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
|
||||
@@ -390,7 +_,10 @@
|
||||
if (name.startsWith("Chest")) {
|
||||
BlockPos blockPos = pos.below();
|
||||
if (box.isInside(blockPos)) {
|
||||
- RandomizableContainer.setBlockEntityLootTable(level, random, blockPos, BuiltInLootTables.END_CITY_TREASURE);
|
||||
+ // CraftBukkit start - ensure block transformation
|
||||
+ // RandomizableContainer.setBlockEntityLootTable(level, random, blockPos, BuiltInLootTables.END_CITY_TREASURE);
|
||||
+ this.setCraftLootTable(level, blockPos, random, BuiltInLootTables.END_CITY_TREASURE);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (box.isInside(pos) && Level.isInSpawnableBounds(pos)) {
|
||||
if (name.startsWith("Sentry")) {
|
|
@ -0,0 +1,29 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
@@ -13,8 +_,6 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -102,10 +_,13 @@
|
||||
protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) {
|
||||
if ("chest".equals(name)) {
|
||||
level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
|
||||
- BlockEntity blockEntity = level.getBlockEntity(pos.below());
|
||||
- if (blockEntity instanceof ChestBlockEntity) {
|
||||
- ((ChestBlockEntity)blockEntity).setLootTable(BuiltInLootTables.IGLOO_CHEST, random.nextLong());
|
||||
- }
|
||||
+ // CraftBukkit start - ensure block transformation
|
||||
+ // BlockEntity blockEntity = level.getBlockEntity(pos.below());
|
||||
+ // if (blockEntity instanceof ChestBlockEntity) {
|
||||
+ // ((ChestBlockEntity)blockEntity).setLootTable(BuiltInLootTables.IGLOO_CHEST, random.nextLong());
|
||||
+ // }
|
||||
+ this.setCraftLootTable(level, pos.below(), random, BuiltInLootTables.IGLOO_CHEST);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
@@ -8,6 +_,7 @@
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
+import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
@@ -401,10 +_,13 @@
|
||||
BlockPos worldPos = this.getWorldPos(1, 0, i8);
|
||||
if (box.isInside(worldPos) && this.isInterior(level, 1, 0, i8, box)) {
|
||||
this.hasPlacedSpider = true;
|
||||
- level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
- spawnerBlockEntity.setEntityId(EntityType.CAVE_SPIDER, random);
|
||||
- }
|
||||
+ // CraftBukkit start
|
||||
+ // level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ // if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
+ // spawnerBlockEntity.setEntityId(EntityType.CAVE_SPIDER, random);
|
||||
+ // }
|
||||
+ this.placeCraftSpawner(level, worldPos, org.bukkit.entity.EntityType.CAVE_SPIDER, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java
|
||||
@@ -1265,10 +_,13 @@
|
||||
BlockPos worldPos = this.getWorldPos(3, 5, 5);
|
||||
if (box.isInside(worldPos)) {
|
||||
this.hasPlacedSpawner = true;
|
||||
- level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
- spawnerBlockEntity.setEntityId(EntityType.BLAZE, random);
|
||||
- }
|
||||
+ // CraftBukkit start
|
||||
+ // level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ // if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
+ // spawnerBlockEntity.setEntityId(EntityType.BLAZE, random);
|
||||
+ // }
|
||||
+ this.placeCraftSpawner(level, worldPos, org.bukkit.entity.EntityType.BLAZE, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
@@ -25,8 +_,6 @@
|
||||
import net.minecraft.world.level.block.ChestBlock;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -314,14 +_,20 @@
|
||||
@Override
|
||||
protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) {
|
||||
if ("chest".equals(name)) {
|
||||
- level.setBlock(
|
||||
- pos, Blocks.CHEST.defaultBlockState().setValue(ChestBlock.WATERLOGGED, Boolean.valueOf(level.getFluidState(pos).is(FluidTags.WATER))), 2
|
||||
- );
|
||||
- BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
- if (blockEntity instanceof ChestBlockEntity) {
|
||||
- ((ChestBlockEntity)blockEntity)
|
||||
- .setLootTable(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL, random.nextLong());
|
||||
- }
|
||||
+ // CraftBukkit start - transform block to ensure loot table is accessible
|
||||
+ // level.setBlock(
|
||||
+ // pos, Blocks.CHEST.defaultBlockState().setValue(ChestBlock.WATERLOGGED, Boolean.valueOf(level.getFluidState(pos).is(FluidTags.WATER))), 2
|
||||
+ // );
|
||||
+ // BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||
+ // if (blockEntity instanceof ChestBlockEntity) {
|
||||
+ // ((ChestBlockEntity)blockEntity)
|
||||
+ // .setLootTable(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL, random.nextLong());
|
||||
+ // }
|
||||
+ org.bukkit.craftbukkit.block.CraftChest craftChest = (org.bukkit.craftbukkit.block.CraftChest) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(level, pos, Blocks.CHEST.defaultBlockState().setValue(ChestBlock.WATERLOGGED, level.getFluidState(pos).is(FluidTags.WATER)), null);
|
||||
+ craftChest.setSeed(random.nextLong());
|
||||
+ craftChest.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL));
|
||||
+ this.placeCraftBlockEntity(level, pos, craftChest, 2);
|
||||
+ // CraftBukkit end
|
||||
} else if ("drowned".equals(name)) {
|
||||
Drowned drowned = EntityType.DROWNED.create(level.getLevel(), EntitySpawnReason.STRUCTURE);
|
||||
if (drowned != null) {
|
|
@ -0,0 +1,14 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java
|
||||
@@ -121,7 +_,10 @@
|
||||
protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) {
|
||||
ResourceKey<LootTable> resourceKey = ShipwreckPieces.MARKERS_TO_LOOT.get(name);
|
||||
if (resourceKey != null) {
|
||||
- RandomizableContainer.setBlockEntityLootTable(level, random, pos.below(), resourceKey);
|
||||
+ // CraftBukkit start
|
||||
+ // RandomizableContainer.setBlockEntityLootTable(level, random, pos.below(), resourceKey);
|
||||
+ this.setCraftLootTable(level, pos.below(), random, resourceKey);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
|
||||
@@ -7,7 +_,6 @@
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.RandomSource;
|
||||
-import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
@@ -870,10 +_,13 @@
|
||||
BlockPos worldPos = this.getWorldPos(5, 3, 6);
|
||||
if (box.isInside(worldPos)) {
|
||||
this.hasPlacedSpawner = true;
|
||||
- level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
- spawnerBlockEntity.setEntityId(EntityType.SILVERFISH, random);
|
||||
- }
|
||||
+ // CraftBukkit start
|
||||
+ // level.setBlock(worldPos, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ // if (level.getBlockEntity(worldPos) instanceof SpawnerBlockEntity spawnerBlockEntity) {
|
||||
+ // spawnerBlockEntity.setEntityId(EntityType.SILVERFISH, random);
|
||||
+ // }
|
||||
+ this.placeCraftSpawner(level, worldPos, org.bukkit.entity.EntityType.SILVERFISH, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
|
||||
@@ -97,7 +_,7 @@
|
||||
witch.setPersistenceRequired();
|
||||
witch.moveTo(worldPos.getX() + 0.5, worldPos.getY(), worldPos.getZ() + 0.5, 0.0F, 0.0F);
|
||||
witch.finalizeSpawn(level, level.getCurrentDifficultyAt(worldPos), EntitySpawnReason.STRUCTURE, null);
|
||||
- level.addFreshEntityWithPassengers(witch);
|
||||
+ level.addFreshEntityWithPassengers(witch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +_,7 @@
|
||||
cat.setPersistenceRequired();
|
||||
cat.moveTo(worldPos.getX() + 0.5, worldPos.getY(), worldPos.getZ() + 0.5, 0.0F, 0.0F);
|
||||
cat.finalizeSpawn(level, level.getCurrentDifficultyAt(worldPos), EntitySpawnReason.STRUCTURE, null);
|
||||
- level.addFreshEntityWithPassengers(cat);
|
||||
+ level.addFreshEntityWithPassengers(cat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/EndCityPieces.java
|
||||
@@ -285,7 +285,12 @@
|
||||
BlockPos blockposition1 = pos.below();
|
||||
|
||||
if (boundingBox.isInside(blockposition1)) {
|
||||
- RandomizableContainer.setBlockEntityLootTable(world, random, blockposition1, BuiltInLootTables.END_CITY_TREASURE);
|
||||
+ // CraftBukkit start - ensure block transformation
|
||||
+ /*
|
||||
+ RandomizableContainer.setBlockEntityLootTable(worldaccess, randomsource, blockposition1, LootTables.END_CITY_TREASURE);
|
||||
+ */
|
||||
+ this.setCraftLootTable(world, blockposition1, random, BuiltInLootTables.END_CITY_TREASURE);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (boundingBox.isInside(pos) && Level.isInSpawnableBounds(pos)) {
|
||||
if (metadata.startsWith("Sentry")) {
|
|
@ -1,31 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
@@ -14,8 +14,6 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -86,11 +84,16 @@
|
||||
protected void handleDataMarker(String metadata, BlockPos pos, ServerLevelAccessor world, RandomSource random, BoundingBox boundingBox) {
|
||||
if ("chest".equals(metadata)) {
|
||||
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
|
||||
- BlockEntity tileentity = world.getBlockEntity(pos.below());
|
||||
+ // CraftBukkit start - ensure block transformation
|
||||
+ /*
|
||||
+ TileEntity tileentity = worldaccess.getBlockEntity(blockposition.below());
|
||||
|
||||
- if (tileentity instanceof ChestBlockEntity) {
|
||||
- ((ChestBlockEntity) tileentity).setLootTable(BuiltInLootTables.IGLOO_CHEST, random.nextLong());
|
||||
+ if (tileentity instanceof TileEntityChest) {
|
||||
+ ((TileEntityChest) tileentity).setLootTable(LootTables.IGLOO_CHEST, randomsource.nextLong());
|
||||
}
|
||||
+ */
|
||||
+ this.setCraftLootTable(world, pos.below(), random, BuiltInLootTables.IGLOO_CHEST);
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
@@ -12,6 +12,7 @@
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
+import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
@@ -30,8 +31,6 @@
|
||||
import net.minecraft.world.level.block.FenceBlock;
|
||||
import net.minecraft.world.level.block.RailBlock;
|
||||
import net.minecraft.world.level.block.WallTorchBlock;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
@@ -520,14 +519,19 @@
|
||||
|
||||
if (chunkBox.isInside(blockposition_mutableblockposition) && this.isInterior(world, 1, 0, l, chunkBox)) {
|
||||
this.hasPlacedSpider = true;
|
||||
- world.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- BlockEntity tileentity = world.getBlockEntity(blockposition_mutableblockposition);
|
||||
-
|
||||
- if (tileentity instanceof SpawnerBlockEntity) {
|
||||
- SpawnerBlockEntity tileentitymobspawner = (SpawnerBlockEntity) tileentity;
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
+ generatoraccessseed.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition_mutableblockposition);
|
||||
|
||||
- tileentitymobspawner.setEntityId(EntityType.CAVE_SPIDER, random);
|
||||
+ if (tileentity instanceof TileEntityMobSpawner) {
|
||||
+ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) tileentity;
|
||||
+
|
||||
+ tileentitymobspawner.setEntityId(EntityTypes.CAVE_SPIDER, randomsource);
|
||||
}
|
||||
+ */
|
||||
+ this.placeCraftSpawner(world, blockposition_mutableblockposition, org.bukkit.entity.EntityType.CAVE_SPIDER, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -819,11 +823,11 @@
|
||||
|
||||
public MineShaftRoom(CompoundTag nbt) {
|
||||
super(StructurePieceType.MINE_SHAFT_ROOM, nbt);
|
||||
- DataResult dataresult = BoundingBox.CODEC.listOf().parse(NbtOps.INSTANCE, nbt.getList("Entrances", 11));
|
||||
+ DataResult<List<BoundingBox>> dataresult = BoundingBox.CODEC.listOf().parse(NbtOps.INSTANCE, nbt.getList("Entrances", 11)); // CraftBukkit - decompile error
|
||||
Logger logger = MineshaftPieces.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
- Optional optional = dataresult.resultOrPartial(logger::error);
|
||||
+ Optional<List<BoundingBox>> optional = dataresult.resultOrPartial(logger::error); // CraftBukkit - decompile error
|
||||
List list = this.childEntranceBoxes;
|
||||
|
||||
Objects.requireNonNull(this.childEntranceBoxes);
|
||||
@@ -929,7 +933,7 @@
|
||||
@Override
|
||||
protected void addAdditionalSaveData(StructurePieceSerializationContext context, CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(context, nbt);
|
||||
- DataResult dataresult = BoundingBox.CODEC.listOf().encodeStart(NbtOps.INSTANCE, this.childEntranceBoxes);
|
||||
+ DataResult<Tag> dataresult = BoundingBox.CODEC.listOf().encodeStart(NbtOps.INSTANCE, this.childEntranceBoxes); // CraftBukkit - decompile error
|
||||
Logger logger = MineshaftPieces.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
|
@ -1,45 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java
|
||||
@@ -8,15 +8,12 @@
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.RandomSource;
|
||||
-import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.FenceBlock;
|
||||
import net.minecraft.world.level.block.StairBlock;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
@@ -428,14 +425,19 @@
|
||||
|
||||
if (chunkBox.isInside(blockposition_mutableblockposition)) {
|
||||
this.hasPlacedSpawner = true;
|
||||
- world.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- BlockEntity tileentity = world.getBlockEntity(blockposition_mutableblockposition);
|
||||
-
|
||||
- if (tileentity instanceof SpawnerBlockEntity) {
|
||||
- SpawnerBlockEntity tileentitymobspawner = (SpawnerBlockEntity) tileentity;
|
||||
-
|
||||
- tileentitymobspawner.setEntityId(EntityType.BLAZE, random);
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
+ generatoraccessseed.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition_mutableblockposition);
|
||||
+
|
||||
+ if (tileentity instanceof TileEntityMobSpawner) {
|
||||
+ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) tileentity;
|
||||
+
|
||||
+ tileentitymobspawner.setEntityId(EntityTypes.BLAZE, randomsource);
|
||||
}
|
||||
+ */
|
||||
+ this.placeCraftSpawner(world, blockposition_mutableblockposition, org.bukkit.entity.EntityType.BLAZE, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
@@ -27,8 +27,6 @@
|
||||
import net.minecraft.world.level.block.ChestBlock;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
@@ -200,12 +198,20 @@
|
||||
@Override
|
||||
protected void handleDataMarker(String metadata, BlockPos pos, ServerLevelAccessor world, RandomSource random, BoundingBox boundingBox) {
|
||||
if ("chest".equals(metadata)) {
|
||||
- world.setBlock(pos, (BlockState) Blocks.CHEST.defaultBlockState().setValue(ChestBlock.WATERLOGGED, world.getFluidState(pos).is(FluidTags.WATER)), 2);
|
||||
- BlockEntity tileentity = world.getBlockEntity(pos);
|
||||
-
|
||||
- if (tileentity instanceof ChestBlockEntity) {
|
||||
- ((ChestBlockEntity) tileentity).setLootTable(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL, random.nextLong());
|
||||
+ // CraftBukkit start - transform block to ensure loot table is accessible
|
||||
+ /*
|
||||
+ worldaccess.setBlock(blockposition, (IBlockData) Blocks.CHEST.defaultBlockState().setValue(BlockChest.WATERLOGGED, worldaccess.getFluidState(blockposition).is(TagsFluid.WATER)), 2);
|
||||
+ TileEntity tileentity = worldaccess.getBlockEntity(blockposition);
|
||||
+
|
||||
+ if (tileentity instanceof TileEntityChest) {
|
||||
+ ((TileEntityChest) tileentity).setLootTable(this.isLarge ? LootTables.UNDERWATER_RUIN_BIG : LootTables.UNDERWATER_RUIN_SMALL, randomsource.nextLong());
|
||||
}
|
||||
+ */
|
||||
+ org.bukkit.craftbukkit.block.CraftChest craftChest = (org.bukkit.craftbukkit.block.CraftChest) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(world, pos, Blocks.CHEST.defaultBlockState().setValue(ChestBlock.WATERLOGGED, world.getFluidState(pos).is(FluidTags.WATER)), null);
|
||||
+ craftChest.setSeed(random.nextLong());
|
||||
+ craftChest.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(this.isLarge ? BuiltInLootTables.UNDERWATER_RUIN_BIG : BuiltInLootTables.UNDERWATER_RUIN_SMALL));
|
||||
+ this.placeCraftBlockEntity(world, pos, craftChest, 2);
|
||||
+ // CraftBukkit end
|
||||
} else if ("drowned".equals(metadata)) {
|
||||
Drowned entitydrowned = (Drowned) EntityType.DROWNED.create(world.getLevel(), EntitySpawnReason.STRUCTURE);
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/ShipwreckPieces.java
|
||||
@@ -79,7 +79,12 @@
|
||||
ResourceKey<LootTable> resourcekey = (ResourceKey) ShipwreckPieces.MARKERS_TO_LOOT.get(metadata);
|
||||
|
||||
if (resourcekey != null) {
|
||||
- RandomizableContainer.setBlockEntityLootTable(world, random, pos.below(), resourcekey);
|
||||
+ // CraftBukkit start - ensure block transformation
|
||||
+ /*
|
||||
+ RandomizableContainer.setBlockEntityLootTable(worldaccess, randomsource, blockposition.below(), resourcekey);
|
||||
+ */
|
||||
+ this.setCraftLootTable(world, pos.below(), random, resourcekey);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
|
||||
@@ -8,7 +8,6 @@
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.RandomSource;
|
||||
-import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
@@ -22,8 +21,6 @@
|
||||
import net.minecraft.world.level.block.SlabBlock;
|
||||
import net.minecraft.world.level.block.StairBlock;
|
||||
import net.minecraft.world.level.block.WallTorchBlock;
|
||||
-import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
-import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
||||
import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
@@ -53,7 +50,7 @@
|
||||
public boolean doPlace(int chainLength) {
|
||||
return super.doPlace(chainLength) && chainLength > 5;
|
||||
}
|
||||
- }};
|
||||
+ } }; // CraftBukkit - fix decompile styling
|
||||
private static List<StrongholdPieces.PieceWeight> currentPieces;
|
||||
static Class<? extends StrongholdPieces.StrongholdPiece> imposedPiece;
|
||||
private static int totalWeight;
|
||||
@@ -1136,14 +1133,19 @@
|
||||
|
||||
if (chunkBox.isInside(blockposition_mutableblockposition)) {
|
||||
this.hasPlacedSpawner = true;
|
||||
- world.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
- BlockEntity tileentity = world.getBlockEntity(blockposition_mutableblockposition);
|
||||
-
|
||||
- if (tileentity instanceof SpawnerBlockEntity) {
|
||||
- SpawnerBlockEntity tileentitymobspawner = (SpawnerBlockEntity) tileentity;
|
||||
-
|
||||
- tileentitymobspawner.setEntityId(EntityType.SILVERFISH, random);
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
+ generatoraccessseed.setBlock(blockposition_mutableblockposition, Blocks.SPAWNER.defaultBlockState(), 2);
|
||||
+ TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition_mutableblockposition);
|
||||
+
|
||||
+ if (tileentity instanceof TileEntityMobSpawner) {
|
||||
+ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) tileentity;
|
||||
+
|
||||
+ tileentitymobspawner.setEntityId(EntityTypes.SILVERFISH, randomsource);
|
||||
}
|
||||
+ */
|
||||
+ this.placeCraftSpawner(world, blockposition_mutableblockposition, org.bukkit.entity.EntityType.SILVERFISH, 2);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
--- a/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
|
||||
@@ -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(world, world.getCurrentDifficultyAt(blockposition_mutableblockposition), EntitySpawnReason.STRUCTURE, (SpawnGroupData) null);
|
||||
- world.addFreshEntityWithPassengers(entitywitch);
|
||||
+ world.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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(world, world.getCurrentDifficultyAt(blockposition_mutableblockposition), EntitySpawnReason.STRUCTURE, (SpawnGroupData) null);
|
||||
- world.addFreshEntityWithPassengers(entitycat);
|
||||
+ world.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue