--- a/net/minecraft/server/commands/PlaceCommand.java
+++ b/net/minecraft/server/commands/PlaceCommand.java
@@ -3,6 +3,8 @@
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.arguments.FloatArgumentType;
 import com.mojang.brigadier.arguments.IntegerArgumentType;
+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;
@@ -10,7 +12,6 @@
 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;
@@ -41,308 +42,155 @@
 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(
-        id -> Component.translatableEscape("commands.place.template.invalid", id)
-    );
-    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 structureTemplateManager = context.getSource().getLevel().getStructureManager();
-        return SharedSuggestionProvider.suggestResource(structureTemplateManager.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, 20))
-                                                .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 PlaceCommand.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 PlaceCommand.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, 20)).executes((commandcontext) -> {
+            return PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 PlaceCommand.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 serverLevel = source.getLevel();
-        ConfiguredFeature<?, ?> configuredFeature = feature.value();
-        ChunkPos chunkPos = new ChunkPos(pos);
-        checkLoaded(serverLevel, new ChunkPos(chunkPos.x - 1, chunkPos.z - 1), new ChunkPos(chunkPos.x + 1, chunkPos.z + 1));
-        if (!configuredFeature.place(serverLevel, serverLevel.getChunkSource().getGenerator(), serverLevel.getRandom(), pos)) {
-            throw ERROR_FEATURE_FAILED.create();
+        ServerLevel worldserver = source.getLevel();
+        ConfiguredFeature<?, ?> worldgenfeatureconfigured = (ConfiguredFeature) feature.value();
+        ChunkPos chunkcoordintpair = new ChunkPos(pos);
+
+        PlaceCommand.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> structurePool, ResourceLocation id, int maxDepth, BlockPos pos) throws CommandSyntaxException {
-        ServerLevel serverLevel = source.getLevel();
-        ChunkPos chunkPos = new ChunkPos(pos);
-        checkLoaded(serverLevel, chunkPos, chunkPos);
-        if (!JigsawPlacement.generateJigsaw(serverLevel, structurePool, id, maxDepth, pos, false)) {
-            throw ERROR_JIGSAW_FAILED.create();
+        ServerLevel worldserver = source.getLevel();
+        ChunkPos chunkcoordintpair = new ChunkPos(pos);
+
+        PlaceCommand.checkLoaded(worldserver, chunkcoordintpair, chunkcoordintpair);
+        if (!JigsawPlacement.generateJigsaw(worldserver, structurePool, id, 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 serverLevel = source.getLevel();
-        Structure structure2 = structure.value();
-        ChunkGenerator chunkGenerator = serverLevel.getChunkSource().getGenerator();
-        StructureStart structureStart = structure2.generate(
-            source.registryAccess(),
-            chunkGenerator,
-            chunkGenerator.getBiomeSource(),
-            serverLevel.getChunkSource().randomState(),
-            serverLevel.getStructureManager(),
-            serverLevel.getSeed(),
-            new ChunkPos(pos),
-            0,
-            serverLevel,
-            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 chunkPos2 = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.maxX()), SectionPos.blockToSectionCoord(boundingBox.maxZ()));
-            checkLoaded(serverLevel, chunkPos, chunkPos2);
-            ChunkPos.rangeClosed(chunkPos, chunkPos2)
-                .forEach(
-                    chunkPosx -> structureStart.placeInChunk(
-                            serverLevel,
-                            serverLevel.structureManager(),
-                            chunkGenerator,
-                            serverLevel.getRandom(),
-                            new BoundingBox(
-                                chunkPosx.getMinBlockX(),
-                                serverLevel.getMinBuildHeight(),
-                                chunkPosx.getMinBlockZ(),
-                                chunkPosx.getMaxBlockX(),
-                                serverLevel.getMaxBuildHeight(),
-                                chunkPosx.getMaxBlockZ()
-                            ),
-                            chunkPosx
-                        )
-                );
-            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()));
+
+            PlaceCommand.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 id, BlockPos pos, Rotation rotation, Mirror mirror, float integrity, int seed) throws CommandSyntaxException {
-        ServerLevel serverLevel = source.getLevel();
-        StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
+        ServerLevel worldserver = source.getLevel();
+        StructureTemplateManager structuretemplatemanager = worldserver.getStructureManager();
+
+        Optional optional;
 
-        Optional<StructureTemplate> optional;
         try {
-            optional = structureTemplateManager.get(id);
-        } catch (ResourceLocationException var13) {
-            throw ERROR_TEMPLATE_INVALID.create(id);
+            optional = structuretemplatemanager.get(id);
+        } catch (ResourceLocationException resourcekeyinvalidexception) {
+            throw PlaceCommand.ERROR_TEMPLATE_INVALID.create(id);
         }
 
         if (optional.isEmpty()) {
-            throw ERROR_TEMPLATE_INVALID.create(id);
+            throw PlaceCommand.ERROR_TEMPLATE_INVALID.create(id);
         } else {
-            StructureTemplate structureTemplate = optional.get();
-            checkLoaded(serverLevel, new ChunkPos(pos), new ChunkPos(pos.offset(structureTemplate.getSize())));
-            StructurePlaceSettings structurePlaceSettings = new StructurePlaceSettings().setMirror(mirror).setRotation(rotation);
+            StructureTemplate definedstructure = (StructureTemplate) optional.get();
+
+            PlaceCommand.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 bl = structureTemplate.placeInWorld(serverLevel, pos, pos, structurePlaceSettings, StructureBlockEntity.createRandom((long)seed), 2);
-            if (!bl) {
-                throw ERROR_TEMPLATE_FAILED.create();
+            boolean flag = definedstructure.placeInWorld(worldserver, pos, pos, definedstructureinfo, StructureBlockEntity.createRandom((long) seed), 2);
+
+            if (!flag) {
+                throw PlaceCommand.ERROR_TEMPLATE_FAILED.create();
             } else {
-                source.sendSuccess(
-                    () -> Component.translatable("commands.place.template.success", Component.translationArg(id), pos.getX(), pos.getY(), pos.getZ()), true
-                );
+                source.sendSuccess(() -> {
+                    return Component.translatable("commands.place.template.success", Component.translationArg(id), pos.getX(), pos.getY(), pos.getZ());
+                }, true);
                 return 1;
             }
         }
     }
 
     private static void checkLoaded(ServerLevel world, ChunkPos pos1, ChunkPos pos2) throws CommandSyntaxException {
-        if (ChunkPos.rangeClosed(pos1, pos2).filter(pos -> !world.isLoaded(pos.getWorldPosition())).findAny().isPresent()) {
+        if (ChunkPos.rangeClosed(pos1, pos2).filter((chunkcoordintpair2) -> {
+            return !world.isLoaded(chunkcoordintpair2.getWorldPosition());
+        }).findAny().isPresent()) {
             throw BlockPosArgument.ERROR_NOT_LOADED.create();
         }
     }
