Go Back!
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ public abstract class InstructionBoundBlock extends Block implements EntityBlock
|
||||
|
||||
world.getBlockEntity(pos, getBlockEntityType()).ifPresent(be -> {
|
||||
String name = MinionPersistentState.get(world.getServer()).getMinionData(be.getMinionUuid()).name();
|
||||
player.sendSystemMessage(Component.translatable("minions.reference.instruction.tooltip", name, be.getInstructionName()));
|
||||
player.sendSystemMessage(Component.translatable("minions.reference.instruction.tooltip", be.getInstructionName(), name));
|
||||
});
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@ public abstract class InstructionBoundBlockEntity<L extends BlockEntityMinionLis
|
||||
public void removeListener() {
|
||||
if(level instanceof ServerLevel serverWorld) {
|
||||
L listener = getListener();
|
||||
listener.remove(serverWorld.getServer());
|
||||
if(listener != null) {
|
||||
listener.remove(serverWorld.getServer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package io.github.skippyall.minions.gui;
|
||||
import com.mojang.serialization.Codec;
|
||||
import io.github.skippyall.minions.registration.MinionRegistries;
|
||||
import io.github.skippyall.minions.util.TranslationUtil;
|
||||
import it.unimi.dsi.fastutil.objects.ReferenceSortedSets;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.UUIDUtil;
|
||||
import net.minecraft.core.component.DataComponentPatch;
|
||||
import net.minecraft.core.component.DataComponentType;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -21,11 +21,23 @@ import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.component.ResolvableProfile;
|
||||
import net.minecraft.world.item.component.TooltipDisplay;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface GuiDisplay {
|
||||
Codec<GuiDisplay> CODEC = MinionRegistries.GUI_DISPLAY_TYPE.byNameCodec().dispatch(GuiDisplay::getCodec, codec -> codec.fieldOf("data"));
|
||||
GuiDisplay DEFAULT_DISPLAY = new ItemBased(Items.BARRIER);
|
||||
TooltipDisplay TOOLTIP_DISPLAY = createTooltipDisplay();
|
||||
|
||||
private static TooltipDisplay createTooltipDisplay() {
|
||||
LinkedHashSet<DataComponentType<?>> set = new LinkedHashSet<>();
|
||||
for(DataComponentType<?> type : BuiltInRegistries.DATA_COMPONENT_TYPE) {
|
||||
if(type != DataComponents.LORE) {
|
||||
set.add(type);
|
||||
}
|
||||
}
|
||||
return new TooltipDisplay(false, set);
|
||||
}
|
||||
|
||||
static GuiDisplay getGuiDisplay(Identifier id, RegistryAccess manager) {
|
||||
return manager.lookup(MinionRegistries.GUI_DISPLAY).map(registry -> registry.getValue(id)).orElse(DEFAULT_DISPLAY);
|
||||
@@ -94,7 +106,7 @@ public interface GuiDisplay {
|
||||
@Override
|
||||
public ItemStackTemplate createItemStackTemplate() {
|
||||
return new ItemStackTemplate(item, DataComponentPatch.builder()
|
||||
.set(DataComponents.TOOLTIP_DISPLAY, new TooltipDisplay(true, ReferenceSortedSets.emptySet()))
|
||||
.set(DataComponents.TOOLTIP_DISPLAY, TOOLTIP_DISPLAY)
|
||||
.set(DataComponents.RARITY, Rarity.COMMON)
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package io.github.skippyall.minions.gui;
|
||||
|
||||
import eu.pb4.sgui.api.elements.GuiElementBuilder;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class MinionsGui {
|
||||
@@ -44,26 +47,29 @@ public abstract class MinionsGui {
|
||||
|
||||
public void close(boolean alreadyClosed) {
|
||||
if(open) {
|
||||
if(parent != null) {
|
||||
parent.child = null;
|
||||
//parent.reopen();
|
||||
open = false;
|
||||
if(child != null) {
|
||||
child.close(alreadyClosed);
|
||||
} else if(!alreadyClosed) {
|
||||
closeBacking();
|
||||
}
|
||||
closeNoOpen(alreadyClosed);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeNoOpen(boolean closeBacking) {
|
||||
open = false;
|
||||
boolean hasChild = child != null;
|
||||
if(hasChild) {
|
||||
child.closeNoOpen(closeBacking);
|
||||
}
|
||||
public void goBack() {
|
||||
if(parent != null) {
|
||||
open = false;
|
||||
parent.child = null;
|
||||
parent.reopen();
|
||||
} else {
|
||||
close(false);
|
||||
}
|
||||
if(closeBacking && !hasChild) {
|
||||
closeBacking();
|
||||
}
|
||||
}
|
||||
|
||||
public GuiElementBuilder backButton() {
|
||||
return new GuiElementBuilder(Items.MANGROVE_DOOR)
|
||||
.setName(Component.translatable("gui.back"))
|
||||
.setCallback(this::goBack);
|
||||
}
|
||||
|
||||
protected abstract void closeBacking();
|
||||
|
||||
@@ -27,13 +27,15 @@ public class PaginatedList extends MinionsGui {
|
||||
|
||||
@Override
|
||||
protected void open() {
|
||||
gui = new SimpleGui(MenuType.GENERIC_9x4, viewer, false) {
|
||||
gui = new SimpleGui(MenuType.GENERIC_9x6, viewer, false) {
|
||||
@Override
|
||||
public void onPlayerClose(boolean success) {
|
||||
onBackingClosed();
|
||||
}
|
||||
};
|
||||
gui.setTitle(title);
|
||||
|
||||
gui.setSlot(8, backButton());
|
||||
addItems();
|
||||
gui.open();
|
||||
}
|
||||
@@ -52,12 +54,14 @@ public class PaginatedList extends MinionsGui {
|
||||
}
|
||||
|
||||
private void addItems() {
|
||||
for(int i = 27 * page; i < Math.min(27 * (page + 1), size); i++) {
|
||||
gui.addSlot(display.apply(i, this));
|
||||
int slot = 9;
|
||||
for(int i = 36 * page; i < Math.min(36 * (page + 1), size); i++) {
|
||||
gui.setSlot(slot, display.apply(i, this));
|
||||
slot++;
|
||||
}
|
||||
|
||||
if(page > 0) {
|
||||
gui.setSlot(30, new GuiElementBuilder(Items.SPECTRAL_ARROW)
|
||||
gui.setSlot(48, new GuiElementBuilder(Items.SPECTRAL_ARROW)
|
||||
.setItemName(Component.translatable("book.page_button.previous"))
|
||||
.setCallback(() -> {
|
||||
page--;
|
||||
@@ -65,11 +69,11 @@ public class PaginatedList extends MinionsGui {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
gui.clearSlot(30);
|
||||
gui.clearSlot(48);
|
||||
}
|
||||
|
||||
if(27 * (page + 1) < size) {
|
||||
gui.setSlot(32, new GuiElementBuilder(Items.ARROW)
|
||||
gui.setSlot(50, new GuiElementBuilder(Items.ARROW)
|
||||
.setItemName(Component.translatable("book.page_button.next"))
|
||||
.setCallback(() -> {
|
||||
page++;
|
||||
@@ -77,7 +81,7 @@ public class PaginatedList extends MinionsGui {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
gui.clearSlot(32);
|
||||
gui.clearSlot(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,14 +74,14 @@ public class ChoiceInput {
|
||||
return future;
|
||||
}
|
||||
|
||||
public static CompletableFuture<Void> confirm(MinionsGui parent, Component title) {
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
public static CompletableFuture<Boolean> confirm(MinionsGui parent, Component title) {
|
||||
CompletableFuture<Boolean> future = new CompletableFuture<>();
|
||||
|
||||
new SimpleMinionsGui(parent, (onClose, me) -> {
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_3x3, parent.getViewer(), false) {
|
||||
@Override
|
||||
public void onPlayerClose(boolean success) {
|
||||
future.cancel(false);
|
||||
future.complete(false);
|
||||
onClose.run();
|
||||
}
|
||||
};
|
||||
@@ -90,12 +90,18 @@ public class ChoiceInput {
|
||||
|
||||
gui.setSlot(3, new GuiElementBuilder(Items.REDSTONE_BLOCK)
|
||||
.setName(Component.translatable("minions.gui.abort"))
|
||||
.setCallback(() -> future.cancel(false))
|
||||
.setCallback(() -> {
|
||||
future.complete(false);
|
||||
me.goBack();
|
||||
})
|
||||
);
|
||||
|
||||
gui.setSlot(5, new GuiElementBuilder(Items.EMERALD_BLOCK)
|
||||
.setName(Component.translatable("minions.gui.confirm"))
|
||||
.setCallback(() -> future.complete(null))
|
||||
.setCallback(() -> {
|
||||
future.complete(true);
|
||||
me.goBack();
|
||||
})
|
||||
);
|
||||
|
||||
gui.open();
|
||||
|
||||
@@ -53,9 +53,12 @@ public class TextInput<T> extends AnvilInputGui {
|
||||
CompletableFuture<T> future = new CompletableFuture<>();
|
||||
new SimpleMinionsGui(gui, (onClose, me) -> {
|
||||
TextInput<T> input = new TextInput<>(gui.getViewer(), title, defaultValue, parser, future);
|
||||
future.handle((v, e) -> {
|
||||
onClose.run();
|
||||
return null;
|
||||
future.whenComplete((v, e) -> {
|
||||
if(e != null) {
|
||||
onClose.run();
|
||||
} else {
|
||||
me.goBack();
|
||||
}
|
||||
});
|
||||
input.open();
|
||||
return input;
|
||||
@@ -115,7 +118,6 @@ public class TextInput<T> extends AnvilInputGui {
|
||||
if(result != null) {
|
||||
result.ifSuccess(success -> {
|
||||
isConfirm = true;
|
||||
close();
|
||||
future.complete(success);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ArgumentGui extends MinionsGui {
|
||||
private final GuiContext.ValueSupplier context;
|
||||
private final MinionFakePlayer minion;
|
||||
private final ConfiguredInstruction<MinionRuntime> instruction;
|
||||
private final Parameter<?> parameter;
|
||||
|
||||
@@ -34,7 +33,6 @@ public class ArgumentGui extends MinionsGui {
|
||||
|
||||
public ArgumentGui(MinionsGui parent, GuiContext.ValueSupplier context) {
|
||||
super(parent);
|
||||
minion = context.getMinion();
|
||||
instruction = context.getInstruction();
|
||||
this.parameter = context.getParameter();
|
||||
this.context = context;
|
||||
@@ -71,6 +69,8 @@ public class ArgumentGui extends MinionsGui {
|
||||
Component.translatable(TranslationUtil.getTranslationKey(parameter.type(), MinionRegistries.VALUE_TYPES))
|
||||
));
|
||||
|
||||
gui.setSlot(2, backButton());
|
||||
|
||||
updateTypeConfiguration();
|
||||
updateArgumentConfiguration();
|
||||
updateConverterConfiguration();
|
||||
@@ -102,12 +102,7 @@ public class ArgumentGui extends MinionsGui {
|
||||
.setName(Component.translatable("minions.gui.instruction.argument.configure.data"))
|
||||
.addLoreLine(getArgument() != null ? getArgument().getDisplayText() : Component.translatable("minions.gui.not_set"))
|
||||
.setCallback(() -> argumentType.openConfiguration(this, parameter.type(), getArgument())
|
||||
.thenAccept(newArgument -> {
|
||||
setArgument(newArgument);
|
||||
if(child != null) {
|
||||
child.close();
|
||||
}
|
||||
})
|
||||
.thenAccept(this::setArgument)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -149,7 +144,7 @@ public class ArgumentGui extends MinionsGui {
|
||||
new GuiElementBuilder(GuiDisplay.getDisplayStackWithName(MinionRegistries.VALUE_SUPPLIER_TYPES, type, viewer.registryAccess()))
|
||||
.setCallback(() -> {
|
||||
setArgumentType(type);
|
||||
me.close();
|
||||
me.goBack();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
+9
-5
@@ -50,7 +50,7 @@ public class ConfigureInstructionGui extends MinionsGui implements ConfiguredIns
|
||||
|
||||
gui.setTitle(Component.literal(name));
|
||||
|
||||
gui.setSlot(7, new GuiElementBuilder(Items.ANVIL)
|
||||
gui.setSlot(6, new GuiElementBuilder(Items.ANVIL)
|
||||
.setName(Component.translatable("minions.gui.instruction.configure.rename"))
|
||||
.setCallback(() -> InstructionGui.inputInstructionName(this, context, name).thenAccept(newName -> {
|
||||
minion.getInstructionManager().setInstructionName(name, newName);
|
||||
@@ -58,15 +58,19 @@ public class ConfigureInstructionGui extends MinionsGui implements ConfiguredIns
|
||||
}))
|
||||
);
|
||||
|
||||
gui.setSlot(8, new GuiElementBuilder(Items.LAVA_BUCKET)
|
||||
gui.setSlot(7, new GuiElementBuilder(Items.LAVA_BUCKET)
|
||||
.setName(Component.translatable("minions.gui.instruction.configure.delete"))
|
||||
.setCallback(() -> ChoiceInput.confirm(this, Component.translatable("minions.gui.instruction.configure.delete.confirm", name))
|
||||
.thenAccept(v -> {
|
||||
minion.getInstructionManager().removeInstruction(name);
|
||||
close();
|
||||
.thenAccept((confirmed) -> {
|
||||
if(confirmed) {
|
||||
minion.getInstructionManager().removeInstruction(name);
|
||||
goBack();
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
gui.setSlot(8, backButton());
|
||||
|
||||
updateSuppliers();
|
||||
|
||||
gui.setSlot(13, InstructionGui.createInstructionElement(instruction.getInstruction(), viewer.registryAccess()));
|
||||
|
||||
@@ -53,6 +53,7 @@ public class ConverterGui extends MinionsGui {
|
||||
|
||||
updateTypeDisplay();
|
||||
updateConverterDisplay();
|
||||
gui.setSlot(8, backButton());
|
||||
|
||||
gui.open();
|
||||
}
|
||||
@@ -101,7 +102,7 @@ public class ConverterGui extends MinionsGui {
|
||||
GuiDisplay.getDisplayStackWithName(MinionRegistries.VALUE_CONVERTER_TYPES, type, viewer.registryAccess())
|
||||
).setCallback(() -> {
|
||||
setType(type);
|
||||
me.close();
|
||||
me.goBack();
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -109,12 +110,7 @@ public class ConverterGui extends MinionsGui {
|
||||
private void configureData() {
|
||||
if(valueConverterType != null) {
|
||||
valueConverterType.configure(this, from, to, converter)
|
||||
.thenAccept(newConverter -> {
|
||||
setConverter(newConverter);
|
||||
if(child != null) {
|
||||
child.close();
|
||||
}
|
||||
});
|
||||
.thenAccept(this::setConverter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ public class ConverterListGui extends MinionsGui {
|
||||
})
|
||||
);
|
||||
|
||||
gui.setSlot(8, backButton());
|
||||
|
||||
gui.open();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class InstructionGui {
|
||||
public static MinionsGui openInstructionMainMenu(MinionsGui parent, GuiContext.Minion context) {
|
||||
return new SimpleMinionsGui(parent, (onClose, me) -> {
|
||||
public static void openInstructionMainMenu(MinionsGui parent, GuiContext.Minion context) {
|
||||
new SimpleMinionsGui(parent, (onClose, me) -> {
|
||||
ServerPlayer player = parent.getViewer();
|
||||
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_3x3, player, false) {
|
||||
@@ -42,6 +42,7 @@ public class InstructionGui {
|
||||
};
|
||||
gui.setTitle(Component.translatable("minions.gui.instruction.title"));
|
||||
|
||||
gui.setSlot(2, me.backButton());
|
||||
gui.setSlot(3, new GuiElementBuilder()
|
||||
.setItem(Items.BOOK)
|
||||
.setName(Component.translatable("minions.gui.instruction.list"))
|
||||
@@ -101,7 +102,7 @@ public class InstructionGui {
|
||||
CompletableFuture<InstructionType<MinionRuntime>> future = new CompletableFuture<>();
|
||||
|
||||
new SimpleMinionsGui(parent, (closeHandler, me) -> {
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_9x3, viewer, false) {
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_9x4, viewer, false) {
|
||||
@Override
|
||||
public void onPlayerClose(boolean success) {
|
||||
if (!future.isDone()) {
|
||||
@@ -112,11 +113,13 @@ public class InstructionGui {
|
||||
};
|
||||
gui.setTitle(Component.translatable("minions.gui.instruction.select_instruction"));
|
||||
|
||||
gui.setSlot(8, me.backButton());
|
||||
|
||||
for (int i = 0; i < minion.getModuleInventory().getContainerSize(); i++) {
|
||||
ItemStack moduleItem = minion.getModuleInventory().getItem(i);
|
||||
MinionModule module = moduleItem.get(MinionComponentTypes.MODULE);
|
||||
if (module != null && !module.instructions().isEmpty()) {
|
||||
gui.addSlot(new GuiElementBuilder(moduleItem)
|
||||
gui.setSlot(i + 9, new GuiElementBuilder(moduleItem)
|
||||
.setCallback(() -> selectInstructionMenu(parent, context, module)
|
||||
.thenApply(future::complete)
|
||||
)
|
||||
@@ -134,7 +137,7 @@ public class InstructionGui {
|
||||
CompletableFuture<InstructionType<MinionRuntime>> future = new CompletableFuture<>();
|
||||
|
||||
new SimpleMinionsGui(parent, (closeHandler, me) -> {
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_9x3, parent.getViewer(), false) {
|
||||
SimpleGui gui = new SimpleGui(MenuType.GENERIC_9x4, parent.getViewer(), false) {
|
||||
@Override
|
||||
public void onPlayerClose(boolean success) {
|
||||
if (!future.isDone()) {
|
||||
@@ -145,10 +148,13 @@ public class InstructionGui {
|
||||
};
|
||||
gui.setTitle(Component.translatable("minions.gui.instruction.select_instruction"));
|
||||
|
||||
gui.setSlot(8, me.backButton());
|
||||
int slot = 9;
|
||||
for (InstructionType<MinionRuntime> instructionType : module.instructions()) {
|
||||
gui.addSlot(createInstructionElement(instructionType, parent.getViewer().registryAccess())
|
||||
gui.setSlot(slot, createInstructionElement(instructionType, parent.getViewer().registryAccess())
|
||||
.setCallback(() -> future.complete(instructionType))
|
||||
);
|
||||
slot++;
|
||||
}
|
||||
|
||||
gui.open();
|
||||
|
||||
@@ -33,13 +33,15 @@ public class InstructionListGui extends MinionsGui implements MinionListener {
|
||||
@Override
|
||||
protected void open() {
|
||||
minion.addMinionListener(this);
|
||||
gui = new SimpleGui(MenuType.GENERIC_9x3, viewer, false) {
|
||||
gui = new SimpleGui(MenuType.GENERIC_9x4, viewer, false) {
|
||||
@Override
|
||||
public void onPlayerClose(boolean success) {
|
||||
onBackingClosed();
|
||||
}
|
||||
};
|
||||
gui.setTitle(Component.translatable("minions.gui.instruction.title"));
|
||||
|
||||
gui.setSlot(8, backButton());
|
||||
resetInstructionList();
|
||||
gui.open();
|
||||
}
|
||||
@@ -51,7 +53,7 @@ public class InstructionListGui extends MinionsGui implements MinionListener {
|
||||
}
|
||||
|
||||
private void resetInstructionList() {
|
||||
int i = 0;
|
||||
int i = 9;
|
||||
for (String instructionName : minion.getInstructionManager().getInstructionNames()) {
|
||||
ConfiguredInstruction<MinionRuntime> instruction = minion.getInstructionManager().getInstruction(instructionName);
|
||||
gui.setSlot(i, new GuiElementBuilder(GuiDisplay.getGuiDisplayFor(MinionRegistries.INSTRUCTION_TYPES, instruction.getInstruction(), viewer.registryAccess()).createItemStack())
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GuiContextImpl implements GuiContext {
|
||||
private final MinionFakePlayer minion;
|
||||
|
||||
public MinionImpl(GuiContext context, MinionFakePlayer minion) {
|
||||
super(context);
|
||||
super(context instanceof DelegatingGuiContextImpl<?> impl ? impl.context : context);
|
||||
this.minion = minion;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GuiContextImpl implements GuiContext {
|
||||
private String name;
|
||||
|
||||
public InstructionImpl(GuiContext.Minion context, ConfiguredInstruction<MinionRuntime> instruction, String name) {
|
||||
super(context);
|
||||
super(context instanceof DelegatingMinionImpl<?> impl ? impl.context : context);
|
||||
this.instruction = instruction;
|
||||
this.name = name;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class GuiContextImpl implements GuiContext {
|
||||
private final Parameter<?> parameter;
|
||||
|
||||
public ValueSupplierImpl(GuiContext.Instruction context, Parameter<?> parameter) {
|
||||
super(context);
|
||||
super(context instanceof DelegatingInstructionImpl<?> impl ? impl.context : context);
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public class MinionInventoryGui extends MinionsGui {
|
||||
gui.setSlot(5, new ItemStack(Items.LEATHER_BOOTS));
|
||||
gui.setSlot(6, new ItemStack(Items.SHIELD));
|
||||
|
||||
gui.setSlot(8, backButton());
|
||||
|
||||
gui.setSlot(2 + 9, new ArmorSlot(minion.getInventory(), minion, EquipmentSlot.HEAD, EquipmentSlot.HEAD.getIndex(Inventory.INVENTORY_SIZE), 0, 0, null));
|
||||
gui.setSlot(3 + 9, new ArmorSlot(minion.getInventory(), minion, EquipmentSlot.CHEST, EquipmentSlot.CHEST.getIndex(Inventory.INVENTORY_SIZE), 0, 0, null));
|
||||
gui.setSlot(4 + 9, new ArmorSlot(minion.getInventory(), minion, EquipmentSlot.LEGS, EquipmentSlot.LEGS.getIndex(Inventory.INVENTORY_SIZE), 0, 0, null));
|
||||
|
||||
+2
@@ -87,11 +87,13 @@ public class AnalogInputSupplier implements ValueSupplier<Long, MinionRuntime> {
|
||||
};
|
||||
gui.setTitle(Component.translatable("value_supplier.minions.analog_input"));
|
||||
|
||||
gui.setSlot(2, me.backButton());
|
||||
gui.setSlot(4, new GuiElementBuilder(MinionItems.REFERENCE_ITEM)
|
||||
.setCallback(() -> {
|
||||
ItemStack cursor = parent.getViewer().containerMenu.getCarried();
|
||||
if (cursor.is(MinionItems.REFERENCE_ITEM) && cursor.get(MinionComponentTypes.REFERENCE) instanceof BlockPosClipboard pos) {
|
||||
future.complete(new AnalogInputSupplier(pos.world(), pos.pos()));
|
||||
me.goBack();
|
||||
}
|
||||
})
|
||||
.setItemName(Component.translatable("value_supplier.minions.analog_input.config.click_with_reference"))
|
||||
|
||||
Reference in New Issue
Block a user