Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
@@ -2,18 +2,18 @@ package org.bukkit.craftbukkit.structure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructure;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockStates;
|
||||
import org.bukkit.structure.Palette;
|
||||
|
||||
public class CraftPalette implements Palette {
|
||||
|
||||
private final DefinedStructure.b palette;
|
||||
private final IRegistryCustom registry;
|
||||
private final StructureTemplate.Palette palette;
|
||||
private final RegistryAccess registry;
|
||||
|
||||
public CraftPalette(DefinedStructure.b palette, IRegistryCustom registry) {
|
||||
public CraftPalette(StructureTemplate.Palette palette, RegistryAccess registry) {
|
||||
this.palette = palette;
|
||||
this.registry = registry;
|
||||
}
|
||||
@@ -21,14 +21,14 @@ public class CraftPalette implements Palette {
|
||||
@Override
|
||||
public List<BlockState> getBlocks() {
|
||||
List<BlockState> blocks = new ArrayList<>();
|
||||
for (DefinedStructure.BlockInfo blockInfo : palette.blocks()) {
|
||||
blocks.add(CraftBlockStates.getBlockState(registry, blockInfo.pos(), blockInfo.state(), blockInfo.nbt()));
|
||||
for (StructureTemplate.StructureBlockInfo blockInfo : this.palette.blocks()) {
|
||||
blocks.add(CraftBlockStates.getBlockState(this.registry, blockInfo.pos(), blockInfo.state(), blockInfo.nbt()));
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockCount() {
|
||||
return palette.blocks().size();
|
||||
return this.palette.blocks().size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||
import net.minecraft.world.level.GeneratorAccessSeed;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.EnumBlockMirror;
|
||||
import net.minecraft.world.level.block.EnumBlockRotation;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructure;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructureInfo;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructureProcessorRotation;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProcessor;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.RegionAccessor;
|
||||
@@ -43,17 +42,17 @@ import org.bukkit.util.EntityTransformer;
|
||||
|
||||
public class CraftStructure implements Structure {
|
||||
|
||||
private final DefinedStructure structure;
|
||||
private final IRegistryCustom registry;
|
||||
private final StructureTemplate structure;
|
||||
private final RegistryAccess registry;
|
||||
|
||||
public CraftStructure(DefinedStructure structure, IRegistryCustom registry) {
|
||||
public CraftStructure(StructureTemplate structure, RegistryAccess registry) {
|
||||
this.structure = structure;
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(Location location, boolean includeEntities, StructureRotation structureRotation, Mirror mirror, int palette, float integrity, Random random) {
|
||||
place(location, includeEntities, structureRotation, mirror, palette, integrity, random, Collections.emptyList(), Collections.emptyList());
|
||||
this.place(location, includeEntities, structureRotation, mirror, palette, integrity, random, Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,12 +63,12 @@ public class CraftStructure implements Structure {
|
||||
Preconditions.checkArgument(world != null, "The World of Location cannot be null");
|
||||
|
||||
BlockVector blockVector = new BlockVector(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
place(world, blockVector, includeEntities, structureRotation, mirror, palette, integrity, random, blockTransformers, entityTransformers);
|
||||
this.place(world, blockVector, includeEntities, structureRotation, mirror, palette, integrity, random, blockTransformers, entityTransformers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(RegionAccessor regionAccessor, BlockVector location, boolean includeEntities, StructureRotation structureRotation, Mirror mirror, int palette, float integrity, Random random) {
|
||||
place(regionAccessor, location, includeEntities, structureRotation, mirror, palette, integrity, random, Collections.emptyList(), Collections.emptyList());
|
||||
this.place(regionAccessor, location, includeEntities, structureRotation, mirror, palette, integrity, random, Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,22 +82,22 @@ public class CraftStructure implements Structure {
|
||||
Preconditions.checkArgument(integrity >= 0F && integrity <= 1F, "Integrity value (%S) must be between 0 and 1 inclusive", integrity);
|
||||
|
||||
RandomSource randomSource = new RandomSourceWrapper(random);
|
||||
DefinedStructureInfo definedstructureinfo = new DefinedStructureInfo()
|
||||
.setMirror(EnumBlockMirror.valueOf(mirror.name()))
|
||||
.setRotation(EnumBlockRotation.valueOf(structureRotation.name()))
|
||||
StructurePlaceSettings definedstructureinfo = new StructurePlaceSettings()
|
||||
.setMirror(net.minecraft.world.level.block.Mirror.valueOf(mirror.name()))
|
||||
.setRotation(Rotation.valueOf(structureRotation.name()))
|
||||
.setIgnoreEntities(!includeEntities)
|
||||
.addProcessor(new DefinedStructureProcessorRotation(integrity))
|
||||
.addProcessor(new BlockRotProcessor(integrity))
|
||||
.setRandom(randomSource);
|
||||
definedstructureinfo.palette = palette;
|
||||
|
||||
BlockPosition blockPosition = CraftBlockVector.toBlockPosition(location);
|
||||
GeneratorAccessSeed handle = ((CraftRegionAccessor) regionAccessor).getHandle();
|
||||
BlockPos blockPosition = CraftBlockVector.toBlockPosition(location);
|
||||
WorldGenLevel handle = ((CraftRegionAccessor) regionAccessor).getHandle();
|
||||
|
||||
TransformerGeneratorAccess access = new TransformerGeneratorAccess();
|
||||
access.setHandle(handle);
|
||||
access.setStructureTransformer(new CraftStructureTransformer(handle, new ChunkCoordIntPair(blockPosition), blockTransformers, entityTransformers));
|
||||
access.setStructureTransformer(new CraftStructureTransformer(handle, new ChunkPos(blockPosition), blockTransformers, entityTransformers));
|
||||
|
||||
structure.placeInWorld(access, blockPosition, blockPosition, definedstructureinfo, randomSource, 2);
|
||||
this.structure.placeInWorld(access, blockPosition, blockPosition, definedstructureinfo, randomSource, 2);
|
||||
access.getStructureTransformer().discard();
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ public class CraftStructure implements Structure {
|
||||
|
||||
Location origin = new Location(world, Math.min(corner1.getBlockX(), corner2.getBlockX()), Math.min(corner1.getBlockY(), corner2.getBlockY()), Math.min(corner1.getBlockZ(), corner2.getBlockZ()));
|
||||
BlockVector size = new BlockVector(Math.abs(corner1.getBlockX() - corner2.getBlockX()), Math.abs(corner1.getBlockY() - corner2.getBlockY()), Math.abs(corner1.getBlockZ() - corner2.getBlockZ()));
|
||||
fill(origin, size, includeEntities);
|
||||
this.fill(origin, size, includeEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,19 +121,19 @@ public class CraftStructure implements Structure {
|
||||
Preconditions.checkArgument(size != null, "BlockVector size cannot be null");
|
||||
Preconditions.checkArgument(size.getBlockX() >= 1 && size.getBlockY() >= 1 && size.getBlockZ() >= 1, "Size must be at least 1x1x1 but was %sx%sx%s", size.getBlockX(), size.getBlockY(), size.getBlockZ());
|
||||
|
||||
structure.fillFromWorld(((CraftWorld) world).getHandle(), CraftLocation.toBlockPosition(origin), CraftBlockVector.toBlockPosition(size), includeEntities, Blocks.STRUCTURE_VOID);
|
||||
this.structure.fillFromWorld(((CraftWorld) world).getHandle(), CraftLocation.toBlockPosition(origin), CraftBlockVector.toBlockPosition(size), includeEntities, Blocks.STRUCTURE_VOID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector getSize() {
|
||||
return CraftBlockVector.toBukkit(structure.getSize());
|
||||
return CraftBlockVector.toBukkit(this.structure.getSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntities() {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
for (DefinedStructure.EntityInfo entity : structure.entityInfoList) {
|
||||
EntityTypes.create(entity.nbt, ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle(), EntitySpawnReason.STRUCTURE).ifPresent(dummyEntity -> {
|
||||
for (StructureTemplate.StructureEntityInfo entity : this.structure.entityInfoList) {
|
||||
EntityType.create(entity.nbt, ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle(), EntitySpawnReason.STRUCTURE).ifPresent(dummyEntity -> {
|
||||
dummyEntity.setPos(entity.pos.x, entity.pos.y, entity.pos.z);
|
||||
entities.add(dummyEntity.getBukkitEntity());
|
||||
});
|
||||
@@ -144,25 +143,25 @@ public class CraftStructure implements Structure {
|
||||
|
||||
@Override
|
||||
public int getEntityCount() {
|
||||
return structure.entityInfoList.size();
|
||||
return this.structure.entityInfoList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Palette> getPalettes() {
|
||||
return structure.palettes.stream().map((palette) -> new CraftPalette(palette, registry)).collect(Collectors.toList());
|
||||
return this.structure.palettes.stream().map((palette) -> new CraftPalette(palette, this.registry)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPaletteCount() {
|
||||
return structure.palettes.size();
|
||||
return this.structure.palettes.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistentDataContainer getPersistentDataContainer() {
|
||||
return getHandle().persistentDataContainer;
|
||||
return this.getHandle().persistentDataContainer;
|
||||
}
|
||||
|
||||
public DefinedStructure getHandle() {
|
||||
return structure;
|
||||
public StructureTemplate getHandle() {
|
||||
return this.structure;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
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.core.RegistryAccess;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@@ -27,9 +27,9 @@ import org.bukkit.structure.StructureManager;
|
||||
public class CraftStructureManager implements StructureManager {
|
||||
|
||||
private final StructureTemplateManager structureManager;
|
||||
private final IRegistryCustom registry;
|
||||
private final RegistryAccess registry;
|
||||
|
||||
public CraftStructureManager(StructureTemplateManager structureManager, IRegistryCustom registry) {
|
||||
public CraftStructureManager(StructureTemplateManager structureManager, RegistryAccess registry) {
|
||||
this.structureManager = structureManager;
|
||||
this.registry = registry;
|
||||
}
|
||||
@@ -37,8 +37,8 @@ public class CraftStructureManager implements StructureManager {
|
||||
@Override
|
||||
public Map<NamespacedKey, Structure> getStructures() {
|
||||
Map<NamespacedKey, Structure> cachedStructures = new HashMap<>();
|
||||
for (Map.Entry<MinecraftKey, Optional<DefinedStructure>> entry : structureManager.structureRepository.entrySet()) {
|
||||
entry.getValue().ifPresent(definedStructure -> cachedStructures.put(CraftNamespacedKey.fromMinecraft(entry.getKey()), new CraftStructure(definedStructure, registry)));
|
||||
for (Map.Entry<ResourceLocation, Optional<StructureTemplate>> entry : this.structureManager.structureRepository.entrySet()) {
|
||||
entry.getValue().ifPresent(definedStructure -> cachedStructures.put(CraftNamespacedKey.fromMinecraft(entry.getKey()), new CraftStructure(definedStructure, this.registry)));
|
||||
}
|
||||
return Collections.unmodifiableMap(cachedStructures);
|
||||
}
|
||||
@@ -47,39 +47,39 @@ public class CraftStructureManager implements StructureManager {
|
||||
public Structure getStructure(NamespacedKey structureKey) {
|
||||
Preconditions.checkArgument(structureKey != null, "NamespacedKey structureKey cannot be null");
|
||||
|
||||
final Optional<DefinedStructure> definedStructure = structureManager.structureRepository.get(CraftNamespacedKey.toMinecraft(structureKey));
|
||||
final Optional<StructureTemplate> definedStructure = this.structureManager.structureRepository.get(CraftNamespacedKey.toMinecraft(structureKey));
|
||||
if (definedStructure == null) {
|
||||
return null;
|
||||
}
|
||||
return definedStructure.map((s) -> new CraftStructure(s, registry)).orElse(null);
|
||||
return definedStructure.map((s) -> new CraftStructure(s, this.registry)).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure loadStructure(NamespacedKey structureKey, boolean register) {
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
ResourceLocation minecraftKey = this.createAndValidateMinecraftStructureKey(structureKey);
|
||||
|
||||
Optional<DefinedStructure> structure = structureManager.structureRepository.get(minecraftKey);
|
||||
Optional<StructureTemplate> structure = this.structureManager.structureRepository.get(minecraftKey);
|
||||
structure = structure == null ? Optional.empty() : structure;
|
||||
structure = structure.isPresent() ? structure : structureManager.loadFromGenerated(minecraftKey);
|
||||
structure = structure.isPresent() ? structure : structureManager.loadFromResource(minecraftKey);
|
||||
structure = structure.isPresent() ? structure : this.structureManager.loadFromGenerated(minecraftKey);
|
||||
structure = structure.isPresent() ? structure : this.structureManager.loadFromResource(minecraftKey);
|
||||
|
||||
if (register) {
|
||||
structureManager.structureRepository.put(minecraftKey, structure);
|
||||
this.structureManager.structureRepository.put(minecraftKey, structure);
|
||||
}
|
||||
|
||||
return structure.map((s) -> new CraftStructure(s, registry)).orElse(null);
|
||||
return structure.map((s) -> new CraftStructure(s, this.registry)).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure loadStructure(NamespacedKey structureKey) {
|
||||
return loadStructure(structureKey, true);
|
||||
return this.loadStructure(structureKey, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveStructure(NamespacedKey structureKey) {
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
ResourceLocation minecraftKey = this.createAndValidateMinecraftStructureKey(structureKey);
|
||||
|
||||
structureManager.save(minecraftKey);
|
||||
this.structureManager.save(minecraftKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,51 +87,51 @@ public class CraftStructureManager implements StructureManager {
|
||||
Preconditions.checkArgument(structureKey != null, "NamespacedKey structure cannot be null");
|
||||
Preconditions.checkArgument(structure != null, "Structure cannot be null");
|
||||
|
||||
File structureFile = getStructureFile(structureKey);
|
||||
File structureFile = this.getStructureFile(structureKey);
|
||||
Files.createDirectories(structureFile.toPath().getParent());
|
||||
saveStructure(structureFile, structure);
|
||||
this.saveStructure(structureFile, structure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure registerStructure(NamespacedKey structureKey, Structure structure) {
|
||||
Preconditions.checkArgument(structureKey != null, "NamespacedKey structureKey cannot be null");
|
||||
Preconditions.checkArgument(structure != null, "Structure cannot be null");
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
ResourceLocation minecraftKey = this.createAndValidateMinecraftStructureKey(structureKey);
|
||||
|
||||
final Optional<DefinedStructure> optionalDefinedStructure = Optional.of(((CraftStructure) structure).getHandle());
|
||||
final Optional<DefinedStructure> previousStructure = structureManager.structureRepository.put(minecraftKey, optionalDefinedStructure);
|
||||
return previousStructure == null ? null : previousStructure.map((s) -> new CraftStructure(s, registry)).orElse(null);
|
||||
final Optional<StructureTemplate> optionalDefinedStructure = Optional.of(((CraftStructure) structure).getHandle());
|
||||
final Optional<StructureTemplate> previousStructure = this.structureManager.structureRepository.put(minecraftKey, optionalDefinedStructure);
|
||||
return previousStructure == null ? null : previousStructure.map((s) -> new CraftStructure(s, this.registry)).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure unregisterStructure(NamespacedKey structureKey) {
|
||||
Preconditions.checkArgument(structureKey != null, "NamespacedKey structureKey cannot be null");
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
ResourceLocation minecraftKey = this.createAndValidateMinecraftStructureKey(structureKey);
|
||||
|
||||
final Optional<DefinedStructure> previousStructure = structureManager.structureRepository.remove(minecraftKey);
|
||||
return previousStructure == null ? null : previousStructure.map((s) -> new CraftStructure(s, registry)).orElse(null);
|
||||
final Optional<StructureTemplate> previousStructure = this.structureManager.structureRepository.remove(minecraftKey);
|
||||
return previousStructure == null ? null : previousStructure.map((s) -> new CraftStructure(s, this.registry)).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStructure(NamespacedKey structureKey) throws IOException {
|
||||
deleteStructure(structureKey, true);
|
||||
this.deleteStructure(structureKey, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStructure(NamespacedKey structureKey, boolean unregister) throws IOException {
|
||||
MinecraftKey key = CraftNamespacedKey.toMinecraft(structureKey);
|
||||
ResourceLocation key = CraftNamespacedKey.toMinecraft(structureKey);
|
||||
|
||||
if (unregister) {
|
||||
structureManager.structureRepository.remove(key);
|
||||
this.structureManager.structureRepository.remove(key);
|
||||
}
|
||||
Path path = structureManager.createAndValidatePathToGeneratedStructure(key, ".nbt");
|
||||
Path path = this.structureManager.createAndValidatePathToGeneratedStructure(key, ".nbt");
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getStructureFile(NamespacedKey structureKey) {
|
||||
MinecraftKey minecraftKey = createAndValidateMinecraftStructureKey(structureKey);
|
||||
return structureManager.createAndValidatePathToGeneratedStructure(minecraftKey, ".nbt").toFile();
|
||||
ResourceLocation minecraftKey = this.createAndValidateMinecraftStructureKey(structureKey);
|
||||
return this.structureManager.createAndValidatePathToGeneratedStructure(minecraftKey, ".nbt").toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,14 +139,14 @@ public class CraftStructureManager implements StructureManager {
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
FileInputStream fileinputstream = new FileInputStream(file);
|
||||
return loadStructure(fileinputstream);
|
||||
return this.loadStructure(fileinputstream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure loadStructure(InputStream inputStream) throws IOException {
|
||||
Preconditions.checkArgument(inputStream != null, "inputStream cannot be null");
|
||||
|
||||
return new CraftStructure(structureManager.readStructure(inputStream), registry);
|
||||
return new CraftStructure(this.structureManager.readStructure(inputStream), this.registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +155,7 @@ public class CraftStructureManager implements StructureManager {
|
||||
Preconditions.checkArgument(structure != null, "structure cannot be null");
|
||||
|
||||
FileOutputStream fileoutputstream = new FileOutputStream(file);
|
||||
saveStructure(fileoutputstream, structure);
|
||||
this.saveStructure(fileoutputstream, structure);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,19 +163,19 @@ public class CraftStructureManager implements StructureManager {
|
||||
Preconditions.checkArgument(outputStream != null, "outputStream cannot be null");
|
||||
Preconditions.checkArgument(structure != null, "structure cannot be null");
|
||||
|
||||
NBTTagCompound nbttagcompound = ((CraftStructure) structure).getHandle().save(new NBTTagCompound());
|
||||
NBTCompressedStreamTools.writeCompressed(nbttagcompound, outputStream);
|
||||
CompoundTag nbttagcompound = ((CraftStructure) structure).getHandle().save(new CompoundTag());
|
||||
NbtIo.writeCompressed(nbttagcompound, outputStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structure createStructure() {
|
||||
return new CraftStructure(new DefinedStructure(), registry);
|
||||
return new CraftStructure(new StructureTemplate(), this.registry);
|
||||
}
|
||||
|
||||
private MinecraftKey createAndValidateMinecraftStructureKey(NamespacedKey structureKey) {
|
||||
private ResourceLocation createAndValidateMinecraftStructureKey(NamespacedKey structureKey) {
|
||||
Preconditions.checkArgument(structureKey != null, "NamespacedKey structureKey cannot be null");
|
||||
|
||||
MinecraftKey minecraftkey = CraftNamespacedKey.toMinecraft(structureKey);
|
||||
ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(structureKey);
|
||||
Preconditions.checkArgument(!minecraftkey.getPath().contains("//"), "Resource key for Structures can not contain \"//\"");
|
||||
return minecraftkey;
|
||||
}
|
||||
@@ -183,6 +183,6 @@ public class CraftStructureManager implements StructureManager {
|
||||
@Override
|
||||
public Structure copy(Structure structure) {
|
||||
Preconditions.checkArgument(structure != null, "Structure cannot be null");
|
||||
return new CraftStructure(structureManager.readStructure(((CraftStructure) structure).getHandle().save(new NBTTagCompound())), registry);
|
||||
return new CraftStructure(this.structureManager.readStructure(((CraftStructure) structure).getHandle().save(new CompoundTag())), this.registry);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user