aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch437
1 files changed, 437 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch b/patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch
new file mode 100644
index 0000000000..feea12601a
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/server/commands/PlaceCommand.java.patch
@@ -0,0 +1,437 @@
+--- a/net/minecraft/server/commands/PlaceCommand.java
++++ b/net/minecraft/server/commands/PlaceCommand.java
+@@ -3,16 +3,15 @@
+ import com.mojang.brigadier.CommandDispatcher;
+ import com.mojang.brigadier.arguments.FloatArgumentType;
+ import com.mojang.brigadier.arguments.IntegerArgumentType;
+-import com.mojang.brigadier.context.CommandContext;
++import com.mojang.brigadier.builder.LiteralArgumentBuilder;
++import com.mojang.brigadier.builder.RequiredArgumentBuilder;
+ import com.mojang.brigadier.exceptions.CommandSyntaxException;
+ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
+ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
+ import com.mojang.brigadier.suggestion.SuggestionProvider;
+-import com.mojang.brigadier.suggestion.SuggestionsBuilder;
+ import java.util.Optional;
+ import net.minecraft.ResourceLocationException;
+ import net.minecraft.commands.CommandSourceStack;
+-import net.minecraft.commands.Commands;
+ import net.minecraft.commands.SharedSuggestionProvider;
+ import net.minecraft.commands.arguments.ResourceKeyArgument;
+ import net.minecraft.commands.arguments.ResourceLocationArgument;
+@@ -43,309 +42,153 @@
+ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
+
+ public class PlaceCommand {
+- private static final SimpleCommandExceptionType ERROR_FEATURE_FAILED = new SimpleCommandExceptionType(
+- Component.translatable("commands.place.feature.failed")
+- );
++
++ private static final SimpleCommandExceptionType ERROR_FEATURE_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.place.feature.failed"));
+ private static final SimpleCommandExceptionType ERROR_JIGSAW_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.place.jigsaw.failed"));
+- private static final SimpleCommandExceptionType ERROR_STRUCTURE_FAILED = new SimpleCommandExceptionType(
+- Component.translatable("commands.place.structure.failed")
+- );
+- private static final DynamicCommandExceptionType ERROR_TEMPLATE_INVALID = new DynamicCommandExceptionType(
+- template -> Component.translatableEscape("commands.place.template.invalid", template)
+- );
+- private static final SimpleCommandExceptionType ERROR_TEMPLATE_FAILED = new SimpleCommandExceptionType(
+- Component.translatable("commands.place.template.failed")
+- );
+- private static final SuggestionProvider<CommandSourceStack> SUGGEST_TEMPLATES = (context, builder) -> {
+- StructureTemplateManager structureManager = context.getSource().getLevel().getStructureManager();
+- return SharedSuggestionProvider.suggestResource(structureManager.listTemplates(), builder);
++ private static final SimpleCommandExceptionType ERROR_STRUCTURE_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.place.structure.failed"));
++ private static final DynamicCommandExceptionType ERROR_TEMPLATE_INVALID = new DynamicCommandExceptionType((object) -> {
++ return Component.translatableEscape("commands.place.template.invalid", object);
++ });
++ private static final SimpleCommandExceptionType ERROR_TEMPLATE_FAILED = new SimpleCommandExceptionType(Component.translatable("commands.place.template.failed"));
++ private static final SuggestionProvider<CommandSourceStack> SUGGEST_TEMPLATES = (commandcontext, suggestionsbuilder) -> {
++ StructureTemplateManager structuretemplatemanager = ((CommandSourceStack) commandcontext.getSource()).getLevel().getStructureManager();
++
++ return SharedSuggestionProvider.suggestResource(structuretemplatemanager.listTemplates(), suggestionsbuilder);
+ };
+
++ public PlaceCommand() {}
++
+ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
+- dispatcher.register(
+- Commands.literal("place")
+- .requires(source -> source.hasPermission(2))
+- .then(
+- Commands.literal("feature")
+- .then(
+- Commands.argument("feature", ResourceKeyArgument.key(Registries.CONFIGURED_FEATURE))
+- .executes(
+- context -> placeFeature(
+- context.getSource(),
+- ResourceKeyArgument.getConfiguredFeature(context, "feature"),
+- BlockPos.containing(context.getSource().getPosition())
+- )
+- )
+- .then(
+- Commands.argument("pos", BlockPosArgument.blockPos())
+- .executes(
+- context -> placeFeature(
+- context.getSource(),
+- ResourceKeyArgument.getConfiguredFeature(context, "feature"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos")
+- )
+- )
+- )
+- )
+- )
+- .then(
+- Commands.literal("jigsaw")
+- .then(
+- Commands.argument("pool", ResourceKeyArgument.key(Registries.TEMPLATE_POOL))
+- .then(
+- Commands.argument("target", ResourceLocationArgument.id())
+- .then(
+- Commands.argument("max_depth", IntegerArgumentType.integer(1, 7))
+- .executes(
+- context -> placeJigsaw(
+- context.getSource(),
+- ResourceKeyArgument.getStructureTemplatePool(context, "pool"),
+- ResourceLocationArgument.getId(context, "target"),
+- IntegerArgumentType.getInteger(context, "max_depth"),
+- BlockPos.containing(context.getSource().getPosition())
+- )
+- )
+- .then(
+- Commands.argument("position", BlockPosArgument.blockPos())
+- .executes(
+- context -> placeJigsaw(
+- context.getSource(),
+- ResourceKeyArgument.getStructureTemplatePool(context, "pool"),
+- ResourceLocationArgument.getId(context, "target"),
+- IntegerArgumentType.getInteger(context, "max_depth"),
+- BlockPosArgument.getLoadedBlockPos(context, "position")
+- )
+- )
+- )
+- )
+- )
+- )
+- )
+- .then(
+- Commands.literal("structure")
+- .then(
+- Commands.argument("structure", ResourceKeyArgument.key(Registries.STRUCTURE))
+- .executes(
+- context -> placeStructure(
+- context.getSource(),
+- ResourceKeyArgument.getStructure(context, "structure"),
+- BlockPos.containing(context.getSource().getPosition())
+- )
+- )
+- .then(
+- Commands.argument("pos", BlockPosArgument.blockPos())
+- .executes(
+- context -> placeStructure(
+- context.getSource(),
+- ResourceKeyArgument.getStructure(context, "structure"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos")
+- )
+- )
+- )
+- )
+- )
+- .then(
+- Commands.literal("template")
+- .then(
+- Commands.argument("template", ResourceLocationArgument.id())
+- .suggests(SUGGEST_TEMPLATES)
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPos.containing(context.getSource().getPosition()),
+- Rotation.NONE,
+- Mirror.NONE,
+- 1.0F,
+- 0
+- )
+- )
+- .then(
+- Commands.argument("pos", BlockPosArgument.blockPos())
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos"),
+- Rotation.NONE,
+- Mirror.NONE,
+- 1.0F,
+- 0
+- )
+- )
+- .then(
+- Commands.argument("rotation", TemplateRotationArgument.templateRotation())
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos"),
+- TemplateRotationArgument.getRotation(context, "rotation"),
+- Mirror.NONE,
+- 1.0F,
+- 0
+- )
+- )
+- .then(
+- Commands.argument("mirror", TemplateMirrorArgument.templateMirror())
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos"),
+- TemplateRotationArgument.getRotation(context, "rotation"),
+- TemplateMirrorArgument.getMirror(context, "mirror"),
+- 1.0F,
+- 0
+- )
+- )
+- .then(
+- Commands.argument("integrity", FloatArgumentType.floatArg(0.0F, 1.0F))
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos"),
+- TemplateRotationArgument.getRotation(context, "rotation"),
+- TemplateMirrorArgument.getMirror(context, "mirror"),
+- FloatArgumentType.getFloat(context, "integrity"),
+- 0
+- )
+- )
+- .then(
+- Commands.argument("seed", IntegerArgumentType.integer())
+- .executes(
+- context -> placeTemplate(
+- context.getSource(),
+- ResourceLocationArgument.getId(context, "template"),
+- BlockPosArgument.getLoadedBlockPos(context, "pos"),
+- TemplateRotationArgument.getRotation(context, "rotation"),
+- TemplateMirrorArgument.getMirror(context, "mirror"),
+- FloatArgumentType.getFloat(context, "integrity"),
+- IntegerArgumentType.getInteger(context, "seed")
+- )
+- )
+- )
+- )
+- )
+- )
+- )
+- )
+- )
+- );
++ dispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("place").requires((commandlistenerwrapper) -> {
++ return commandlistenerwrapper.hasPermission(2);
++ })).then(net.minecraft.commands.Commands.literal("feature").then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("feature", ResourceKeyArgument.key(Registries.CONFIGURED_FEATURE)).executes((commandcontext) -> {
++ return placeFeature((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getConfiguredFeature(commandcontext, "feature"), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()));
++ })).then(net.minecraft.commands.Commands.argument("pos", BlockPosArgument.blockPos()).executes((commandcontext) -> {
++ return placeFeature((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getConfiguredFeature(commandcontext, "feature"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"));
++ }))))).then(net.minecraft.commands.Commands.literal("jigsaw").then(net.minecraft.commands.Commands.argument("pool", ResourceKeyArgument.key(Registries.TEMPLATE_POOL)).then(net.minecraft.commands.Commands.argument("target", ResourceLocationArgument.id()).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("max_depth", IntegerArgumentType.integer(1, 7)).executes((commandcontext) -> {
++ return placeJigsaw((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getStructureTemplatePool(commandcontext, "pool"), ResourceLocationArgument.getId(commandcontext, "target"), IntegerArgumentType.getInteger(commandcontext, "max_depth"), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()));
++ })).then(net.minecraft.commands.Commands.argument("position", BlockPosArgument.blockPos()).executes((commandcontext) -> {
++ return placeJigsaw((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getStructureTemplatePool(commandcontext, "pool"), ResourceLocationArgument.getId(commandcontext, "target"), IntegerArgumentType.getInteger(commandcontext, "max_depth"), BlockPosArgument.getLoadedBlockPos(commandcontext, "position"));
++ }))))))).then(net.minecraft.commands.Commands.literal("structure").then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("structure", ResourceKeyArgument.key(Registries.STRUCTURE)).executes((commandcontext) -> {
++ return placeStructure((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getStructure(commandcontext, "structure"), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()));
++ })).then(net.minecraft.commands.Commands.argument("pos", BlockPosArgument.blockPos()).executes((commandcontext) -> {
++ return placeStructure((CommandSourceStack) commandcontext.getSource(), ResourceKeyArgument.getStructure(commandcontext, "structure"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"));
++ }))))).then(net.minecraft.commands.Commands.literal("template").then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("template", ResourceLocationArgument.id()).suggests(PlaceCommand.SUGGEST_TEMPLATES).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()), Rotation.NONE, Mirror.NONE, 1.0F, 0);
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("pos", BlockPosArgument.blockPos()).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"), Rotation.NONE, Mirror.NONE, 1.0F, 0);
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("rotation", TemplateRotationArgument.templateRotation()).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"), TemplateRotationArgument.getRotation(commandcontext, "rotation"), Mirror.NONE, 1.0F, 0);
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("mirror", TemplateMirrorArgument.templateMirror()).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"), TemplateRotationArgument.getRotation(commandcontext, "rotation"), TemplateMirrorArgument.getMirror(commandcontext, "mirror"), 1.0F, 0);
++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("integrity", FloatArgumentType.floatArg(0.0F, 1.0F)).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"), TemplateRotationArgument.getRotation(commandcontext, "rotation"), TemplateMirrorArgument.getMirror(commandcontext, "mirror"), FloatArgumentType.getFloat(commandcontext, "integrity"), 0);
++ })).then(net.minecraft.commands.Commands.argument("seed", IntegerArgumentType.integer()).executes((commandcontext) -> {
++ return placeTemplate((CommandSourceStack) commandcontext.getSource(), ResourceLocationArgument.getId(commandcontext, "template"), BlockPosArgument.getLoadedBlockPos(commandcontext, "pos"), TemplateRotationArgument.getRotation(commandcontext, "rotation"), TemplateMirrorArgument.getMirror(commandcontext, "mirror"), FloatArgumentType.getFloat(commandcontext, "integrity"), IntegerArgumentType.getInteger(commandcontext, "seed"));
++ })))))))));
+ }
+
+ public static int placeFeature(CommandSourceStack source, Holder.Reference<ConfiguredFeature<?, ?>> feature, BlockPos pos) throws CommandSyntaxException {
+- ServerLevel level = source.getLevel();
+- ConfiguredFeature<?, ?> configuredFeature = feature.value();
+- ChunkPos chunkPos = new ChunkPos(pos);
+- checkLoaded(level, new ChunkPos(chunkPos.x - 1, chunkPos.z - 1), new ChunkPos(chunkPos.x + 1, chunkPos.z + 1));
+- if (!configuredFeature.place(level, level.getChunkSource().getGenerator(), level.getRandom(), pos)) {
+- throw ERROR_FEATURE_FAILED.create();
++ ServerLevel worldserver = source.getLevel();
++ ConfiguredFeature<?, ?> worldgenfeatureconfigured = (ConfiguredFeature) feature.value();
++ ChunkPos chunkcoordintpair = new ChunkPos(pos);
++
++ checkLoaded(worldserver, new ChunkPos(chunkcoordintpair.x - 1, chunkcoordintpair.z - 1), new ChunkPos(chunkcoordintpair.x + 1, chunkcoordintpair.z + 1));
++ if (!worldgenfeatureconfigured.place(worldserver, worldserver.getChunkSource().getGenerator(), worldserver.getRandom(), pos)) {
++ throw PlaceCommand.ERROR_FEATURE_FAILED.create();
+ } else {
+- String string = feature.key().location().toString();
+- source.sendSuccess(() -> Component.translatable("commands.place.feature.success", string, pos.getX(), pos.getY(), pos.getZ()), true);
++ String s = feature.key().location().toString();
++
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.place.feature.success", s, pos.getX(), pos.getY(), pos.getZ());
++ }, true);
+ return 1;
+ }
+ }
+
+ public static int placeJigsaw(CommandSourceStack source, Holder<StructureTemplatePool> templatePool, ResourceLocation target, int maxDepth, BlockPos pos) throws CommandSyntaxException {
+- ServerLevel level = source.getLevel();
+- if (!JigsawPlacement.generateJigsaw(level, templatePool, target, maxDepth, pos, false)) {
+- throw ERROR_JIGSAW_FAILED.create();
++ ServerLevel worldserver = source.getLevel();
++
++ if (!JigsawPlacement.generateJigsaw(worldserver, templatePool, target, maxDepth, pos, false)) {
++ throw PlaceCommand.ERROR_JIGSAW_FAILED.create();
+ } else {
+- source.sendSuccess(() -> Component.translatable("commands.place.jigsaw.success", pos.getX(), pos.getY(), pos.getZ()), true);
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.place.jigsaw.success", pos.getX(), pos.getY(), pos.getZ());
++ }, true);
+ return 1;
+ }
+ }
+
+ public static int placeStructure(CommandSourceStack source, Holder.Reference<Structure> structure, BlockPos pos) throws CommandSyntaxException {
+- ServerLevel level = source.getLevel();
+- Structure structure1 = structure.value();
+- ChunkGenerator generator = level.getChunkSource().getGenerator();
+- StructureStart structureStart = structure1.generate(
+- source.registryAccess(),
+- generator,
+- generator.getBiomeSource(),
+- level.getChunkSource().randomState(),
+- level.getStructureManager(),
+- level.getSeed(),
+- new ChunkPos(pos),
+- 0,
+- level,
+- biome -> true
+- );
+- if (!structureStart.isValid()) {
+- throw ERROR_STRUCTURE_FAILED.create();
++ ServerLevel worldserver = source.getLevel();
++ Structure structure1 = (Structure) structure.value();
++ ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator();
++ StructureStart structurestart = structure1.generate(source.registryAccess(), chunkgenerator, chunkgenerator.getBiomeSource(), worldserver.getChunkSource().randomState(), worldserver.getStructureManager(), worldserver.getSeed(), new ChunkPos(pos), 0, worldserver, (holder) -> {
++ return true;
++ });
++
++ if (!structurestart.isValid()) {
++ throw PlaceCommand.ERROR_STRUCTURE_FAILED.create();
+ } else {
+- BoundingBox boundingBox = structureStart.getBoundingBox();
+- ChunkPos chunkPos = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.minX()), SectionPos.blockToSectionCoord(boundingBox.minZ()));
+- ChunkPos chunkPos1 = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.maxX()), SectionPos.blockToSectionCoord(boundingBox.maxZ()));
+- checkLoaded(level, chunkPos, chunkPos1);
+- ChunkPos.rangeClosed(chunkPos, chunkPos1)
+- .forEach(
+- chunkPos2 -> structureStart.placeInChunk(
+- level,
+- level.structureManager(),
+- generator,
+- level.getRandom(),
+- new BoundingBox(
+- chunkPos2.getMinBlockX(),
+- level.getMinBuildHeight(),
+- chunkPos2.getMinBlockZ(),
+- chunkPos2.getMaxBlockX(),
+- level.getMaxBuildHeight(),
+- chunkPos2.getMaxBlockZ()
+- ),
+- chunkPos2
+- )
+- );
+- String string = structure.key().location().toString();
+- source.sendSuccess(() -> Component.translatable("commands.place.structure.success", string, pos.getX(), pos.getY(), pos.getZ()), true);
++ structurestart.generationEventCause = org.bukkit.event.world.AsyncStructureGenerateEvent.Cause.COMMAND; // CraftBukkit - set AsyncStructureGenerateEvent.Cause.COMMAND as generation cause
++ BoundingBox structureboundingbox = structurestart.getBoundingBox();
++ ChunkPos chunkcoordintpair = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.minX()), SectionPos.blockToSectionCoord(structureboundingbox.minZ()));
++ ChunkPos chunkcoordintpair1 = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.maxX()), SectionPos.blockToSectionCoord(structureboundingbox.maxZ()));
++
++ checkLoaded(worldserver, chunkcoordintpair, chunkcoordintpair1);
++ ChunkPos.rangeClosed(chunkcoordintpair, chunkcoordintpair1).forEach((chunkcoordintpair2) -> {
++ structurestart.placeInChunk(worldserver, worldserver.structureManager(), chunkgenerator, worldserver.getRandom(), new BoundingBox(chunkcoordintpair2.getMinBlockX(), worldserver.getMinBuildHeight(), chunkcoordintpair2.getMinBlockZ(), chunkcoordintpair2.getMaxBlockX(), worldserver.getMaxBuildHeight(), chunkcoordintpair2.getMaxBlockZ()), chunkcoordintpair2);
++ });
++ String s = structure.key().location().toString();
++
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.place.structure.success", s, pos.getX(), pos.getY(), pos.getZ());
++ }, true);
+ return 1;
+ }
+ }
+
+- public static int placeTemplate(
+- CommandSourceStack source, ResourceLocation template, BlockPos pos, Rotation rotation, Mirror mirror, float integrity, int seed
+- ) throws CommandSyntaxException {
+- ServerLevel level = source.getLevel();
+- StructureTemplateManager structureManager = level.getStructureManager();
++ public static int placeTemplate(CommandSourceStack source, ResourceLocation template, BlockPos pos, Rotation rotation, Mirror mirror, float integrity, int seed) throws CommandSyntaxException {
++ ServerLevel worldserver = source.getLevel();
++ StructureTemplateManager structuretemplatemanager = worldserver.getStructureManager();
+
+- Optional<StructureTemplate> optional;
++ Optional optional;
++
+ try {
+- optional = structureManager.get(template);
+- } catch (ResourceLocationException var13) {
+- throw ERROR_TEMPLATE_INVALID.create(template);
++ optional = structuretemplatemanager.get(template);
++ } catch (ResourceLocationException resourcekeyinvalidexception) {
++ throw PlaceCommand.ERROR_TEMPLATE_INVALID.create(template);
+ }
+
+ if (optional.isEmpty()) {
+- throw ERROR_TEMPLATE_INVALID.create(template);
++ throw PlaceCommand.ERROR_TEMPLATE_INVALID.create(template);
+ } else {
+- StructureTemplate structureTemplate = optional.get();
+- checkLoaded(level, new ChunkPos(pos), new ChunkPos(pos.offset(structureTemplate.getSize())));
+- StructurePlaceSettings structurePlaceSettings = new StructurePlaceSettings().setMirror(mirror).setRotation(rotation);
++ StructureTemplate definedstructure = (StructureTemplate) optional.get();
++
++ checkLoaded(worldserver, new ChunkPos(pos), new ChunkPos(pos.offset(definedstructure.getSize())));
++ StructurePlaceSettings definedstructureinfo = (new StructurePlaceSettings()).setMirror(mirror).setRotation(rotation);
++
+ if (integrity < 1.0F) {
+- structurePlaceSettings.clearProcessors()
+- .addProcessor(new BlockRotProcessor(integrity))
+- .setRandom(StructureBlockEntity.createRandom((long)seed));
++ definedstructureinfo.clearProcessors().addProcessor(new BlockRotProcessor(integrity)).setRandom(StructureBlockEntity.createRandom((long) seed));
+ }
+
+- boolean flag = structureTemplate.placeInWorld(level, pos, pos, structurePlaceSettings, StructureBlockEntity.createRandom((long)seed), 2);
++ boolean flag = definedstructure.placeInWorld(worldserver, pos, pos, definedstructureinfo, StructureBlockEntity.createRandom((long) seed), 2);
++
+ if (!flag) {
+- throw ERROR_TEMPLATE_FAILED.create();
++ throw PlaceCommand.ERROR_TEMPLATE_FAILED.create();
+ } else {
+- source.sendSuccess(
+- () -> Component.translatable("commands.place.template.success", Component.translationArg(template), pos.getX(), pos.getY(), pos.getZ()),
+- true
+- );
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.place.template.success", Component.translationArg(template), pos.getX(), pos.getY(), pos.getZ());
++ }, true);
+ return 1;
+ }
+ }
+ }
+
+ private static void checkLoaded(ServerLevel level, ChunkPos start, ChunkPos end) throws CommandSyntaxException {
+- if (ChunkPos.rangeClosed(start, end).filter(chunkPos -> !level.isLoaded(chunkPos.getWorldPosition())).findAny().isPresent()) {
++ if (ChunkPos.rangeClosed(start, end).filter((chunkcoordintpair2) -> {
++ return !level.isLoaded(chunkcoordintpair2.getWorldPosition());
++ }).findAny().isPresent()) {
+ throw BlockPosArgument.ERROR_NOT_LOADED.create();
+ }
+ }