From 216b50893e061d0e8ffe4f655e760da650e2ca6c Mon Sep 17 00:00:00 2001 From: Gugle Date: Tue, 16 Apr 2024 01:28:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E5=AE=9E=E7=8E=B0=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E6=8B=96=E6=8B=BD=E6=9D=A1=E7=9A=84GUI=EF=BC=88?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E4=B8=8D=E4=BA=86=E7=9A=84=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=9D=A1=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/dev/dubhe/anvilcraft/AnvilCraft.java | 4 +- .../anvilcraft/block/CreativeDynamoBlock.java | 28 +++ .../entity/CreativeDynamoBlockEntity.java | 39 ++++- .../gui/component/EnableFilterButton.java | 4 +- .../gui/component/OutputDirectionButton.java | 12 +- .../client/gui/component/Slider.java | 159 ++++++++++++++++++ .../screen/inventory/AutoCrafterScreen.java | 3 +- .../gui/screen/inventory/ChuteScreen.java | 3 +- .../gui/screen/inventory/IFilterScreen.java | 2 +- .../screen/inventory/RoyalAnvilScreen.java | 10 +- .../inventory/RoyalGrindstoneScreen.java | 2 +- .../screen/inventory/RoyalSmithingScreen.java | 5 +- .../gui/screen/inventory/SliderScreen.java | 121 +++++++++++++ .../dubhe/anvilcraft/init/ModMenuTypes.java | 30 +++- .../dubhe/anvilcraft/init/ModNetworks.java | 10 +- .../anvilcraft/inventory/SliderMenu.java | 60 +++++++ .../anvilcraft/network/SliderInitPack.java | 61 +++++++ .../anvilcraft/network/SliderUpdatePack.java | 42 +++++ .../{ => machine/background}/auto_crafter.png | Bin .../{ => machine/background}/chute.png | Bin .../gui/container/{ => machine}/button_d.png | Bin .../gui/container/{ => machine}/button_e.png | Bin .../gui/container/{ => machine}/button_n.png | Bin .../gui/container/{ => machine}/button_no.png | Bin .../gui/container/{ => machine}/button_s.png | Bin .../gui/container/{ => machine}/button_u.png | Bin .../gui/container/{ => machine}/button_w.png | Bin .../container/{ => machine}/button_yes.png | Bin .../container/{ => machine}/disabled_slot.png | Bin .../{slider.png => slider/background.png} | Bin .../button_add.png} | Bin .../button_max.png} | Bin .../button_min.png} | Bin .../button_minus.png} | Bin .../{slider_slider.png => slider/slider.png} | Bin .../{ => smithing/background}/royal_anvil.png | Bin .../background}/royal_grindstone.png | Bin .../background}/royal_smithing_table.png | Bin .../gui/container/{ => smithing}/error.png | Bin .../container/{ => smithing}/text_field.png | Bin .../{ => smithing}/text_field_disabled.png | Bin .../gui/container/warning_material.png | Bin 385 -> 0 bytes .../textures/gui/container/warning_none.png | Bin 380 -> 0 bytes .../gui/container/warning_protocol.png | Bin 379 -> 0 bytes 44 files changed, 565 insertions(+), 30 deletions(-) create mode 100644 common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/Slider.java create mode 100644 common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/SliderScreen.java create mode 100644 common/src/main/java/dev/dubhe/anvilcraft/inventory/SliderMenu.java create mode 100644 common/src/main/java/dev/dubhe/anvilcraft/network/SliderInitPack.java create mode 100644 common/src/main/java/dev/dubhe/anvilcraft/network/SliderUpdatePack.java rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine/background}/auto_crafter.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine/background}/chute.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_d.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_e.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_n.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_no.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_s.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_u.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_w.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/button_yes.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => machine}/disabled_slot.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider.png => slider/background.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider_button_add.png => slider/button_add.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider_button_max.png => slider/button_max.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider_button_min.png => slider/button_min.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider_button_minus.png => slider/button_minus.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{slider_slider.png => slider/slider.png} (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing/background}/royal_anvil.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing/background}/royal_grindstone.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing/background}/royal_smithing_table.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing}/error.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing}/text_field.png (100%) rename common/src/main/resources/assets/anvilcraft/textures/gui/container/{ => smithing}/text_field_disabled.png (100%) delete mode 100644 common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_material.png delete mode 100644 common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_none.png delete mode 100644 common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_protocol.png diff --git a/common/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java b/common/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java index f4a9f2165..21aec145b 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java @@ -52,7 +52,7 @@ public static void init() { REGISTRATE.registerRegistrate(); } - public static @NotNull ResourceLocation of(String id) { - return new ResourceLocation(MOD_ID, id); + public static @NotNull ResourceLocation of(String path) { + return new ResourceLocation(MOD_ID, path); } } diff --git a/common/src/main/java/dev/dubhe/anvilcraft/block/CreativeDynamoBlock.java b/common/src/main/java/dev/dubhe/anvilcraft/block/CreativeDynamoBlock.java index b31138553..f05ebff5e 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/block/CreativeDynamoBlock.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/block/CreativeDynamoBlock.java @@ -1,13 +1,21 @@ package dev.dubhe.anvilcraft.block; import dev.dubhe.anvilcraft.block.entity.CreativeDynamoBlockEntity; +import dev.dubhe.anvilcraft.init.ModMenuTypes; +import dev.dubhe.anvilcraft.network.SliderInitPack; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.NotNull; @@ -22,6 +30,26 @@ public CreativeDynamoBlock(Properties properties) { super(properties); } + @Override + @SuppressWarnings({"deprecation", "UnreachableCode"}) + public @NotNull InteractionResult use( + @NotNull BlockState state, @NotNull Level level, + @NotNull BlockPos pos, @NotNull Player player, + @NotNull InteractionHand hand, @NotNull BlockHitResult hit + ) { + if (level.isClientSide) { + return InteractionResult.SUCCESS; + } + if ( + level.getBlockEntity(pos) instanceof CreativeDynamoBlockEntity entity + && player instanceof ServerPlayer serverPlayer + ) { + ModMenuTypes.open(serverPlayer, entity, pos); + new SliderInitPack(entity.getPower(), -1024, 1024).send(serverPlayer); + } + return InteractionResult.SUCCESS; + } + @Nullable @Override public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { diff --git a/common/src/main/java/dev/dubhe/anvilcraft/block/entity/CreativeDynamoBlockEntity.java b/common/src/main/java/dev/dubhe/anvilcraft/block/entity/CreativeDynamoBlockEntity.java index abc519a78..a8b80be4f 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/block/entity/CreativeDynamoBlockEntity.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/block/entity/CreativeDynamoBlockEntity.java @@ -1,19 +1,31 @@ package dev.dubhe.anvilcraft.block.entity; +import dev.dubhe.anvilcraft.api.power.IPowerConsumer; import dev.dubhe.anvilcraft.api.power.IPowerProducer; +import dev.dubhe.anvilcraft.api.power.PowerComponentType; import dev.dubhe.anvilcraft.api.power.PowerGrid; import dev.dubhe.anvilcraft.init.ModBlockEntities; +import dev.dubhe.anvilcraft.init.ModBlocks; +import dev.dubhe.anvilcraft.inventory.SliderMenu; import lombok.Getter; +import lombok.Setter; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class CreativeDynamoBlockEntity extends BlockEntity implements IPowerProducer { - @Getter +@Getter +public class CreativeDynamoBlockEntity extends BlockEntity implements IPowerProducer, IPowerConsumer, MenuProvider { private PowerGrid grid = null; + @Setter private int power = 16; public static @NotNull CreativeDynamoBlockEntity createBlockEntity( @@ -44,7 +56,17 @@ public void load(@NotNull CompoundTag tag) { @Override public int getOutputPower() { - return this.power; + return this.power > 0 ? this.power : 0; + } + + @Override + public int getInputPower() { + return this.power < 0 ? -this.power : 0; + } + + @Override + public @NotNull PowerComponentType getComponentType() { + return this.power > 0 ? PowerComponentType.PRODUCER : PowerComponentType.CONSUMER; } @Override @@ -56,4 +78,15 @@ public int getOutputPower() { public void setGrid(PowerGrid grid) { this.grid = grid; } + + @Override + public @NotNull Component getDisplayName() { + return ModBlocks.CREATIVE_DYNAMO.get().getName(); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int i, @NotNull Inventory inventory, @NotNull Player player) { + return new SliderMenu(i, -1024, 1024, this::setPower); + } } diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/EnableFilterButton.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/EnableFilterButton.java index b1cd92372..534a0e904 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/EnableFilterButton.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/EnableFilterButton.java @@ -18,8 +18,8 @@ @Getter public class EnableFilterButton extends Button { private final Supplier filterEnabled; - private static final ResourceLocation YES = AnvilCraft.of("textures/gui/container/button_yes.png"); - private static final ResourceLocation NO = AnvilCraft.of("textures/gui/container/button_no.png"); + private static final ResourceLocation YES = AnvilCraft.of("textures/gui/container/machine/button_yes.png"); + private static final ResourceLocation NO = AnvilCraft.of("textures/gui/container/machine/button_no.png"); private static final MutableComponent defaultMessage = Component .translatable("screen.anvilcraft.button.record", Component.translatable("screen.anvilcraft.button.off")); diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/OutputDirectionButton.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/OutputDirectionButton.java index 29babd838..777250b51 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/OutputDirectionButton.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/OutputDirectionButton.java @@ -18,12 +18,12 @@ public class OutputDirectionButton extends Button { private Direction direction; private final List skip = new ArrayList<>(); - private static final ResourceLocation UP = AnvilCraft.of("textures/gui/container/button_u.png"); - private static final ResourceLocation DOWN = AnvilCraft.of("textures/gui/container/button_d.png"); - private static final ResourceLocation EAST = AnvilCraft.of("textures/gui/container/button_e.png"); - private static final ResourceLocation WEST = AnvilCraft.of("textures/gui/container/button_w.png"); - private static final ResourceLocation SOUTH = AnvilCraft.of("textures/gui/container/button_s.png"); - private static final ResourceLocation NORTH = AnvilCraft.of("textures/gui/container/button_n.png"); + private static final ResourceLocation UP = AnvilCraft.of("textures/gui/container/machine/button_u.png"); + private static final ResourceLocation DOWN = AnvilCraft.of("textures/gui/container/machine/button_d.png"); + private static final ResourceLocation EAST = AnvilCraft.of("textures/gui/container/machine/button_e.png"); + private static final ResourceLocation WEST = AnvilCraft.of("textures/gui/container/machine/button_w.png"); + private static final ResourceLocation SOUTH = AnvilCraft.of("textures/gui/container/machine/button_s.png"); + private static final ResourceLocation NORTH = AnvilCraft.of("textures/gui/container/machine/button_n.png"); private static final MutableComponent defaultMessage = Component.translatable("screen.anvilcraft.button.direction", Component.translatable("screen.anvilcraft.button.direction.up")); diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/Slider.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/Slider.java new file mode 100644 index 000000000..b8d310dee --- /dev/null +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/component/Slider.java @@ -0,0 +1,159 @@ +package dev.dubhe.anvilcraft.client.gui.component; + +import dev.dubhe.anvilcraft.AnvilCraft; +import dev.dubhe.anvilcraft.inventory.SliderMenu; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; + +public class Slider extends AbstractWidget { + public static final ResourceLocation SLIDER = AnvilCraft.of("textures/gui/container/slider/slider.png"); + @Setter + @Getter + private int min; + @Setter + @Getter + private int max; + @Getter + private int value; + private final int posX; + private final int posY; + private final int length; + public final SliderMenu.Update update; + private int tooltipMsDelay; + private long hoverOrFocusedStartTime; + private boolean wasHoveredOrFocused; + + /** + * @param x X + * @param y Y + * @param min 最小值 + * @param max 最大值 + * @param length 长度 + * @param update 更新回调 + */ + public Slider(int x, int y, int min, int max, int length, SliderMenu.Update update) { + super(x, y, length, 8, Component.literal("Slider")); + this.posX = x; + this.posY = y; + this.min = min; + this.max = max; + this.length = length; + this.update = update; + } + + public double getProportion() { + return Math.max(0.0, Math.min(1.0, (double) (value - this.min) / (this.max - this.min))); + } + + public void setProportion(double proportion) { + this.value = (int) ((max - min) * proportion + min); + } + + public void setValue(int value) { + this.value = Math.max(this.min, Math.min(this.max, value)); + } + + /** + * @param value 设置 Value 并更新 + */ + public void setValueWithUpdate(int value) { + if (this.value == value) return; + this.setValue(value); + this.update(); + } + + private void update() { + if (this.update != null) this.update.update(this.value); + } + + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { + if (button == 0) { + this.onDrag(mouseX, mouseY, dragX, dragY); + return true; + } + return false; + } + + @Override + public void onClick(double mouseX, double mouseY) { + super.onClick(mouseX, mouseY); + if (!isInRange(mouseX, mouseY)) return; + if (isInSlider(mouseX, mouseY)) { + super.onClick(mouseX, mouseY); + return; + } + double offset = 16.0 / this.length; + int offsetX = posX + (int) ((length - 16) * this.getProportion()); + if (mouseX < offsetX) this.setProportion(Math.max(0.0, this.getProportion() - offset)); + else this.setProportion(Math.min(1.0, this.getProportion() + offset)); + this.update(); + } + + @Override + protected void onDrag(double mouseX, double mouseY, double dragX, double dragY) { + super.onDrag(mouseX, mouseY, dragX, dragY); + if (!isInSlider(mouseX, mouseY)) return; + double offset = dragX - mouseX / this.length; + this.setProportion(Math.max(0.0, Math.min(1.0, this.getProportion() + offset))); + this.update(); + } + + protected boolean isInSlider(double mouseX, double mouseY) { + int offsetX = posX + (int) ((length - 16) * this.getProportion()); + return mouseX > offsetX && mouseX < offsetX + 16 && mouseY > posY && mouseY < posY + 8; + } + + protected boolean isInRange(double mouseX, double mouseY) { + return mouseX > posX && mouseX < posX + length && mouseY > posY && mouseY < posY + 8; + } + + @Override + public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + if (!this.visible) return; + this.isHovered = this.isInRange(mouseX, mouseY); + this.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + this.updateTooltip(); + } + + @Override + protected void renderWidget(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + int offsetX = posX + (int) ((length - 16) * this.getProportion()); + guiGraphics.blit(SLIDER, offsetX, posY, 0, this.isHovered ? 8 : 0, 16, 8, 16, 16); + } + + @Override + protected void updateWidgetNarration(@NotNull NarrationElementOutput narrationElementOutput) { + } + + private void updateTooltip() { + if (this.getTooltip() == null) return; + boolean bl = this.isHovered || this.isFocused() && Minecraft.getInstance().getLastInputType().isKeyboard(); + if (bl != this.wasHoveredOrFocused) { + if (bl) this.hoverOrFocusedStartTime = Util.getMillis(); + this.wasHoveredOrFocused = bl; + } + Screen screen; + if (bl + && Util.getMillis() - this.hoverOrFocusedStartTime > (long) this.tooltipMsDelay + && (screen = Minecraft.getInstance().screen) != null + ) { + screen.setTooltipForNextRenderPass(this.getTooltip(), this.createTooltipPositioner(), this.isFocused()); + } + } + + @Override + public void setTooltipDelay(int tooltipMsDelay) { + super.setTooltipDelay(tooltipMsDelay); + this.tooltipMsDelay = tooltipMsDelay; + } +} diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/AutoCrafterScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/AutoCrafterScreen.java index 8348a9d2f..be5c396ee 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/AutoCrafterScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/AutoCrafterScreen.java @@ -18,7 +18,8 @@ import java.util.function.BiFunction; public class AutoCrafterScreen extends BaseMachineScreen implements IFilterScreen { - private static final ResourceLocation CONTAINER_LOCATION = AnvilCraft.of("textures/gui/container/auto_crafter.png"); + private static final ResourceLocation CONTAINER_LOCATION = + AnvilCraft.of("textures/gui/container/machine/background/auto_crafter.png"); BiFunction enableFilterButtonSupplier = this .getEnableFilterButtonSupplier(116, 18); @Getter diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/ChuteScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/ChuteScreen.java index f9913cb6b..3c192b9cb 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/ChuteScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/ChuteScreen.java @@ -20,7 +20,8 @@ import java.util.function.BiFunction; public class ChuteScreen extends BaseMachineScreen implements IFilterScreen { - private static final ResourceLocation CONTAINER_LOCATION = AnvilCraft.of("textures/gui/container/chute.png"); + private static final ResourceLocation CONTAINER_LOCATION = + AnvilCraft.of("textures/gui/container/machine/background/chute.png"); BiFunction enableFilterButtonSupplier = this diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/IFilterScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/IFilterScreen.java index bb3bae113..7b9874f23 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/IFilterScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/IFilterScreen.java @@ -18,7 +18,7 @@ * 有过滤的 GUI */ public interface IFilterScreen { - ResourceLocation DISABLED_SLOT = AnvilCraft.of("textures/gui/container/disabled_slot.png"); + ResourceLocation DISABLED_SLOT = AnvilCraft.of("textures/gui/container/machine/disabled_slot.png"); IFilterMenu getFilterMenu(); diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalAnvilScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalAnvilScreen.java index 3234a5711..dadd2561b 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalAnvilScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalAnvilScreen.java @@ -17,10 +17,12 @@ import org.jetbrains.annotations.NotNull; public class RoyalAnvilScreen extends ItemCombinerScreen { - private static final ResourceLocation ANVIL_LOCATION = AnvilCraft.of("textures/gui/container/royal_anvil.png"); - private static final ResourceLocation TEXT_LOCATION = AnvilCraft.of("textures/gui/container/text_field.png"); - private static final ResourceLocation TEXT_DISABLE_LOCATION = AnvilCraft - .of("textures/gui/container/text_field_disabled.png"); + private static final ResourceLocation ANVIL_LOCATION = + AnvilCraft.of("textures/gui/container/smithing/background/royal_anvil.png"); + private static final ResourceLocation TEXT_LOCATION = + AnvilCraft.of("textures/gui/container/smithing/text_field.png"); + private static final ResourceLocation TEXT_DISABLE_LOCATION = + AnvilCraft.of("textures/gui/container/smithing/text_field_disabled.png"); private EditBox name; private final Player player; diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalGrindstoneScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalGrindstoneScreen.java index c002d67eb..fa6f1fcc8 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalGrindstoneScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalGrindstoneScreen.java @@ -11,7 +11,7 @@ public class RoyalGrindstoneScreen extends AbstractContainerScreen { private static final ResourceLocation GRINDSTONE_LOCATION = - AnvilCraft.of("textures/gui/container/royal_grindstone.png"); + AnvilCraft.of("textures/gui/container/smithing/background/royal_grindstone.png"); public RoyalGrindstoneScreen( RoyalGrindstoneMenu menu, Inventory playerInventory, @SuppressWarnings("unused") Component title diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalSmithingScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalSmithingScreen.java index a77d112c6..3849401b8 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalSmithingScreen.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/RoyalSmithingScreen.java @@ -25,8 +25,9 @@ public class RoyalSmithingScreen extends ItemCombinerScreen { private static final ResourceLocation SMITHING_LOCATION = - AnvilCraft.of("textures/gui/container/royal_smithing_table.png"); - private static final ResourceLocation ERROR = AnvilCraft.of("textures/gui/container/error.png"); + AnvilCraft.of("textures/gui/container/smithing/background/royal_smithing_table.png"); + private static final ResourceLocation ERROR = + AnvilCraft.of("textures/gui/container/smithing/error.png"); private static final ResourceLocation EMPTY_SLOT_SMITHING_TEMPLATE_ARMOR_TRIM = new ResourceLocation("item/empty_slot_smithing_template_armor_trim"); private static final ResourceLocation EMPTY_SLOT_SMITHING_TEMPLATE_NETHERITE_UPGRADE = diff --git a/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/SliderScreen.java b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/SliderScreen.java new file mode 100644 index 000000000..288d77065 --- /dev/null +++ b/common/src/main/java/dev/dubhe/anvilcraft/client/gui/screen/inventory/SliderScreen.java @@ -0,0 +1,121 @@ +package dev.dubhe.anvilcraft.client.gui.screen.inventory; + +import dev.dubhe.anvilcraft.AnvilCraft; +import dev.dubhe.anvilcraft.client.gui.component.Slider; +import dev.dubhe.anvilcraft.inventory.SliderMenu; +import dev.dubhe.anvilcraft.network.SliderUpdatePack; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import org.jetbrains.annotations.NotNull; + +public class SliderScreen extends AbstractContainerScreen { + public static final ResourceLocation LOCATION = AnvilCraft.of("textures/gui/container/slider/background.png"); + public static final ResourceLocation BUTTON_MAX = AnvilCraft.of("textures/gui/container/slider/button_max.png"); + public static final ResourceLocation BUTTON_ADD = AnvilCraft.of("textures/gui/container/slider/button_add.png"); + public static final ResourceLocation BUTTON_MINUS = AnvilCraft.of("textures/gui/container/slider/button_minus.png"); + public static final ResourceLocation BUTTON_MIN = AnvilCraft.of("textures/gui/container/slider/button_min.png"); + private Slider slider = null; + private EditBox value; + + /** + * @param menu 菜单 + * @param inventory 背包 + * @param title 标题 + */ + public SliderScreen(SliderMenu menu, Inventory inventory, Component title) { + super(menu, inventory, title); + this.imageWidth = 176; + this.imageHeight = 77; + } + + @Override + protected void init() { + super.init(); + this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; + int offsetX = (this.width - this.imageWidth) / 2; + int offsetY = (this.height - this.imageHeight) / 2; + this.slider = new Slider(8 + offsetX, 31 + offsetY, 0, 16, 160, this::update); + this.value = new EditBox(this.font, offsetX + 50, offsetY + 47, 76, 8, Component.literal("value")); + this.value.setCanLoseFocus(false); + this.value.setTextColor(-1); + this.value.setTextColorUneditable(-1); + this.value.setBordered(false); + this.value.setMaxLength(50); + this.value.setResponder(this::onValueInput); + this.value.setValue(""); + ImageButton max = new ImageButton( + 152 + offsetX, 43 + offsetY, + 16, 16, 0, 0, 16, BUTTON_MAX, 16, 32, + (btn) -> this.slider.setValueWithUpdate(slider.getMax()) + ); + ImageButton add = new ImageButton( + 134 + offsetX, 43 + offsetY, + 16, 16, 0, 0, 16, BUTTON_ADD, 16, 32, + (btn) -> this.slider.setValueWithUpdate(Math.min(slider.getMax(), slider.getValue() + 1)) + ); + ImageButton min = new ImageButton( + 8 + offsetX, 43 + offsetY, + 16, 16, 0, 0, 16, BUTTON_MIN, 16, 32, + (btn) -> this.slider.setValueWithUpdate(slider.getMin()) + ); + ImageButton minus = new ImageButton( + 26 + offsetX, 43 + offsetY, + 16, 16, 0, 0, 16, BUTTON_MINUS, 16, 32, + (btn) -> this.slider.setValueWithUpdate(Math.max(slider.getMin(), slider.getValue() - 1)) + ); + this.addRenderableWidget(max); + this.addRenderableWidget(add); + this.addRenderableWidget(min); + this.addRenderableWidget(minus); + this.addRenderableWidget(this.slider); + this.addRenderableWidget(this.value); + this.setInitialFocus(this.value); + } + + public void setValue(int value) { + if (this.slider != null) slider.setValue(value); + this.value.setValue("" + value); + } + + private void onValueInput(@NotNull String value) { + String regex = "^[+-]?[0-9]+$"; + if (value.matches(regex)) { + int v = Integer.parseInt(value); + this.slider.setValueWithUpdate(v); + } else if (value.isEmpty()) { + this.slider.setValueWithUpdate(0); + } else { + this.value.setValue("" + this.slider.getValue()); + } + } + + public void setMin(int min) { + if (this.slider != null) slider.setMin(min); + } + + public void setMax(int max) { + if (this.slider != null) slider.setMax(max); + } + + @Override + protected void renderLabels(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY) { + guiGraphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 0x404040, false); + } + + @Override + protected void renderBg(@NotNull GuiGraphics guiGraphics, float partialTick, int mouseX, int mouseY) { + int offsetX = (this.width - this.imageWidth) / 2; + int offsetY = (this.height - this.imageHeight) / 2; + guiGraphics.blit(LOCATION, offsetX, offsetY, 0, 0, this.imageWidth, this.imageHeight, 256, 128); + } + + private void update(int value) { + new SliderUpdatePack(value).send(); + this.value.setValue("" + value); + } +} diff --git a/common/src/main/java/dev/dubhe/anvilcraft/init/ModMenuTypes.java b/common/src/main/java/dev/dubhe/anvilcraft/init/ModMenuTypes.java index 39667e376..19ec035d6 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/init/ModMenuTypes.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/init/ModMenuTypes.java @@ -7,11 +7,13 @@ import dev.dubhe.anvilcraft.client.gui.screen.inventory.RoyalAnvilScreen; import dev.dubhe.anvilcraft.client.gui.screen.inventory.RoyalGrindstoneScreen; import dev.dubhe.anvilcraft.client.gui.screen.inventory.RoyalSmithingScreen; +import dev.dubhe.anvilcraft.client.gui.screen.inventory.SliderScreen; import dev.dubhe.anvilcraft.inventory.AutoCrafterMenu; import dev.dubhe.anvilcraft.inventory.ChuteMenu; import dev.dubhe.anvilcraft.inventory.RoyalAnvilMenu; import dev.dubhe.anvilcraft.inventory.RoyalGrindstoneMenu; import dev.dubhe.anvilcraft.inventory.RoyalSmithingMenu; +import dev.dubhe.anvilcraft.inventory.SliderMenu; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.MenuProvider; @@ -28,17 +30,33 @@ public class ModMenuTypes { .menu("chute", ChuteMenu::new, () -> ChuteScreen::new) .register(); public static final MenuEntry ROYAL_GRINDSTONE = REGISTRATE - .menu("royal_grindstone", (type, id, inventory) -> - new RoyalGrindstoneMenu(type, id, inventory), () -> RoyalGrindstoneScreen::new) + .menu( + "royal_grindstone", + (type, id, inv) -> new RoyalGrindstoneMenu(type, id, inv), + () -> RoyalGrindstoneScreen::new + ) .register(); public static final MenuEntry ROYAL_ANVIL = REGISTRATE - .menu("royal_anvil", (type, id, inventory) -> - new RoyalAnvilMenu(id, inventory), () -> RoyalAnvilScreen::new) + .menu( + "royal_anvil", + (type, id, inv) -> new RoyalAnvilMenu(id, inv), + () -> RoyalAnvilScreen::new + ) .register(); public static final MenuEntry ROYAL_SMITHING = REGISTRATE - .menu("royal_smithing_table", (type, id, inventory) -> - new RoyalSmithingMenu(type, id, inventory), () -> RoyalSmithingScreen::new) + .menu( + "royal_smithing_table", + (type, id, inv) -> new RoyalSmithingMenu(type, id, inv), + () -> RoyalSmithingScreen::new + ) .register(); + public static final MenuEntry SLIDER = REGISTRATE + .menu( + "slider", + (menuType, containerId, inventory) -> new SliderMenu(menuType, containerId), + () -> SliderScreen::new + ) + .register(); public static void register() { } diff --git a/common/src/main/java/dev/dubhe/anvilcraft/init/ModNetworks.java b/common/src/main/java/dev/dubhe/anvilcraft/init/ModNetworks.java index 718fea6e2..06671e151 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/init/ModNetworks.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/init/ModNetworks.java @@ -2,8 +2,10 @@ import dev.dubhe.anvilcraft.AnvilCraft; import dev.dubhe.anvilcraft.api.network.Network; -import dev.dubhe.anvilcraft.network.MachineOutputDirectionPack; import dev.dubhe.anvilcraft.network.MachineEnableFilterPack; +import dev.dubhe.anvilcraft.network.MachineOutputDirectionPack; +import dev.dubhe.anvilcraft.network.SliderInitPack; +import dev.dubhe.anvilcraft.network.SliderUpdatePack; import dev.dubhe.anvilcraft.network.SlotDisableChangePack; import dev.dubhe.anvilcraft.network.SlotFilterChangePack; import net.minecraft.resources.ResourceLocation; @@ -21,6 +23,12 @@ public class ModNetworks { public static final ResourceLocation SLOT_FILTER_CHANGE_PACKET = Network .register(AnvilCraft.of("slot_filter_change"), SlotFilterChangePack.class, SlotFilterChangePack::new); + public static final ResourceLocation SLIDER_UPDATE = Network + .register(AnvilCraft.of("slider_update"), + SliderUpdatePack.class, SliderUpdatePack::new); + public static final ResourceLocation SLIDER_INIT = Network + .register(AnvilCraft.of("slider_init"), + SliderInitPack.class, SliderInitPack::new); public static void register() { } diff --git a/common/src/main/java/dev/dubhe/anvilcraft/inventory/SliderMenu.java b/common/src/main/java/dev/dubhe/anvilcraft/inventory/SliderMenu.java new file mode 100644 index 000000000..5c214ffcc --- /dev/null +++ b/common/src/main/java/dev/dubhe/anvilcraft/inventory/SliderMenu.java @@ -0,0 +1,60 @@ +package dev.dubhe.anvilcraft.inventory; + +import dev.dubhe.anvilcraft.init.ModMenuTypes; +import lombok.Getter; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@Getter +public class SliderMenu extends AbstractContainerMenu { + private final int min; + private final int max; + private final Update update; + + /** + * @param menuType 菜单类型 + * @param containerId 容器ID + */ + public SliderMenu(@Nullable MenuType menuType, int containerId) { + super(menuType, containerId); + this.min = 0; + this.max = 160; + this.update = null; + } + + /** + * @param containerId 容器ID + * @param update 更新回调 + */ + public SliderMenu(int containerId, int min, int max, Update update) { + super(ModMenuTypes.SLIDER.get(), containerId); + this.min = min; + this.max = max; + this.update = update; + } + + @Override + public @NotNull ItemStack quickMoveStack(@NotNull Player player, int index) { + Slot sourceSlot = slots.get(index); + //noinspection ConstantValue + if (sourceSlot == null || !sourceSlot.hasItem()) return ItemStack.EMPTY; + return sourceSlot.getItem(); + } + + @Override + public boolean stillValid(@NotNull Player player) { + return true; + } + + /** + * 滑条回调 + */ + public interface Update { + void update(int value); + } +} diff --git a/common/src/main/java/dev/dubhe/anvilcraft/network/SliderInitPack.java b/common/src/main/java/dev/dubhe/anvilcraft/network/SliderInitPack.java new file mode 100644 index 000000000..04726549e --- /dev/null +++ b/common/src/main/java/dev/dubhe/anvilcraft/network/SliderInitPack.java @@ -0,0 +1,61 @@ +package dev.dubhe.anvilcraft.network; + +import dev.dubhe.anvilcraft.api.network.Packet; +import dev.dubhe.anvilcraft.client.gui.screen.inventory.SliderScreen; +import dev.dubhe.anvilcraft.init.ModNetworks; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; + +public class SliderInitPack implements Packet { + private final int value; + private final int min; + private final int max; + + /** + * @param value 当前值 + * @param min 最小值 + * @param max 最大值 + */ + public SliderInitPack(int value, int min, int max) { + this.value = value; + this.min = min; + this.max = max; + } + + /** + * @param buf 缓冲区 + */ + public SliderInitPack(@NotNull FriendlyByteBuf buf) { + this.value = buf.readInt(); + this.min = buf.readInt(); + this.max = buf.readInt(); + } + + @Override + public ResourceLocation getType() { + return ModNetworks.SLIDER_INIT; + } + + @Override + public void encode(@NotNull FriendlyByteBuf buf) { + buf.writeInt(this.value); + buf.writeInt(this.min); + buf.writeInt(this.max); + } + + @Override + @Environment(EnvType.CLIENT) + public void handler() { + Minecraft client = Minecraft.getInstance(); + client.execute(() -> { + if (!(client.screen instanceof SliderScreen screen)) return; + screen.setMin(this.min); + screen.setMax(this.max); + screen.setValue(this.value); + }); + } +} diff --git a/common/src/main/java/dev/dubhe/anvilcraft/network/SliderUpdatePack.java b/common/src/main/java/dev/dubhe/anvilcraft/network/SliderUpdatePack.java new file mode 100644 index 000000000..c46e2f20f --- /dev/null +++ b/common/src/main/java/dev/dubhe/anvilcraft/network/SliderUpdatePack.java @@ -0,0 +1,42 @@ +package dev.dubhe.anvilcraft.network; + +import dev.dubhe.anvilcraft.api.network.Packet; +import dev.dubhe.anvilcraft.init.ModNetworks; +import dev.dubhe.anvilcraft.inventory.SliderMenu; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import org.jetbrains.annotations.NotNull; + +public class SliderUpdatePack implements Packet { + private final int value; + + public SliderUpdatePack(int value) { + this.value = value; + } + + public SliderUpdatePack(@NotNull FriendlyByteBuf buf) { + this.value = buf.readInt(); + } + + @Override + public ResourceLocation getType() { + return ModNetworks.SLIDER_UPDATE; + } + + @Override + public void encode(@NotNull FriendlyByteBuf buf) { + buf.writeInt(this.value); + } + + @Override + public void handler(@NotNull MinecraftServer server, ServerPlayer player) { + server.execute(() -> { + if (!player.hasContainerOpen()) return; + if (!(player.containerMenu instanceof SliderMenu menu)) return; + SliderMenu.Update update = menu.getUpdate(); + if (update != null) update.update(value); + }); + } +} diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/auto_crafter.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/background/auto_crafter.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/auto_crafter.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/background/auto_crafter.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/chute.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/background/chute.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/chute.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/background/chute.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_d.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_d.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_d.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_d.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_e.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_e.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_e.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_e.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_n.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_n.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_n.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_n.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_no.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_no.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_no.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_no.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_s.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_s.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_s.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_s.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_u.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_u.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_u.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_u.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_w.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_w.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_w.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_w.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/button_yes.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_yes.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/button_yes.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/button_yes.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/disabled_slot.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/disabled_slot.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/disabled_slot.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/machine/disabled_slot.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/background.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/background.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_add.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_add.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_add.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_add.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_max.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_max.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_max.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_max.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_min.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_min.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_min.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_min.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_minus.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_minus.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_button_minus.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/button_minus.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_slider.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/slider.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/slider_slider.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/slider/slider.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_anvil.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_anvil.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_anvil.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_anvil.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_grindstone.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_grindstone.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_grindstone.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_grindstone.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_smithing_table.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_smithing_table.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/royal_smithing_table.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/background/royal_smithing_table.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/error.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/error.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/error.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/error.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/text_field.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/text_field.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/text_field.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/text_field.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/text_field_disabled.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/text_field_disabled.png similarity index 100% rename from common/src/main/resources/assets/anvilcraft/textures/gui/container/text_field_disabled.png rename to common/src/main/resources/assets/anvilcraft/textures/gui/container/smithing/text_field_disabled.png diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_material.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_material.png deleted file mode 100644 index da98667a3b886d2f3b2ea2a9bcb0136222cf54c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 385 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3-pI!a4o{DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MXmupA+C|pF&2I`>6sahQT>AAs#4N2(yG=PT6*#diXt*P z{Gy8D;*ttFt_DV?Dn|b1mNxc|E}E86hA!DYegR^$F8@Eu4>ZZt=%Fo;y5#BN7*cU7 z=6pBbVFeD>fGc*}!w#o6L=!lPvcpkD{FT9s50*p_NLx1t(yB@rOjN% dc|5#DSr z1<%~X^wgl##FWaylc_d9MNR=eA+91aI`RsN7JfC6(J|?n8IDo?(yG=PT6*H*lKi5I zg5s)D(lQDD6S7?eq%L^6IEGZ*3Yico z)}p|}qTGFM!KUZ`!sqh2x&3BeC1-PKLh-pkiDJMPEmU;LRS`1^+Tb>8!Qi(_2Q{5DczIo2Ggr@o74aZKof z2S)`KpX$uHt;SvXzPD2-x##=DnjBs4sO$|h|8y&!ncq26L9XYc(NXnsJB_-Tho3Mg zvL8PCR%mX%nBcSehTC1~&Hvg9#0=k`?hugRce9j#VboI;+}I@U+@r<5Y29iadqy?} YZ6&#Qz24popx+ogUHx3vIVCg!0O9(GwEzGB diff --git a/common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_protocol.png b/common/src/main/resources/assets/anvilcraft/textures/gui/container/warning_protocol.png deleted file mode 100644 index 486626d6a6781987defac258d158d755d2f96b36..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3-pI!a4o{DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MIHe@A+C|pF&2I`>6sahQT>AAs#4N2(yG=PT6*#diXt*P z{Gy8D;*ttFt_DV?d|8uJjQq_lZR{OgG%cgVW?lY&l;6-L+s7{eXqaN>xuZbpq^FBx zNX4y~3z0&H6?m8fm?L+ouAEQ`@*w%q29o+eNlK z<;gwAl6s{B+zU%8a&B*9z9o1~_yy+_gLnK-xPQHSYf!EG`*v%-Cc`^ve-Q`k1Ftq4 z+;X(PkiTzn>*96uD(7wV@X~DQY7q!pHEC6(+nF<_-kTcVOYJD<`1ZSBTk$_H`wI66 zzXWxILmz(gH|?#q_K7?Fuj*;EQN!<3!jb{}8-D2Yly2bvGCM!x;fn6`S!z1^jBE_< XpOswR{bG{=dWyl*)z4*}Q$iB}(ItsX