@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.EnumBlockMirror;
|
||||
@@ -22,6 +23,7 @@ import org.bukkit.block.structure.Mirror;
|
||||
import org.bukkit.block.structure.StructureRotation;
|
||||
import org.bukkit.craftbukkit.CraftRegionAccessor;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.util.RandomSourceWrapper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.structure.Palette;
|
||||
@@ -55,16 +57,17 @@ public class CraftStructure implements Structure {
|
||||
throw new IllegalArgumentException("Integrity must be between 0 and 1 inclusive. Was \"" + integrity + "\"");
|
||||
}
|
||||
|
||||
RandomSource randomSource = new RandomSourceWrapper(random);
|
||||
DefinedStructureInfo definedstructureinfo = new DefinedStructureInfo()
|
||||
.setMirror(EnumBlockMirror.valueOf(mirror.name()))
|
||||
.setRotation(EnumBlockRotation.valueOf(structureRotation.name()))
|
||||
.setIgnoreEntities(!includeEntities)
|
||||
.addProcessor(new DefinedStructureProcessorRotation(integrity))
|
||||
.setRandom(random);
|
||||
.setRandom(randomSource);
|
||||
definedstructureinfo.palette = palette;
|
||||
|
||||
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
structure.placeInWorld(((CraftRegionAccessor) regionAccessor).getHandle(), blockPosition, blockPosition, definedstructureinfo, random, 2);
|
||||
structure.placeInWorld(((CraftRegionAccessor) regionAccessor).getHandle(), blockPosition, blockPosition, definedstructureinfo, randomSource, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTCompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructure;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructureManager;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@@ -25,9 +25,9 @@ import org.bukkit.structure.StructureManager;
|
||||
|
||||
public class CraftStructureManager implements StructureManager {
|
||||
|
||||
private final DefinedStructureManager structureManager;
|
||||
private final StructureTemplateManager structureManager;
|
||||
|
||||
public CraftStructureManager(DefinedStructureManager structureManager) {
|
||||
public CraftStructureManager(StructureTemplateManager structureManager) {
|
||||
this.structureManager = structureManager;
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ public class CraftStructureManager implements StructureManager {
|
||||
if (unregister) {
|
||||
structureManager.structureRepository.remove(key);
|
||||
}
|
||||
Path path = structureManager.createAndValidatePathToStructure(key, ".nbt");
|
||||
Path path = structureManager.getPathToGeneratedStructure(key, ".nbt");
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getStructureFile(NamespacedKey structureKey) {
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
return structureManager.createAndValidatePathToStructure(minecraftKey, ".nbt").toFile();
|
||||
return structureManager.getPathToGeneratedStructure(minecraftKey, ".nbt").toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user