diff --git a/common/src/main/java/com/mrbysco/armorposer/Reference.java b/common/src/main/java/com/mrbysco/armorposer/Reference.java index ac6086d..482439b 100644 --- a/common/src/main/java/com/mrbysco/armorposer/Reference.java +++ b/common/src/main/java/com/mrbysco/armorposer/Reference.java @@ -63,5 +63,10 @@ public static void savePose(String poseName, CompoundTag tag) { public static void removePose(String poseName) { userPoses.removeIf(pose -> pose.name().equalsIgnoreCase(poseName)); + UserPoseHandler.saveUserPoses(); } + + public static final String alignedBlockPose = "{CustomNameVisible:0b,DisabledSlots:0,Invisible:0b,Invulnerable:0b,Move:[0.0d,0.0d,0.0d],NoBasePlate:0b,NoGravity:1b,Pose:{Body:[0.0f,0.0f,0.0f],Head:[0.0f,0.0f,0.0f],LeftArm:[0.0f,0.0f,0.0f],LeftLeg:[0.0f,0.0f,0.0f],RightArm:[-15.0f,135.0f,0.0f],RightLeg:[0.0f,0.0f,0.0f]},Rotation:[0.0f],ShowArms:1b,Small:0b}"; + public static final String alignedUprightItemPose = "{CustomNameVisible:0b,DisabledSlots:0,Invisible:1b,Invulnerable:0b,Move:[0.0d,0.0d,0.0d],NoBasePlate:0b,NoGravity:1b,Pose:{Body:[0.0f,0.0f,0.0f],Head:[0.0f,0.0f,0.0f],LeftArm:[0.0f,0.0f,0.0f],LeftLeg:[0.0f,0.0f,0.0f],RightArm:[-90.0f,0.0f,0.0f],RightLeg:[0.0f,0.0f,0.0f]},Rotation:[0.0f],ShowArms:1b,Small:0b}"; + public static final String flatItemPose = "{CustomNameVisible:0b,DisabledSlots:0,Invisible:1b,Invulnerable:0b,Move:[0.0d,0.0d,0.0d],NoBasePlate:0b,NoGravity:1b,Pose:{Body:[0.0f,0.0f,0.0f],Head:[0.0f,0.0f,0.0f],LeftArm:[0.0f,0.0f,0.0f],LeftLeg:[0.0f,0.0f,0.0f],RightArm:[0.0f,0.0f,0.0f],RightLeg:[0.0f,0.0f,0.0f]},Rotation:[0.0f],ShowArms:1b,Small:0b}"; } \ No newline at end of file diff --git a/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorPosesScreen.java b/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorPosesScreen.java index baa1aea..3991df6 100644 --- a/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorPosesScreen.java +++ b/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorPosesScreen.java @@ -12,6 +12,7 @@ import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; +import org.lwjgl.glfw.GLFW; import java.util.Collections; import java.util.List; @@ -100,6 +101,7 @@ protected void init() { } else { this.parentScreen.readFieldsFromNBT(selected.getTag()); } + this.parentScreen.textFieldUpdated(); this.parentScreen.updateEntity(selected.getTag()); } this.onClose(); @@ -217,6 +219,16 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia this.search.render(guiGraphics, mouseX, mouseY, partialTicks); } + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { + if (keyCode == GLFW.GLFW_KEY_DELETE) { + if(selected != null && selected.userAdded()) { + this.minecraft.setScreen(new DeletePoseScreen(this.parentScreen, selected)); + } + } + return super.keyPressed(keyCode, scanCode, modifiers); + } + @Override public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { //Nope diff --git a/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorStandScreen.java b/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorStandScreen.java index 325f9e8..00eabe0 100644 --- a/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorStandScreen.java +++ b/common/src/main/java/com/mrbysco/armorposer/client/gui/ArmorStandScreen.java @@ -1,5 +1,8 @@ package com.mrbysco.armorposer.client.gui; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.math.Axis; import com.mrbysco.armorposer.Reference; import com.mrbysco.armorposer.client.gui.widgets.NumberFieldBox; import com.mrbysco.armorposer.client.gui.widgets.ToggleButton; @@ -43,6 +46,15 @@ public class ArmorStandScreen extends Screen { private static final WidgetSprites MIRROR_HANDS_SPRITES = new WidgetSprites( new ResourceLocation(Reference.MOD_ID, "widget/mirror_hands"), new ResourceLocation(Reference.MOD_ID, "widget/mirror_hands_highlighted") ); + private static final WidgetSprites BLOCK_SPRITES = new WidgetSprites( + new ResourceLocation(Reference.MOD_ID, "widget/block"), new ResourceLocation(Reference.MOD_ID, "widget/block_highlighted") + ); + private static final WidgetSprites ITEM_SPRITES = new WidgetSprites( + new ResourceLocation(Reference.MOD_ID, "widget/item"), new ResourceLocation(Reference.MOD_ID, "widget/item_highlighted") + ); + private static final WidgetSprites TOOL_SPRITES = new WidgetSprites( + new ResourceLocation(Reference.MOD_ID, "widget/tool"), new ResourceLocation(Reference.MOD_ID, "widget/tool_highlighted") + ); private final ArmorStand entityArmorStand; private final ArmorStandData armorStandData; @@ -61,6 +73,8 @@ public class ArmorStandScreen extends Screen { private final Tooltip yPositionTooltip = Tooltip.create(Component.translatable("armorposer.gui.tooltip.y_position")); private final Tooltip yPositionTooltipDisabled = Tooltip.create(Component.translatable("armorposer.gui.tooltip.y_position.disabled").withStyle(ChatFormatting.RED)); + private final int whiteColor = 16777215; + public ArmorStandScreen(ArmorStand entityArmorStand) { super(Component.translatable("armorposer.gui.title")); this.entityArmorStand = entityArmorStand; @@ -173,7 +187,9 @@ public void init() { }).bounds(offsetX + 88, offsetY + 22, 42, 20).tooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.save"))).build()); offsetX = this.width - 20; - ImageButton mirrorPose = this.addRenderableWidget(new ImageButton(offsetX - (22 * 6) - 30, offsetY, 20, 20, MIRROR_POSE_SPRITES, (button) -> { + int buttonsLeft = 9; + int buttonOffset = -4; + ImageButton mirrorPose = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, MIRROR_POSE_SPRITES, (button) -> { //Mirror head float[] head = new float[]{poseTextFields[0].getFloat(), poseTextFields[1].getFloat(), poseTextFields[2].getFloat()}; poseTextFields[0].setValue(String.valueOf(head[0])); @@ -209,10 +225,12 @@ public void init() { poseTextFields[15].setValue(String.valueOf(leftArm[0])); poseTextFields[16].setValue(String.valueOf(leftArm[1] != 0 ? -leftArm[1] : 0)); poseTextFields[17].setValue(String.valueOf(leftArm[2] != 0 ? -leftArm[2] : 0)); + this.textFieldUpdated(); })); mirrorPose.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.mirror"))); + buttonsLeft--; - ImageButton mirrorLegs = this.addRenderableWidget(new ImageButton(offsetX - (22 * 5) - 30, offsetY, 20, 20, MIRROR_LEGS_SPRITES, (button) -> { + ImageButton mirrorLegs = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, MIRROR_LEGS_SPRITES, (button) -> { //Mirror Legs float[] leftLeg = new float[]{poseTextFields[6].getFloat(), poseTextFields[7].getFloat(), poseTextFields[8].getFloat()}; float[] rightLeg = new float[]{poseTextFields[9].getFloat(), poseTextFields[10].getFloat(), poseTextFields[11].getFloat()}; @@ -224,10 +242,12 @@ public void init() { poseTextFields[9].setValue(String.valueOf(leftLeg[0])); poseTextFields[10].setValue(String.valueOf(leftLeg[1] != 0 ? -leftLeg[1] : 0)); poseTextFields[11].setValue(String.valueOf(leftLeg[2] != 0 ? -leftLeg[2] : 0)); + this.textFieldUpdated(); })); mirrorLegs.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.mirror_legs"))); + buttonsLeft--; - ImageButton mirrorArms = this.addRenderableWidget(new ImageButton(offsetX - (22 * 4) - 30, offsetY, 20, 20, MIRROR_ARMS_SPRITES, (button) -> { + ImageButton mirrorArms = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, MIRROR_ARMS_SPRITES, (button) -> { //Mirror Arms float[] leftArm = new float[]{poseTextFields[12].getFloat(), poseTextFields[13].getFloat(), poseTextFields[14].getFloat()}; float[] rightArm = new float[]{poseTextFields[15].getFloat(), poseTextFields[16].getFloat(), poseTextFields[17].getFloat()}; @@ -239,24 +259,142 @@ public void init() { poseTextFields[15].setValue(String.valueOf(leftArm[0])); poseTextFields[16].setValue(String.valueOf(leftArm[1] != 0 ? -leftArm[1] : 0)); poseTextFields[17].setValue(String.valueOf(leftArm[2] != 0 ? -leftArm[2] : 0)); + this.textFieldUpdated(); })); mirrorArms.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.mirror_arms"))); + buttonsLeft--; - ImageButton swapToHead = this.addRenderableWidget(new ImageButton(offsetX - (22 * 3) - 30, offsetY, 20, 20, SWAP_TO_HEAD_SPRITES, (button) -> { + ImageButton swapToHead = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, SWAP_TO_HEAD_SPRITES, (button) -> { //Swap item in main hand with head Services.PLATFORM.swapSlots(this.entityArmorStand, SwapData.Action.SWAP_WITH_HEAD); })); swapToHead.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.swap_head"))); - ImageButton swapHands = this.addRenderableWidget(new ImageButton(offsetX - (22 * 2) - 30, offsetY, 20, 20, MIRROR_HANDS_SPRITES, (button) -> { + buttonsLeft--; + + ImageButton swapHands = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, MIRROR_HANDS_SPRITES, (button) -> { //Swap item in main and offhand Services.PLATFORM.swapSlots(this.entityArmorStand, SwapData.Action.SWAP_HANDS); - })); swapHands.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.swap_hands"))); + buttonsLeft--; + + ImageButton blockButton = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, BLOCK_SPRITES, (button) -> { + try { + Vec3 pos = this.entityArmorStand.position(); + //Get the x decimals after the comma + double x = pos.x - (int) pos.x; + //Get the y decimals after the comma + double y = pos.y - (int) pos.y; + //Get the z decimals after the comma + double z = pos.z - (int) pos.z; + + //Get the amount subtracted of x to get .0725 + double xDiff = 1.0725D - x; + //Get the amount subtracted of y to get .345 + double yDiff = -0.655D - y; + //Get the amount subtracted of z to get .852 + double zDiff = 0.852D - z; + + CompoundTag tag = TagParser.parseTag(Reference.alignedBlockPose); + this.readFieldsFromNBT(tag); + this.toggleButtons[0].setValue(true); //Set invisible + this.toggleButtons[2].setValue(true); //Set no gravity + this.toggleButtons[3].setValue(true); //Set show arms + this.rotationTextField.setValue("0"); //Set rotation + this.poseTextFields[18].setValue(String.valueOf(xDiff)); //Set X + this.poseTextFields[19].setValue(String.valueOf(yDiff)); //Set Y + this.poseTextFields[20].setValue(String.valueOf(zDiff)); //Set Z + this.textFieldUpdated(); + } catch (CommandSyntaxException e) { + //Nope + } + + })); + blockButton.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.block"))); + buttonsLeft--; + + ImageButton itemButton = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, ITEM_SPRITES, (button) -> { + if (hasShiftDown()) { //If shift is held the item will be upright + try { + Vec3 pos = this.entityArmorStand.position(); + //Get the x decimals after the comma + double x = pos.x - (int) pos.x; + //Get the y decimals after the comma + double y = pos.y - (int) pos.y; + //Get the z decimals after the comma + double z = pos.z - (int) pos.z; + + //Get the amount subtracted of x to get .86 + double xDiff = 0.86D - x; + //Get the amount subtracted of y to get .59 + double yDiff = -1.41D - y; + //Get the amount subtracted of z to get .9375 + double zDiff = -0.0625D - z; + + CompoundTag tag = TagParser.parseTag(Reference.alignedUprightItemPose); + this.readFieldsFromNBT(tag); + this.toggleButtons[0].setValue(true); //Set invisible + this.toggleButtons[2].setValue(true); //Set no gravity + this.toggleButtons[3].setValue(true); //Set show arms + this.rotationTextField.setValue("0"); //Set rotation + this.poseTextFields[18].setValue(String.valueOf(xDiff)); //Set X + this.poseTextFields[19].setValue(String.valueOf(yDiff)); //Set Y + this.poseTextFields[20].setValue(String.valueOf(zDiff)); //Set Z + this.textFieldUpdated(); + } catch (CommandSyntaxException e) { + //Nope + } + } else { + try { + Vec3 pos = this.entityArmorStand.position(); + //Get the x decimals after the comma + double x = pos.x - (int) pos.x; + //Get the y decimals after the comma + double y = pos.y - (int) pos.y; + //Get the z decimals after the comma + double z = pos.z - (int) pos.z; + + //Get the amount subtracted of x to get .886 + double xDiff = 0.886D - x; + //Get the amount subtracted of y to get .22 + double yDiff = -0.78D - y; + //Get the amount subtracted of z to get .205 + double zDiff = 0.205D - z; + + CompoundTag tag = TagParser.parseTag(Reference.flatItemPose); + this.readFieldsFromNBT(tag); + this.toggleButtons[0].setValue(true); //Set invisible + this.toggleButtons[2].setValue(true); //Set no gravity + this.toggleButtons[3].setValue(true); //Set show arms + this.rotationTextField.setValue("0"); //Set rotation + this.poseTextFields[18].setValue(String.valueOf(xDiff)); //Set X + this.poseTextFields[19].setValue(String.valueOf(yDiff)); //Set Y + this.poseTextFields[20].setValue(String.valueOf(zDiff)); //Set Z + this.textFieldUpdated(); + } catch (CommandSyntaxException e) { + //Nope + } + } + })); + itemButton.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.item").append("\n").append(Component.translatable("armorposer.gui.tooltip.item2").withStyle(ChatFormatting.GRAY)))); + buttonsLeft--; - this.addRenderableWidget(this.lockButton = new LockIconButton(offsetX - (22) - 30, offsetY, (button) -> { + ImageButton toolButton = this.addRenderableWidget(new ImageButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, 20, 20, TOOL_SPRITES, (button) -> { + String itemPose = Reference.defaultPoseMap.get("item"); + try { + CompoundTag tag = TagParser.parseTag(itemPose); + this.readFieldsFromNBT(tag); + this.updateEntity(tag); + } catch (CommandSyntaxException e) { + //Nope + } + })); + toolButton.setTooltip(Tooltip.create(Component.translatable("armorposer.gui.tooltip.tool"))); + buttonsLeft--; + + this.addRenderableWidget(this.lockButton = new LockIconButton(offsetX - (22 * buttonsLeft) - buttonOffset, offsetY, (button) -> { this.lockButton.setLocked(!this.lockButton.isLocked()); })); this.lockButton.setLocked(this.armorStandData.getBooleanValue(6)); @@ -266,7 +404,7 @@ public void init() { this.addRenderableWidget(Button.builder(Component.translatable("gui.done"), (button) -> { this.updateEntity(this.writeFieldsToNBT()); this.minecraft.setScreen((Screen) null); - }).bounds(offsetX - ((2 * 96) + 2), offsetY + 22, 96, 20).build()); + }).bounds(offsetX - ((2 * 96) + 2), offsetY + 22, 97, 20).build()); this.addRenderableWidget(Button.builder(Component.translatable("gui.cancel"), (button) -> { this.poseTextFields[18].setValue("0"); this.poseTextFields[19].setValue("0"); @@ -274,7 +412,7 @@ public void init() { this.textFieldUpdated(); this.updateEntity(this.armorStandData.writeToNBT()); this.minecraft.setScreen((Screen) null); - }).bounds(offsetX - 96, offsetY + 22, 96, 20).build()); + }).bounds(offsetX - 95, offsetY + 22, 97, 20).build()); } @Override @@ -282,7 +420,7 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia super.render(guiGraphics, mouseX, mouseY, partialTicks); // Draw gui title - guiGraphics.drawCenteredString(this.font, Component.translatable("armorposer.gui.title"), this.width / 2, 10, 0xFFFFFF); + guiGraphics.drawString(this.font, this.title, this.width / 2 - this.font.width(this.title) / 2, 10, whiteColor, true); // Draw textboxes this.rotationTextField.render(guiGraphics, mouseX, mouseY, partialTicks); @@ -296,22 +434,33 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia for (int i = 0; i < this.buttonLabels.length; i++) { int x = offsetX; int y = offsetY + (i * 22) + (10 - (this.font.lineHeight / 2)); - guiGraphics.drawString(this.font, I18n.get("armorposer.gui.label." + this.buttonLabels[i]), x, y, 0xA0A0A0, false); + guiGraphics.drawString(this.font, I18n.get("armorposer.gui.label." + this.buttonLabels[i]), x, y, whiteColor, true); } // right column labels offsetX = this.width - 20 - 100; // x, y, z - guiGraphics.drawString(this.font, "X", offsetX + 10, 7, 0xA0A0A0, false); - guiGraphics.drawString(this.font, "Y", offsetX + 45, 7, 0xA0A0A0, false); - guiGraphics.drawString(this.font, "Z", offsetX + 80, 7, 0xA0A0A0, false); + guiGraphics.drawString(this.font, "X", offsetX + 10, 7, whiteColor, true); + guiGraphics.drawString(this.font, "Y", offsetX + 45, 7, whiteColor, true); + guiGraphics.drawString(this.font, "Z", offsetX + 80, 7, whiteColor, true); // pose textboxes for (int i = 0; i < this.sliderLabels.length; i++) { String translatedLabel = I18n.get("armorposer.gui.label." + this.sliderLabels[i]); int x = offsetX - this.font.width(translatedLabel) - 10; int y = offsetY + (i * 22) + (10 - (this.font.lineHeight / 2)); - guiGraphics.drawString(this.font, translatedLabel, x, y, 0xA0A0A0, false); + guiGraphics.drawString(this.font, translatedLabel, x, y, whiteColor, true); } + + PoseStack poseStack = guiGraphics.pose(); + poseStack.pushPose(); + poseStack.mulPose(Axis.ZP.rotationDegrees(90.0F)); + guiGraphics.drawString(this.font, Component.translatable("armorposer.gui.label.scroll"), 21, -width + 10, 11184810, true); + poseStack.popPose(); + } + + @Override + public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + //Nope } @Override @@ -410,10 +559,10 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { } else { for (NumberFieldBox textField : this.poseTextFields) { if (textField.keyPressed(keyCode, scanCode, modifiers)) { + this.textFieldUpdated(); return true; } } - this.textFieldUpdated(); } } return super.keyPressed(keyCode, scanCode, modifiers); @@ -421,10 +570,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - boolean clicked = super.mouseClicked(mouseX, mouseY, button); - this.textFieldUpdated(); - - return clicked; + return super.mouseClicked(mouseX, mouseY, button); } protected void textFieldUpdated() { diff --git a/common/src/main/java/com/mrbysco/armorposer/client/gui/DeletePoseScreen.java b/common/src/main/java/com/mrbysco/armorposer/client/gui/DeletePoseScreen.java new file mode 100644 index 0000000..e74bb6c --- /dev/null +++ b/common/src/main/java/com/mrbysco/armorposer/client/gui/DeletePoseScreen.java @@ -0,0 +1,51 @@ +package com.mrbysco.armorposer.client.gui; + +import com.mrbysco.armorposer.Reference; +import com.mrbysco.armorposer.client.gui.widgets.PoseListWidget; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.TagParser; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.level.Level; + +import java.util.function.Function; + +public class DeletePoseScreen extends Screen { + private final ArmorStandScreen parentScreen; + private Button deleteButton; + private final PoseListWidget.ListEntry entry; + private final Component warning = Component.translatable("armorposer.gui.delete_poose.message"); + + public DeletePoseScreen(ArmorStandScreen armorStandScreen, PoseListWidget.ListEntry entry) { + super(Component.translatable("armorposer.gui.delete_poose.title")); + this.parentScreen = armorStandScreen; + this.entry = entry; + } + + @Override + protected void init() { + this.addRenderableWidget(this.deleteButton = Button.builder(CommonComponents.GUI_YES, (button) -> { + Reference.removePose(entry.rawName()); + this.minecraft.setScreen(parentScreen); + }).bounds(this.width / 2 - 66, this.height / 2 + 3, 60, 20).build()); + + this.addRenderableWidget(Button.builder(CommonComponents.GUI_NO, (button) -> { + this.minecraft.setScreen(parentScreen); + }).bounds(this.width / 2 - 4, this.height / 2 + 3, 60, 20).build()); + } + + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); + + this.entry.renderPose(guiGraphics, this.width / 2, this.height / 2 - 50, 50); + + guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 20, 16777215); + guiGraphics.drawCenteredString(this.font, this.warning, this.width / 2, 50, 11141120); + } +} diff --git a/common/src/main/java/com/mrbysco/armorposer/client/gui/widgets/PoseListWidget.java b/common/src/main/java/com/mrbysco/armorposer/client/gui/widgets/PoseListWidget.java index 908bf7a..42e9525 100644 --- a/common/src/main/java/com/mrbysco/armorposer/client/gui/widgets/PoseListWidget.java +++ b/common/src/main/java/com/mrbysco/armorposer/client/gui/widgets/PoseListWidget.java @@ -114,8 +114,12 @@ public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, int Font font = this.parent.getScreenFont(); renderScrollingString(guiGraphics, font, Component.literal(getName()), left + 36, top + 10, left + width - 18, top + 20, 0xFFFFFF); + renderPose(guiGraphics, left + 16, top + 28, 15); + } + + public void renderPose(GuiGraphics guiGraphics, int xPos, int yPos, int size) { if (cachedEntity != null) { - InventoryScreen.renderEntityInInventory(guiGraphics, left + 16, top + 28, 15, + InventoryScreen.renderEntityInInventory(guiGraphics, xPos, yPos, size, ARMOR_STAND_TRANSLATION, ARMOR_STAND_ANGLE, (Quaternionf) null, this.cachedEntity); } } diff --git a/common/src/main/java/com/mrbysco/armorposer/data/SyncData.java b/common/src/main/java/com/mrbysco/armorposer/data/SyncData.java index 66c3f0b..3b0f14c 100644 --- a/common/src/main/java/com/mrbysco/armorposer/data/SyncData.java +++ b/common/src/main/java/com/mrbysco/armorposer/data/SyncData.java @@ -32,7 +32,7 @@ public void handleData(ArmorStand armorStand) { double x = tagList.getDouble(0); double y = tagList.getDouble(1); double z = tagList.getDouble(2); - armorStand.setPos(armorStand.getX() + x, + armorStand.setPosRaw(armorStand.getX() + x, armorStand.getY() + y, armorStand.getZ() + z); } diff --git a/common/src/main/resources/assets/armorposer/lang/en_us.json b/common/src/main/resources/assets/armorposer/lang/en_us.json index 292c9b0..9472699 100644 --- a/common/src/main/resources/assets/armorposer/lang/en_us.json +++ b/common/src/main/resources/assets/armorposer/lang/en_us.json @@ -26,6 +26,7 @@ "armorposer.gui.label.left_arm": "Left Arm", "armorposer.gui.label.right_arm": "Right Arm", "armorposer.gui.label.position": "Position", + "armorposer.gui.label.scroll": "Click and scroll", "armorposer.gui.label.copy": "Copy", "armorposer.gui.label.paste": "Paste", @@ -58,6 +59,10 @@ "armorposer.gui.tooltip.mirror_arms": "Mirror Arms", "armorposer.gui.tooltip.swap_head": "Swap main hand and head", "armorposer.gui.tooltip.swap_hands": "Swap main and off hand", + "armorposer.gui.tooltip.block": "Align held block so it appears on the surface", + "armorposer.gui.tooltip.item": "Align held item so it appears flat on the surface", + "armorposer.gui.tooltip.item2": "Holding shift aligns the item so it appears upright on the surface", + "armorposer.gui.tooltip.tool": "Align held tool so it appears flat on the surface", "armorposer.gui.tooltip.lock": "Lock Interaction", "armorposer.gui.pose.attention": "Attention", @@ -86,6 +91,8 @@ "armorposer.gui.pose.random": "Random", "armorposer.gui.save_pose.title": "Save pose", + "armorposer.gui.delete_poose.title": "Delete pose", + "armorposer.gui.delete_poose.message": "Are you sure you want to remove this pose?", "armorposer.config.enableConfigGui": "Enable GUI", "armorposer.config.enableConfigGui.tooltip": "Show the Armor Stand configuration GUI on shift right click", diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block.png new file mode 100644 index 0000000..a07ad9f Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block.png differ diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block_highlighted.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block_highlighted.png new file mode 100644 index 0000000..eb96184 Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/block_highlighted.png differ diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item.png new file mode 100644 index 0000000..34200af Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item.png differ diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item_highlighted.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item_highlighted.png new file mode 100644 index 0000000..eb303df Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/item_highlighted.png differ diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool.png new file mode 100644 index 0000000..1a6fd9d Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool.png differ diff --git a/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool_highlighted.png b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool_highlighted.png new file mode 100644 index 0000000..817c9b2 Binary files /dev/null and b/common/src/main/resources/assets/armorposer/textures/gui/sprites/widget/tool_highlighted.png differ