mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
net.minecraft.world.level.levelgen.structure.structures
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
@@ -65,6 +_,15 @@
|
||||
|
||||
private static void placeSuspiciousSand(BoundingBox boundingBox, WorldGenLevel worldGenLevel, BlockPos pos) {
|
||||
if (boundingBox.isInside(pos)) {
|
||||
+ // CraftBukkit start
|
||||
+ 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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user