@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java
|
||||
@@ -50,7 +50,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
private EnumBlockRotation rotation;
|
||||
protected int genDepth;
|
||||
private final WorldGenFeatureStructurePieceType type;
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
protected StructurePiece(WorldGenFeatureStructurePieceType worldgenfeaturestructurepiecetype, int i, StructureBoundingBox structureboundingbox) {
|
||||
this.type = worldgenfeaturestructurepiecetype;
|
||||
@@ -59,14 +59,11 @@
|
||||
@@ -60,14 +60,11 @@
|
||||
}
|
||||
|
||||
public StructurePiece(WorldGenFeatureStructurePieceType worldgenfeaturestructurepiecetype, NBTTagCompound nbttagcompound) {
|
||||
@@ -27,7 +27,7 @@
|
||||
int j = nbttagcompound.getInt("O");
|
||||
|
||||
this.setOrientation(j == -1 ? null : EnumDirection.from2DDataValue(j));
|
||||
@@ -84,13 +81,11 @@
|
||||
@@ -85,13 +82,11 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
nbttagcompound.putString("id", BuiltInRegistries.STRUCTURE_PIECE.getKey(this.getType()).toString());
|
||||
@@ -45,7 +45,7 @@
|
||||
EnumDirection enumdirection = this.getOrientation();
|
||||
|
||||
nbttagcompound.putInt("O", enumdirection == null ? -1 : enumdirection.get2DDataValue());
|
||||
@@ -190,6 +185,11 @@
|
||||
@@ -191,6 +186,11 @@
|
||||
}
|
||||
|
||||
generatoraccessseed.setBlock(blockposition_mutableblockposition, iblockdata, 2);
|
||||
@@ -57,7 +57,7 @@
|
||||
Fluid fluid = generatoraccessseed.getFluidState(blockposition_mutableblockposition);
|
||||
|
||||
if (!fluid.isEmpty()) {
|
||||
@@ -204,6 +204,38 @@
|
||||
@@ -205,6 +205,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,25 +69,25 @@
|
||||
+ boolean result = worldAccess.setBlock(position, craftBlockEntityState.getHandle(), i);
|
||||
+ TileEntity tileEntity = worldAccess.getBlockEntity(position);
|
||||
+ if (tileEntity != null) {
|
||||
+ tileEntity.load(craftBlockEntityState.getSnapshotNBT());
|
||||
+ tileEntity.loadWithComponents(craftBlockEntityState.getSnapshotNBT(), worldAccess.registryAccess());
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ protected void placeCraftSpawner(WorldAccess worldAccess, BlockPosition position, org.bukkit.entity.EntityType entityType, int i) {
|
||||
+ // This method is used in structures that are generated by code and place spawners as they set the entity after the block was placed making it impossible for plugins to access that information
|
||||
+ org.bukkit.craftbukkit.block.CraftCreatureSpawner spawner = (org.bukkit.craftbukkit.block.CraftCreatureSpawner) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(position, Blocks.SPAWNER.defaultBlockState(), null);
|
||||
+ org.bukkit.craftbukkit.block.CraftCreatureSpawner spawner = (org.bukkit.craftbukkit.block.CraftCreatureSpawner) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldAccess, position, Blocks.SPAWNER.defaultBlockState(), null);
|
||||
+ spawner.setSpawnedType(entityType);
|
||||
+ placeCraftBlockEntity(worldAccess, position, spawner, i);
|
||||
+ }
|
||||
+
|
||||
+ protected void setCraftLootTable(WorldAccess worldAccess, BlockPosition position, RandomSource randomSource, net.minecraft.resources.MinecraftKey loottableKey) {
|
||||
+ protected void setCraftLootTable(WorldAccess worldAccess, BlockPosition position, RandomSource randomSource, ResourceKey<LootTable> loottableKey) {
|
||||
+ // This method is used in structures that use data markers to a loot table to loot containers as otherwise plugins won't have access to that information.
|
||||
+ net.minecraft.world.level.block.entity.TileEntity tileEntity = worldAccess.getBlockEntity(position);
|
||||
+ if (tileEntity instanceof net.minecraft.world.level.block.entity.TileEntityLootable tileEntityLootable) {
|
||||
+ tileEntityLootable.setLootTable(loottableKey, randomSource.nextLong());
|
||||
+ if (worldAccess instanceof org.bukkit.craftbukkit.util.TransformerGeneratorAccess transformerAccess) {
|
||||
+ transformerAccess.setCraftBlock(position, (org.bukkit.craftbukkit.block.CraftBlockState) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(position, tileEntity.getBlockState(), tileEntityLootable.saveWithFullMetadata()), 3);
|
||||
+ transformerAccess.setCraftBlock(position, (org.bukkit.craftbukkit.block.CraftBlockState) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldAccess, position, tileEntity.getBlockState(), tileEntityLootable.saveWithFullMetadata(worldAccess.registryAccess())), 3);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -96,7 +96,7 @@
|
||||
protected boolean canBeReplaced(IWorldReader iworldreader, int i, int j, int k, StructureBoundingBox structureboundingbox) {
|
||||
return true;
|
||||
}
|
||||
@@ -397,12 +429,20 @@
|
||||
@@ -398,12 +430,20 @@
|
||||
iblockdata = reorient(worldaccess, blockposition, Blocks.CHEST.defaultBlockState());
|
||||
}
|
||||
|
||||
@@ -106,18 +106,18 @@
|
||||
TileEntity tileentity = worldaccess.getBlockEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntityChest) {
|
||||
((TileEntityChest) tileentity).setLootTable(minecraftkey, randomsource.nextLong());
|
||||
((TileEntityChest) tileentity).setLootTable(resourcekey, randomsource.nextLong());
|
||||
}
|
||||
+ */
|
||||
+ org.bukkit.craftbukkit.block.CraftChest chestState = (org.bukkit.craftbukkit.block.CraftChest) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockposition, iblockdata, null);
|
||||
+ chestState.setLootTable(org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(minecraftkey)));
|
||||
+ org.bukkit.craftbukkit.block.CraftChest chestState = (org.bukkit.craftbukkit.block.CraftChest) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldaccess, blockposition, iblockdata, null);
|
||||
+ chestState.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(resourcekey));
|
||||
+ chestState.setSeed(randomsource.nextLong());
|
||||
+ placeCraftBlockEntity(worldaccess, blockposition, chestState, 2);
|
||||
+ // CraftBukkit end
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -414,12 +454,31 @@
|
||||
@@ -415,12 +455,31 @@
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = this.getWorldPos(i, j, k);
|
||||
|
||||
if (structureboundingbox.isInside(blockposition_mutableblockposition) && !generatoraccessseed.getBlockState(blockposition_mutableblockposition).is(Blocks.DISPENSER)) {
|
||||
@@ -127,7 +127,7 @@
|
||||
TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition_mutableblockposition);
|
||||
|
||||
if (tileentity instanceof TileEntityDispenser) {
|
||||
((TileEntityDispenser) tileentity).setLootTable(minecraftkey, randomsource.nextLong());
|
||||
((TileEntityDispenser) tileentity).setLootTable(resourcekey, randomsource.nextLong());
|
||||
}
|
||||
+ */
|
||||
+ if (!this.canBeReplaced(generatoraccessseed, i, j, k, structureboundingbox)) {
|
||||
@@ -141,15 +141,15 @@
|
||||
+ iblockdata = iblockdata.rotate(this.rotation);
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.craftbukkit.block.CraftDispenser dispenserState = (org.bukkit.craftbukkit.block.CraftDispenser) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockposition_mutableblockposition, iblockdata, null);
|
||||
+ dispenserState.setLootTable(org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(minecraftkey)));
|
||||
+ org.bukkit.craftbukkit.block.CraftDispenser dispenserState = (org.bukkit.craftbukkit.block.CraftDispenser) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(generatoraccessseed, blockposition_mutableblockposition, iblockdata, null);
|
||||
+ dispenserState.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(resourcekey));
|
||||
+ dispenserState.setSeed(randomsource.nextLong());
|
||||
+ placeCraftBlockEntity(generatoraccessseed, blockposition_mutableblockposition, dispenserState, 2);
|
||||
+ // CraftBukkit end
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -432,7 +491,7 @@
|
||||
@@ -433,7 +492,7 @@
|
||||
}
|
||||
|
||||
public static StructureBoundingBox createBoundingBox(Stream<StructurePiece> stream) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||
@@ -70,6 +70,15 @@
|
||||
@@ -68,6 +68,15 @@
|
||||
|
||||
private static void placeSuspiciousSand(StructureBoundingBox structureboundingbox, GeneratorAccessSeed generatoraccessseed, BlockPosition blockposition) {
|
||||
if (structureboundingbox.isInside(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (generatoraccessseed instanceof org.bukkit.craftbukkit.util.TransformerGeneratorAccess transformerAccess) {
|
||||
+ org.bukkit.craftbukkit.block.CraftBrushableBlock brushableState = (org.bukkit.craftbukkit.block.CraftBrushableBlock) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockposition, Blocks.SUSPICIOUS_SAND.defaultBlockState(), null);
|
||||
+ brushableState.setLootTable(org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(LootTables.DESERT_PYRAMID_ARCHAEOLOGY)));
|
||||
+ org.bukkit.craftbukkit.block.CraftBrushableBlock brushableState = (org.bukkit.craftbukkit.block.CraftBrushableBlock) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(generatoraccessseed, blockposition, Blocks.SUSPICIOUS_SAND.defaultBlockState(), null);
|
||||
+ brushableState.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(LootTables.DESERT_PYRAMID_ARCHAEOLOGY));
|
||||
+ brushableState.setSeed(blockposition.asLong());
|
||||
+ transformerAccess.setCraftBlock(blockposition, brushableState, 2);
|
||||
+ return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||
@@ -42,6 +42,10 @@
|
||||
@@ -43,6 +43,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();
|
||||
@@ -514,6 +518,8 @@
|
||||
@@ -515,6 +519,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);
|
||||
|
||||
@@ -522,6 +528,9 @@
|
||||
@@ -523,6 +529,9 @@
|
||||
|
||||
tileentitymobspawner.setEntityId(EntityTypes.CAVE_SPIDER, randomsource);
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -813,11 +822,11 @@
|
||||
@@ -814,11 +823,11 @@
|
||||
|
||||
public d(NBTTagCompound nbttagcompound) {
|
||||
super(WorldGenFeatureStructurePieceType.MINE_SHAFT_ROOM, nbttagcompound);
|
||||
@@ -44,7 +44,7 @@
|
||||
List list = this.childEntranceBoxes;
|
||||
|
||||
Objects.requireNonNull(this.childEntranceBoxes);
|
||||
@@ -923,7 +932,7 @@
|
||||
@@ -924,7 +933,7 @@
|
||||
@Override
|
||||
protected void addAdditionalSaveData(StructurePieceSerializationContext structurepieceserializationcontext, NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(structurepieceserializationcontext, nbttagcompound);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
|
||||
@@ -198,12 +198,20 @@
|
||||
@@ -200,12 +200,20 @@
|
||||
@Override
|
||||
protected void handleDataMarker(String s, BlockPosition blockposition, WorldAccess worldaccess, RandomSource randomsource, StructureBoundingBox structureboundingbox) {
|
||||
if ("chest".equals(s)) {
|
||||
@@ -13,9 +13,9 @@
|
||||
((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(blockposition, Blocks.CHEST.defaultBlockState().setValue(BlockChest.WATERLOGGED, worldaccess.getFluidState(blockposition).is(TagsFluid.WATER)), null);
|
||||
+ org.bukkit.craftbukkit.block.CraftChest craftChest = (org.bukkit.craftbukkit.block.CraftChest) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldaccess, blockposition, Blocks.CHEST.defaultBlockState().setValue(BlockChest.WATERLOGGED, worldaccess.getFluidState(blockposition).is(TagsFluid.WATER)), null);
|
||||
+ craftChest.setSeed(randomsource.nextLong());
|
||||
+ craftChest.setLootTable(org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.isLarge ? LootTables.UNDERWATER_RUIN_BIG : LootTables.UNDERWATER_RUIN_SMALL)));
|
||||
+ craftChest.setLootTable(org.bukkit.craftbukkit.CraftLootTable.minecraftToBukkit(this.isLarge ? LootTables.UNDERWATER_RUIN_BIG : LootTables.UNDERWATER_RUIN_SMALL));
|
||||
+ placeCraftBlockEntity(worldaccess, blockposition, craftChest, 2);
|
||||
+ // CraftBukkit end
|
||||
} else if ("drowned".equals(s)) {
|
||||
|
||||
@@ -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, (NBTTagCompound) null);
|
||||
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.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, (NBTTagCompound) null);
|
||||
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null);
|
||||
- worldaccess.addFreshEntityWithPassengers(entitycat);
|
||||
+ worldaccess.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (structureTransformer != null) {
|
||||
+ org.bukkit.craftbukkit.block.CraftBlockState craftBlockState = (org.bukkit.craftbukkit.block.CraftBlockState) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockposition2, iblockdata, null);
|
||||
+ org.bukkit.craftbukkit.block.CraftBlockState craftBlockState = (org.bukkit.craftbukkit.block.CraftBlockState) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(worldaccess, blockposition2, iblockdata, null);
|
||||
+ if (definedstructure_blockinfo.nbt != null && craftBlockState instanceof org.bukkit.craftbukkit.block.CraftBlockEntityState<?> entityState) {
|
||||
+ entityState.loadData(definedstructure_blockinfo.nbt);
|
||||
+ if (craftBlockState instanceof org.bukkit.craftbukkit.block.CraftLootable<?> craftLootable) {
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -472,11 +510,13 @@
|
||||
@@ -479,11 +517,13 @@
|
||||
}
|
||||
|
||||
private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) {
|
||||
@@ -690,6 +730,11 @@
|
||||
@@ -697,6 +737,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);
|
||||
}
|
||||
|
||||
@@ -729,6 +774,12 @@
|
||||
@@ -736,6 +781,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
|
||||
private void loadPalette(HolderGetter<Block> holdergetter, NBTTagList nbttaglist, NBTTagList nbttaglist1) {
|
||||
@@ -858,7 +909,7 @@
|
||||
@@ -865,7 +916,7 @@
|
||||
public IBlockData stateFor(int i) {
|
||||
IBlockData iblockdata = (IBlockData) this.ids.byId(i);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user