PrefabEditUpdateBoxCommand class
Пакет: com.hypixel.hytale.builtin.buildertools.prefabeditor.commands
Файл: com/hypixel/hytale/builtin/buildertools/prefabeditor/commands/PrefabEditUpdateBoxCommand.java
extends: AbstractPlayerCommand
Поля (15)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
PrefabEditingMetadata |
var10 |
|
boolean |
var11 |
|
|
var11 |
|
BlockSelection |
var12 |
|
boolean |
var13 |
|
Vector3i |
var3 |
|
Vector3i |
var4 |
|
Player |
var6 |
|
UUID |
var7 |
|
BlockSelection |
var7 |
|
PrefabEditSessionManager |
var8 |
|
Vector3i |
var8 |
|
PrefabEditSession |
var9 |
|
Vector3i |
var9 |
Методы (6)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var9 == null) |
|
|
if if(var10 == null) |
|
|
if if(var7 == null) |
|
|
if if(var13) |
public |
boolean |
isLocationWithinSelectionboolean isLocationWithinSelection(@Nonnull Vector3i var1, @Nonnull BlockSelection var2) |
abstract |
|
super super("setBox", "server.commands.editprefab.setbox.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.buildertools.prefabeditor.commands;
class="kw">import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
class="kw">import com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditSession;
class="kw">import com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditSessionManager;
class="kw">import com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditingMetadata;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.prefab.selection.standard.BlockSelection;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3i;
class="kw">public class PrefabEditUpdateBoxCommand class="kw">extends AbstractPlayerCommand {
@Nonnull
class="kw">private class="kw">final FlagArg confirmAnchorDeletionArg = this.withFlagArg("confirm", "server.commands.editprefab.setbox.confirm.desc");
class="kw">public PrefabEditUpdateBoxCommand() {
super("setBox", "server.commands.editprefab.setbox.desc");
}
@Override
class="kw">protected void execute(
@Nonnull CommandContext var1, @Nonnull Store<EntityStore> var2, @Nonnull Ref<EntityStore> var3, @Nonnull PlayerRef var4, @Nonnull World var5
) {
Player var6 = var2.getComponent(var3, Player.getComponentType());
assert var6 != null;
UUID var7 = var4.getUuid();
PrefabEditSessionManager var8 = BuilderToolsPlugin.get().getPrefabEditSessionManager();
PrefabEditSession var9 = var8.getPrefabEditSession(var7);
if (var9 == null) {
var1.sendMessage(Message.translation("server.commands.editprefab.notInEditSession"));
} else {
PrefabEditingMetadata var10 = var9.getSelectedPrefab(var7);
if (var10 == null) {
var1.sendMessage(Message.translation("server.commands.editprefab.noPrefabSelected"));
} else {
boolean var11 = false;
BlockSelection var12 = BuilderToolsPlugin.getState(var6, var4).getSelection();
if (var12 != null && !this.isLocationWithinSelection(var10.getAnchorEntityPosition(), var12)) {
if (!this.confirmAnchorDeletionArg.get(var1)) {
var1.sendMessage(Message.translation("server.commands.editprefab.setbox.anchorOutsideNewSelection"));
class="kw">return;
}
var11 = true;
var10.setAnchorPoint(var12.getSelectionMin(), var5);
var10.sendAnchorHighlightingPacket(var4.getPacketHandler());
}
boolean var13 = var11;
BuilderToolsPlugin.addToQueue(var6, var4, (var4x, var5x, var6x) -> {
BlockSelection var7 = var5x.getSelection();
if (var7 == null) {
var1.sendMessage(Message.translation("server.commands.editprefab.noSelection"));
} else {
Vector3i var8 = var7.getSelectionMin();
Vector3i var9 = var7.getSelectionMax();
var9.updatePrefabBounds(var10.getUuid(), var8, var9);
var1.sendMessage(Message.translation("server.commands.editprefab.setbox.success"));
if (var13) {
var1.sendMessage(Message.translation("server.commands.editprefab.setbox.success.movedAnchor"));
}
}
});
}
}
}
class="kw">public boolean isLocationWithinSelection(@Nonnull Vector3i var1, @Nonnull BlockSelection var2) {
Vector3i var3 = var2.getSelectionMin();
Vector3i var4 = var2.getSelectionMax();
class="kw">return var1.x >= var3.x && var1.x <= var4.x && var1.y >= var3.y && var1.y <= var4.y && var1.z >= var3.z && var1.z <= var4.z;
}
}