mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 01:34:04 +00:00
Cut structure place commands, importvanilla structures and transform nags
Batch 9 stage 1 cuts S9, S10, S11 and S14: - /iris structure place (Bukkit and modded) is gone; placing an Iris structure in-world is studio tooling that moves with the module. - /iris studio importvanilla no longer takes structures; the structure import commands are the one entry point. - The rotation/translate/scale nag on structure placements is gone. A parse-only pass keeps reporting dimension, region and biome files that are not JSON. - Their message keys leave the catalog and every locale.
This commit is contained in:
1 parent
949157fd26
commit
d1a9c2c68b
30 files changed
+57
-530
No files matched your search
-69
@@ -20,11 +20,6 @@ package art.arcane.iris.modded.command;
|
||||
|
||||
import art.arcane.iris.core.modules.StructureAssemblies;
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||
import art.arcane.iris.builtin.objects.ObjectPlacement;
|
||||
import art.arcane.iris.core.modules.ModuleObjectPlacement;
|
||||
import art.arcane.iris.engine.mantle.components.StructurePlacing;
|
||||
import art.arcane.iris.modded.ModdedIrisLog;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.structure.StructureIndexService;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
@@ -43,12 +38,9 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.SharedSuggestionProvider;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -78,13 +70,6 @@ public final class ModdedStructureCommands {
|
||||
.then(Commands.argument("key", StringArgumentType.greedyString()).suggests(IRIS_STRUCTURE_KEYS)
|
||||
.executes((CommandContext<CommandSourceStack> context) -> info(context.getSource(), StringArgumentType.getString(context, "key")))));
|
||||
|
||||
root.then(Commands.literal("place")
|
||||
.then(Commands.argument("key", StringArgumentType.greedyString()).suggests(IRIS_STRUCTURE_KEYS)
|
||||
.executes((CommandContext<CommandSourceStack> context) -> place(context.getSource(), StringArgumentType.getString(context, "key")))));
|
||||
root.then(Commands.literal("p")
|
||||
.then(Commands.argument("key", StringArgumentType.greedyString()).suggests(IRIS_STRUCTURE_KEYS)
|
||||
.executes((CommandContext<CommandSourceStack> context) -> place(context.getSource(), StringArgumentType.getString(context, "key")))));
|
||||
|
||||
root.then(message("import", "Structure import rebuilds vanilla & datapack structures as editable Iris resources through Bukkit/NMS template managers; run /iris structure import on a Bukkit server against this pack, then copy the pack folder over."));
|
||||
root.then(message("import-all", "Structure import rebuilds vanilla & datapack structures as editable Iris resources through Bukkit/NMS template managers; run /iris structure import on a Bukkit server against this pack, then copy the pack folder over."));
|
||||
root.then(message("reimport", "Structure import rebuilds vanilla & datapack structures as editable Iris resources through Bukkit/NMS template managers; run /iris structure import on a Bukkit server against this pack, then copy the pack folder over."));
|
||||
@@ -171,60 +156,6 @@ public final class ModdedStructureCommands {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int place(CommandSourceStack source, String keyRaw) {
|
||||
ServerPlayer player = source.getPlayer();
|
||||
if (player == null) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_THIS_COMMAND_CAN_ONLY_BE_USED_BY_PLAYERS_STRUCTURE_IS));
|
||||
return 0;
|
||||
}
|
||||
ServerLevel level = source.getLevel();
|
||||
Engine engine = IrisModdedCommands.engineFor(level);
|
||||
IrisData data = dataFor(source);
|
||||
if (data == null) {
|
||||
return 0;
|
||||
}
|
||||
String key = keyRaw.trim();
|
||||
IrisStructure structure = StructureResources.structure(data.getPackResources(), key);
|
||||
if (structure == null) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_NO_IRIS_STRUCTURE_THIS_PACK_2, MessageArgument.untrusted("key", key)));
|
||||
return 0;
|
||||
}
|
||||
int originX = player.blockPosition().getX();
|
||||
int originY = player.blockPosition().getY();
|
||||
int originZ = player.blockPosition().getZ();
|
||||
StructureAssembler assembler = StructureAssemblies.forData(
|
||||
data, structure, new IrisPosition(originX, originY, originZ));
|
||||
RNG rng = new RNG((long) originX * 341873128712L + originZ);
|
||||
StructureAssemblyResult assembly = assembler.assemble(rng);
|
||||
List<PlacedStructurePiece> pieces = assembly.pieces();
|
||||
if (!assembly.hasOutput()) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_STRUCTURE_ASSEMBLED_0_PIECES, MessageArgument.untrusted("key", key)));
|
||||
return 0;
|
||||
}
|
||||
ModdedObjectPlacer placer = new ModdedObjectPlacer(level, engine);
|
||||
UUID owner = player.getUUID();
|
||||
try {
|
||||
for (PlacedStructurePiece piece : pieces) {
|
||||
ObjectPlacement config = ObjectPlacement.builder()
|
||||
.mode(ObjectPlaceMode.STRUCTURE_PIECE)
|
||||
.rotation(StructurePlacing.moduleRotation(piece.getRotation()))
|
||||
.place(List.of(piece.getObject().getLoadKey()))
|
||||
.edit(structure.getEdit())
|
||||
.build();
|
||||
ModuleObjectPlacement.place(piece.getObject(), piece.getX(), piece.getY(), piece.getZ(), placer, config, rng, null, null, data);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
ModdedIrisLog.error("Iris structure place failed for {}", key, e);
|
||||
ModdedObjectUndo.record(owner, level, placer.undoSnapshot());
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_PLACE_FAILED_PARTIAL_CHANGES_RECORDED_UNDO, MessageArgument.untrusted("value", e.getClass().getSimpleName())));
|
||||
return 0;
|
||||
}
|
||||
ModdedObjectUndo.record(owner, level, placer.undoSnapshot());
|
||||
String tileNote = ModdedObjectCommands.tileNote(placer);
|
||||
IrisModdedCommands.ok(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_PLACED_PIECES_WRITE_S_AT_YOUR_LOCATION_IRIS_OBJECT_UNDO, MessageArgument.untrusted("key", key), MessageArgument.untrusted("value", pieces.size()), MessageArgument.untrusted("value2", placer.writes()), MessageArgument.untrusted("tileNote", tileNote)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static CompletableFuture<Suggestions> suggestIrisStructureKeys(CommandContext<CommandSourceStack> context, SuggestionsBuilder builder) {
|
||||
ModdedCommandFeedback.tab(context.getSource());
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user