use of eu.pb4.sgui.api.gui.SimpleGui in project ArmorStandEditor by Patbox.
the class EditorGuis method setIcons.
private static void setIcons(ServerPlayerEntity player, SimpleGui gui) {
createIcon(player, gui, 0, Items.RED_WOOL, "x", 0);
createIcon(player, gui, 1, Items.GREEN_WOOL, "y", 1);
createIcon(player, gui, 2, Items.BLUE_WOOL, "z", 2);
createIconCustomPower(player, gui, 5, Items.GOLD_INGOT);
createIcon(player, gui, 6, Items.IRON_NUGGET, "small", 0.01f);
createIcon(player, gui, 7, Items.IRON_INGOT, "medium", 0.1f);
createIcon(player, gui, 8, Items.IRON_BLOCK, "big", 1f);
createIcon(player, gui, 9, Items.MINECART, "move", EditorActions.MOVE);
createIcon(player, gui, 10, Items.COMPASS, "rotate", EditorActions.ROTATE);
createIcon(player, gui, 24, Items.PUFFERFISH, "size", EditorActions.TOGGLE_SIZE);
createIcon(player, gui, 25, Items.APPLE, "gravity", EditorActions.TOGGLE_GRAVITY);
createIcon(player, gui, 26, Items.GLASS, "visibility", EditorActions.TOGGLE_VISIBILITY);
createIcon(player, gui, 34, Items.STICK, "arms", EditorActions.TOGGLE_ARMS);
createIcon(player, gui, 35, Items.STONE_SLAB, "base", EditorActions.TOGGLE_BASE);
createIcon(player, gui, 19, Items.LEATHER_HELMET, "head", EditorActions.MODIFY_HEAD);
createIcon(player, gui, 27, Items.STICK, "left_arm", EditorActions.MODIFY_LEFT_ARM);
createIcon(player, gui, 28, Items.LEATHER_CHESTPLATE, "body", EditorActions.MODIFY_BODY);
createIcon(player, gui, 29, Items.STICK, "right_arm", EditorActions.MODIFY_RIGHT_ARM);
createIcon(player, gui, 21, Items.GLISTERING_MELON_SLICE, "flip_pose", EditorActions.FLIP_POSE);
createIcon(player, gui, 30, Items.LEVER, "reset_pose", EditorActions.RESET_POSE);
createIcon(player, gui, 36, Items.LEATHER_BOOTS, "left_leg", EditorActions.MODIFY_LEFT_LEG);
createIcon(player, gui, 37, Items.CHEST, "inventory", EditorActions.INVENTORY);
createIcon(player, gui, 38, Items.LEATHER_BOOTS, "right_leg", EditorActions.MODIFY_RIGHT_LEG);
createIcon(player, gui, 39, Items.NAME_TAG, "rename", EditorActions.RENAME);
createIcon(player, gui, 43, Items.SLIME_BALL, "copy", EditorActions.COPY);
createIcon(player, gui, 44, Items.MAGMA_CREAM, "paste", EditorActions.PASTE);
gui.setSlot(42, new GuiElementBuilder(Items.MOJANG_BANNER_PATTERN).setName(new TranslatableText("armorstandeditor.gui.name.presets").setStyle(Style.EMPTY.withItalic(false))).setCallback((x, y, z) -> openPresetSelector(player)));
}
use of eu.pb4.sgui.api.gui.SimpleGui in project ArmorStandEditor by Patbox.
the class EditorGuis method createIcon.
private static void createIcon(ServerPlayerEntity player, SimpleGui gui, int index, Item item, String text, int xyz) {
ItemStack itemStack = item.getDefaultStack();
itemStack.setCustomName(new TranslatableText("armorstandeditor.gui.name." + text).setStyle(Style.EMPTY.withItalic(false)));
itemStack.addHideFlag(ItemStack.TooltipSection.ENCHANTMENTS);
itemStack.addHideFlag(ItemStack.TooltipSection.MODIFIERS);
if (((SPEInterface) player).getArmorStandEditorXYZ() == xyz) {
itemStack.addEnchantment(Enchantments.POWER, 1);
}
gui.setSlot(index, itemStack, (index2, type, actionType) -> {
((SPEInterface) player).setArmorStandEditorXYZ(xyz);
});
}
use of eu.pb4.sgui.api.gui.SimpleGui in project ArmorStandEditor by Patbox.
the class EditorGuis method openGui.
public static void openGui(ServerPlayerEntity player) {
SimpleGui gui = new SimpleGui(ScreenHandlerType.GENERIC_9X5, player, false) {
@Override
public boolean onClick(int index, ClickType type, SlotActionType action, GuiElementInterface element) {
setIcons(player, this);
return super.onClick(index, type, action, element);
}
};
gui.setTitle(new TranslatableText("armorstandeditor.gui.editor_title"));
setIcons(player, gui);
gui.open();
}
use of eu.pb4.sgui.api.gui.SimpleGui in project ArmorStandEditor by Patbox.
the class EditorGuis method createIcon.
private static void createIcon(ServerPlayerEntity player, SimpleGui gui, int index, Item item, String text, float power) {
ItemStack itemStack = item.getDefaultStack();
itemStack.setCustomName(new TranslatableText("armorstandeditor.gui.name." + text).setStyle(Style.EMPTY.withItalic(false)));
ListTag lore = new ListTag();
lore.add(StringTag.of(Text.Serializer.toJson(new TranslatableText("armorstandeditor.gui.blocksdeg", (Math.round(power * 100) / 100f), Math.floor(power * 3000) / 100).setStyle(Style.EMPTY.withItalic(false).withColor(Formatting.GRAY)))));
itemStack.getOrCreateTag().getCompound("display").put("Lore", lore);
itemStack.addHideFlag(ItemStack.TooltipSection.ENCHANTMENTS);
itemStack.addHideFlag(ItemStack.TooltipSection.MODIFIERS);
if (((SPEInterface) player).getArmorStandEditorPower() == power) {
itemStack.addEnchantment(Enchantments.POWER, 1);
}
gui.setSlot(index, itemStack, (index2, type, actionType) -> {
((SPEInterface) player).setArmorStandEditorPower(power);
});
}
Aggregations