More sprites

This commit is contained in:
modmuss50 2023-06-01 12:13:14 +01:00
parent 80ee96051c
commit ed63c8908d
24 changed files with 110 additions and 84 deletions

View file

@ -32,6 +32,8 @@ import net.minecraft.client.gui.Selectable;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -42,6 +44,7 @@ import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import reborncore.api.blockentity.IUpgradeable; import reborncore.api.blockentity.IUpgradeable;
import reborncore.client.gui.config.GuiTab; import reborncore.client.gui.config.GuiTab;
import reborncore.client.gui.config.elements.GuiSpriteAtlasHolder;
import reborncore.client.gui.widget.GuiButtonHologram; import reborncore.client.gui.widget.GuiButtonHologram;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
@ -85,7 +88,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
x += this.x; x += this.x;
y += this.y; y += this.y;
} }
builder.drawSlot(drawContext, this, x - 1, y - 1); builder.drawSlot(drawContext, x - 1, y - 1);
} }
public void drawOutputSlotBar(DrawContext drawContext, int x, int y, int count, Layer layer) { public void drawOutputSlotBar(DrawContext drawContext, int x, int y, int count, Layer layer) {
@ -93,7 +96,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
x += this.x; x += this.x;
y += this.y; y += this.y;
} }
builder.drawOutputSlotBar(drawContext, this, x - 4, y - 4, count); builder.drawOutputSlotBar(drawContext, x - 4, y - 4, count);
} }
public void drawArmourSlots(DrawContext drawContext, int x, int y, Layer layer) { public void drawArmourSlots(DrawContext drawContext, int x, int y, Layer layer) {
@ -101,10 +104,10 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
x += this.x; x += this.x;
y += this.y; y += this.y;
} }
builder.drawSlot(drawContext, this, x - 1, y - 1); builder.drawSlot(drawContext, x - 1, y - 1);
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18); builder.drawSlot(drawContext, x - 1, y - 1 + 18);
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18 + 18); builder.drawSlot(drawContext, x - 1, y - 1 + 18 + 18);
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18 + 18 + 18); builder.drawSlot(drawContext, x - 1, y - 1 + 18 + 18 + 18);
} }
public void drawOutputSlot(DrawContext drawContext, int x, int y, Layer layer) { public void drawOutputSlot(DrawContext drawContext, int x, int y, Layer layer) {
@ -112,7 +115,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
x += this.x; x += this.x;
y += this.y; y += this.y;
} }
builder.drawOutputSlot(drawContext, this, x - 5, y - 5); builder.drawOutputSlot(drawContext, x - 5, y - 5);
} }
@Override @Override
@ -382,4 +385,21 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
public List<GuiTab> getTabs() { public List<GuiTab> getTabs() {
return tabs; return tabs;
} }
public static Sprite getSprite(SpriteIdentifier spriteIdentifier) {
return GuiSpriteAtlasHolder.INSTANCE.getSprite(spriteIdentifier.getTextureId());
}
public void drawSprite(DrawContext drawContext, SpriteIdentifier spriteIdentifier, int x, int y) {
final Sprite sprite = getSprite(spriteIdentifier);
drawContext.drawSprite(
x,
y,
0,
sprite.getContents().getWidth(),
sprite.getContents().getHeight(),
sprite
);
}
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.EntryListWidget; import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -39,6 +40,7 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.client.gui.config.GuiTab; import reborncore.client.gui.config.GuiTab;
import reborncore.client.gui.config.elements.GuiSprites;
import reborncore.common.fluid.FluidUtils; import reborncore.common.fluid.FluidUtils;
import reborncore.common.fluid.FluidValue; import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance; import reborncore.common.fluid.container.FluidInstance;
@ -54,21 +56,8 @@ import java.util.stream.Collectors;
* Created by Gigabit101 on 08/08/2016. * Created by Gigabit101 on 08/08/2016.
*/ */
public class GuiBuilder { public class GuiBuilder {
public static final Identifier defaultTextureSheet = new Identifier("reborncore", "textures/gui/guielements.png");
private static final Text SPACE_TEXT = Text.literal(" "); private static final Text SPACE_TEXT = Text.literal(" ");
static Identifier resourceLocation; public static final Identifier resourceLocation = new Identifier("reborncore", "textures/gui/guielements.png");
public GuiBuilder() {
GuiBuilder.resourceLocation = defaultTextureSheet;
}
public GuiBuilder(Identifier resourceLocation) {
GuiBuilder.resourceLocation = resourceLocation;
}
public Identifier getResourceLocation() {
return resourceLocation;
}
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) { public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
drawContext.drawTexture(resourceLocation, x, y, 0, 0, width / 2, height / 2); drawContext.drawTexture(resourceLocation, x, y, 0, 0, width / 2, height / 2);
@ -78,6 +67,19 @@ public class GuiBuilder {
height / 2); height / 2);
} }
public void drawSprite(DrawContext drawContext, SpriteIdentifier spriteIdentifier, int x, int y) {
final Sprite sprite = GuiBase.getSprite(spriteIdentifier);
drawContext.drawSprite(
x,
y,
0,
sprite.getContents().getWidth(),
sprite.getContents().getHeight(),
sprite
);
}
public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) { public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) {
if (center) { if (center) {
posX -= 81; posX -= 81;
@ -85,17 +87,17 @@ public class GuiBuilder {
for (int y = 0; y < 3; y++) { for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) { for (int x = 0; x < 9; x++) {
drawContext.drawTexture(resourceLocation, posX + x * 18, posY + y * 18, 150, 0, 18, 18); drawSlot(drawContext,posX + x * 18, posY + y * 18);
} }
} }
for (int x = 0; x < 9; x++) { for (int x = 0; x < 9; x++) {
drawContext.drawTexture(resourceLocation, posX + x * 18, posY + 58, 150, 0, 18, 18); drawSlot(drawContext, posX + x * 18, posY + 58);
} }
} }
public void drawSlot(DrawContext drawContext, Screen gui, int posX, int posY) { public void drawSlot(DrawContext drawContext,int posX, int posY) {
drawContext.drawTexture(resourceLocation, posX, posY, 150, 0, 18, 18); drawSprite(drawContext, GuiSprites.SLOT, posX, posY);
} }
public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) { public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) {
@ -110,8 +112,8 @@ public class GuiBuilder {
} }
} }
public void drawOutputSlot(DrawContext drawContext, GuiBase<?> gui, int x, int y) { public void drawOutputSlot(DrawContext drawContext, int x, int y) {
drawContext.drawTexture(resourceLocation, x, y, 174, 0, 26, 26); drawSprite(drawContext, GuiSprites.OUTPUT_SLOT, x, y);
} }
/** /**
@ -131,7 +133,8 @@ public class GuiBuilder {
x += gui.getGuiLeft(); x += gui.getGuiLeft();
y += gui.getGuiTop(); y += gui.getGuiTop();
} }
drawContext.drawTexture(resourceLocation, x, y, 174, 26 + (locked ? 12 : 0), 20, 12);
drawSprite(drawContext, locked ? GuiSprites.BUTTON_LOCKED : GuiSprites.BUTTON_UNLOCKED, x, y);
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
if (locked) { if (locked) {
@ -160,9 +163,9 @@ public class GuiBuilder {
y += gui.getGuiTop(); y += gui.getGuiTop();
} }
if (gui.getMachine().renderMultiblock) { if (gui.getMachine().renderMultiblock) {
drawContext.drawTexture(resourceLocation, x, y, 174, 62, 20, 12); drawSprite(drawContext, GuiSprites.BUTTON_HOLOGRAM_ENABLED, x, y);
} else { } else {
drawContext.drawTexture(resourceLocation, x, y, 174, 50, 20, 12); drawSprite(drawContext, GuiSprites.BUTTON_HOLOGRAM_DISABLED, x, y);
} }
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
@ -322,7 +325,7 @@ public class GuiBuilder {
* @param y {@code int} Top left corner where to place slots * @param y {@code int} Top left corner where to place slots
*/ */
public void drawUpgrades(DrawContext drawContext, GuiBase<?> gui, int x, int y) { public void drawUpgrades(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
drawContext.drawTexture(resourceLocation, x, y, 217, 0, 24, 81); drawSprite(drawContext, GuiSprites.UPGRADES, x, y);
} }
/** /**
@ -334,7 +337,7 @@ public class GuiBuilder {
* @param stack {@link ItemStack} Item to show as tab icon * @param stack {@link ItemStack} Item to show as tab icon
*/ */
public void drawSlotTab(DrawContext drawContext, GuiBase<?> gui, int x, int y, ItemStack stack) { public void drawSlotTab(DrawContext drawContext, GuiBase<?> gui, int x, int y, ItemStack stack) {
drawContext.drawTexture(resourceLocation, x, y, 217, 82, 24, 24); drawSprite(drawContext, GuiSprites.SLOT_TAB, x, y);
drawContext.drawItem(stack, x + 5, y + 4); drawContext.drawItem(stack, x + 5, y + 4);
} }
@ -592,11 +595,11 @@ public class GuiBuilder {
amount = fluid.getAmount(); amount = fluid.getAmount();
percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue()); percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue());
} }
drawContext.drawTexture(resourceLocation, x, y, 194, 26, 22, 56); drawSprite(drawContext, GuiSprites.TANK_BACKGROUND, x, y);
if (!isTankEmpty) { if (!isTankEmpty) {
drawFluid(drawContext, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue()); drawFluid(drawContext, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue());
} }
drawContext.drawTexture(resourceLocation, x + 3, y + 3, 194, 82, 16, 50); drawSprite(drawContext, GuiSprites.TANK_FOREGROUND, x + 3, y + 3);
if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
@ -704,19 +707,18 @@ public class GuiBuilder {
/** /**
* Draws bar containing output slots * Draws bar containing output slots
* *
* @param gui {@link GuiBase} The GUI to draw on
* @param x {@code int} Top left corner where to place slots bar * @param x {@code int} Top left corner where to place slots bar
* @param y {@code int} Top left corner where to place slots bar * @param y {@code int} Top left corner where to place slots bar
* @param count {@code int} Number of output slots * @param count {@code int} Number of output slots
*/ */
public void drawOutputSlotBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int count) { public void drawOutputSlotBar(DrawContext drawContext, int x, int y, int count) {
drawContext.drawTexture(resourceLocation, x, y, 150, 122, 3, 26); drawSprite(drawContext, GuiSprites.SLOT_BAR_RIGHT, x, y);
x += 3; x += 3;
for (int i = 1; i <= count; i++) { for (int i = 1; i <= count; i++) {
drawContext.drawTexture(resourceLocation, x, y, 150 + 3, 122, 20, 26); drawSprite(drawContext, GuiSprites.SLOT_BAR_CENTER, x, y);
x += 20; x += 20;
} }
drawContext.drawTexture(resourceLocation, x, y, 150 + 23, 122, 3, 26); drawSprite(drawContext, GuiSprites.SLOT_BAR_LEFT, x, y);
} }
protected int percentage(long MaxValue, long CurrentValue) { protected int percentage(long MaxValue, long CurrentValue) {

View file

@ -26,7 +26,6 @@ package reborncore.client.gui.config.elements;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.GuiBase; import reborncore.client.gui.GuiBase;
@ -60,11 +59,11 @@ public class ElementBase {
} }
public int getWidth() { public int getWidth() {
return getGuiSprite(sprite).getContents().getWidth(); return GuiBase.getSprite(sprite).getContents().getWidth();
} }
public int getHeight() { public int getHeight() {
return getGuiSprite(sprite).getContents().getHeight(); return GuiBase.getSprite(sprite).getContents().getHeight();
} }
public boolean onClick(GuiBase<?> gui, double mouseX, double mouseY) { public boolean onClick(GuiBase<?> gui, double mouseX, double mouseY) {
@ -94,26 +93,13 @@ public class ElementBase {
} }
public void drawSprite(DrawContext drawContext, GuiBase<?> gui, SpriteIdentifier spriteIdentifier, int x, int y) { public void drawSprite(DrawContext drawContext, GuiBase<?> gui, SpriteIdentifier spriteIdentifier, int x, int y) {
final Sprite sprite = getGuiSprite(spriteIdentifier); gui.drawSprite(drawContext, spriteIdentifier, x + gui.getGuiLeft(), y + gui.getGuiTop());
drawContext.drawSprite(
x + gui.getGuiLeft(),
y + gui.getGuiTop(),
0,
sprite.getContents().getWidth(),
sprite.getContents().getHeight(),
sprite
);
} }
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) { public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, 0, 0, width / 2, height / 2); drawContext.drawTexture(GuiBuilder.resourceLocation, x, y, 0, 0, width / 2, height / 2);
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2); drawContext.drawTexture(GuiBuilder.resourceLocation, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2); drawContext.drawTexture(GuiBuilder.resourceLocation, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2); drawContext.drawTexture(GuiBuilder.resourceLocation, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2);
}
private Sprite getGuiSprite(SpriteIdentifier spriteIdentifier) {
return GuiSpriteAtlasHolder.INSTANCE.getSprite(sprite.getTextureId());
} }
} }

View file

@ -28,7 +28,6 @@ import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public final class GuiSprites { public final class GuiSprites {
public static final SpriteIdentifier SLOT_NORMAL = create("slot_normal");
public static final SpriteIdentifier CHARGE_SLOT_ICON = create("charge_slot_icon"); public static final SpriteIdentifier CHARGE_SLOT_ICON = create("charge_slot_icon");
public static final SpriteIdentifier DISCHARGE_SLOT_ICON = create("discharge_slot_icon"); public static final SpriteIdentifier DISCHARGE_SLOT_ICON = create("discharge_slot_icon");
public static final SpriteIdentifier ENERGY_BAR = create("energy_bar"); public static final SpriteIdentifier ENERGY_BAR = create("energy_bar");
@ -46,6 +45,23 @@ public final class GuiSprites {
public static final SpriteIdentifier FAKE_SLOT = create("fake_slot"); public static final SpriteIdentifier FAKE_SLOT = create("fake_slot");
public static final SpriteIdentifier BUTTON_HOVER_OVERLAY_SLOT_NORMAL = create("button_hover_overlay_slot_normal"); public static final SpriteIdentifier BUTTON_HOVER_OVERLAY_SLOT_NORMAL = create("button_hover_overlay_slot_normal");
public static final SpriteIdentifier SLOT_CONFIG_POPUP = create("slot_config_popup"); public static final SpriteIdentifier SLOT_CONFIG_POPUP = create("slot_config_popup");
public static final SpriteIdentifier FAST_FORWARD = create("fast_forward");
public static final SpriteIdentifier FORWARD = create("forward");
public static final SpriteIdentifier REWIND = create("rewind");
public static final SpriteIdentifier FAST_REWIND = create("fast_rewind");
public static final SpriteIdentifier SLOT = create("slot");
public static final SpriteIdentifier OUTPUT_SLOT = create("output_slot");
public static final SpriteIdentifier BUTTON_UNLOCKED = create("button_unlocked");
public static final SpriteIdentifier BUTTON_LOCKED = create("button_locked");
public static final SpriteIdentifier BUTTON_HOLOGRAM_ENABLED = create("button_hologram_enabled");
public static final SpriteIdentifier BUTTON_HOLOGRAM_DISABLED = create("button_hologram_disabled");
public static final SpriteIdentifier SLOT_TAB = create("slot_tab");
public static final SpriteIdentifier UPGRADES = create("upgrades");
public static final SpriteIdentifier TANK_BACKGROUND = create("tank_background");
public static final SpriteIdentifier TANK_FOREGROUND = create("tank_foreground");
public static final SpriteIdentifier SLOT_BAR_RIGHT = create("slot_bar_right");
public static final SpriteIdentifier SLOT_BAR_CENTER = create("slot_bar_center");
public static final SpriteIdentifier SLOT_BAR_LEFT = create("slot_bar_left");
public static final SpriteIdentifier EXIT_BUTTON_NORMAL = create("exit_button_normal"); public static final SpriteIdentifier EXIT_BUTTON_NORMAL = create("exit_button_normal");
public static final SpriteIdentifier EXIT_BUTTON_HOVERED = create("exit_button_hovered"); public static final SpriteIdentifier EXIT_BUTTON_HOVERED = create("exit_button_hovered");

View file

@ -27,7 +27,7 @@ package reborncore.client.gui.config.elements;
import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.client.util.SpriteIdentifier;
public enum SlotType { public enum SlotType {
NORMAL(1, 1, GuiSprites.SLOT_NORMAL, GuiSprites.BUTTON_SLOT_NORMAL, GuiSprites.BUTTON_HOVER_OVERLAY_SLOT_NORMAL); NORMAL(1, 1, GuiSprites.SLOT, GuiSprites.BUTTON_SLOT_NORMAL, GuiSprites.BUTTON_HOVER_OVERLAY_SLOT_NORMAL);
int slotOffsetX; int slotOffsetX;
int slotOffsetY; int slotOffsetY;

View file

@ -26,16 +26,17 @@ package reborncore.client.gui.widget;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.GuiBase; import reborncore.client.gui.GuiBase;
import reborncore.client.gui.config.elements.GuiSprites;
/** /**
* @author drcrazy * @author drcrazy
*/ */
public class GuiButtonUpDown extends GuiButtonExtended { public class GuiButtonUpDown extends GuiButtonExtended {
private final GuiBase<?> gui;
GuiBase<?> gui; private final UpDownButtonType type;
UpDownButtonType type;
public GuiButtonUpDown(int x, int y, GuiBase<?> gui, ButtonWidget.PressAction pressAction, UpDownButtonType type) { public GuiButtonUpDown(int x, int y, GuiBase<?> gui, ButtonWidget.PressAction pressAction, UpDownButtonType type) {
super(x, y, 12, 12, Text.empty(), pressAction); super(x, y, 12, 12, Text.empty(), pressAction);
@ -46,18 +47,19 @@ public class GuiButtonUpDown extends GuiButtonExtended {
@Override @Override
public void renderButton(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) { public void renderButton(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
switch (type) { gui.drawSprite(drawContext, type.spriteIdentifier, getX(), getY());
case FASTFORWARD -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 74, 12, 12);
case FORWARD -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 86, 12, 12);
case REWIND -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 98, 12, 12);
case FASTREWIND -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 110, 12, 12);
}
} }
public enum UpDownButtonType { public enum UpDownButtonType {
FASTFORWARD, FASTFORWARD(GuiSprites.FAST_FORWARD),
FORWARD, FORWARD(GuiSprites.FORWARD),
REWIND, REWIND(GuiSprites.REWIND),
FASTREWIND FASTREWIND(GuiSprites.FAST_REWIND);
private final SpriteIdentifier spriteIdentifier;
UpDownButtonType(SpriteIdentifier spriteIdentifier) {
this.spriteIdentifier = spriteIdentifier;
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View file

@ -270,17 +270,17 @@ public class ReiPlugin implements REIClientPlugin {
public static Widget createProgressBar(int x, int y, double animationDuration, GuiBuilder.ProgressDirection direction) { public static Widget createProgressBar(int x, int y, double animationDuration, GuiBuilder.ProgressDirection direction) {
return Widgets.createDrawableWidget((drawContext, mouseX, mouseY, delta) -> { return Widgets.createDrawableWidget((drawContext, mouseX, mouseY, delta) -> {
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.x, direction.y, direction.width, direction.height); drawContext.drawTexture(GuiBuilder.resourceLocation, x, y, direction.x, direction.y, direction.width, direction.height);
int j = (int) ((System.currentTimeMillis() / animationDuration) % 1.0 * 16.0); int j = (int) ((System.currentTimeMillis() / animationDuration) % 1.0 * 16.0);
if (j < 0) { if (j < 0) {
j = 0; j = 0;
} }
switch (direction) { switch (direction) {
case RIGHT -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.xActive, direction.yActive, j, 10); case RIGHT -> drawContext.drawTexture(GuiBuilder.resourceLocation, x, y, direction.xActive, direction.yActive, j, 10);
case LEFT -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10); case LEFT -> drawContext.drawTexture(GuiBuilder.resourceLocation, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
case UP -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j); case UP -> drawContext.drawTexture(GuiBuilder.resourceLocation, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
case DOWN -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.xActive, direction.yActive, 10, j); case DOWN -> drawContext.drawTexture(GuiBuilder.resourceLocation, x, y, direction.xActive, direction.yActive, 10, j);
} }
}); });
} }
@ -313,14 +313,14 @@ public class ReiPlugin implements REIClientPlugin {
int innerHeight = height - 2; int innerHeight = height - 2;
PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower(); PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower();
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 1, bounds.y - 1, displayPower.xBar - 15, displayPower.yBar - 1, width, height); drawContext.drawTexture(GuiBuilder.resourceLocation, bounds.x - 1, bounds.y - 1, displayPower.xBar - 15, displayPower.yBar - 1, width, height);
int innerDisplayHeight; int innerDisplayHeight;
if (animation.animationType != EntryAnimationType.NONE) { if (animation.animationType != EntryAnimationType.NONE) {
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) innerHeight) % innerHeight)); innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) innerHeight) % innerHeight));
if (animation.animationType == EntryAnimationType.DOWNWARDS) if (animation.animationType == EntryAnimationType.DOWNWARDS)
innerDisplayHeight = innerHeight - innerDisplayHeight; innerDisplayHeight = innerHeight - innerDisplayHeight;
} else innerDisplayHeight = innerHeight; } else innerDisplayHeight = innerHeight;
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, bounds.x, bounds.y + innerHeight - innerDisplayHeight, displayPower.xBar, innerHeight + displayPower.yBar - innerDisplayHeight, width - 2, innerDisplayHeight); drawContext.drawTexture(GuiBuilder.resourceLocation, bounds.x, bounds.y + innerHeight - innerDisplayHeight, displayPower.xBar, innerHeight + displayPower.yBar - innerDisplayHeight, width - 2, innerDisplayHeight);
} }
@Override @Override
@ -344,8 +344,8 @@ public class ReiPlugin implements REIClientPlugin {
int width = bounds.width; int width = bounds.width;
int height = bounds.height; int height = bounds.height;
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 4, bounds.y - 4, 194, 26, width + 8, height + 8); drawContext.drawTexture(GuiBuilder.resourceLocation, bounds.x - 4, bounds.y - 4, 194, 26, width + 8, height + 8);
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 1, bounds.y - 1, 194, 82, width + 2, height + 2); drawContext.drawTexture(GuiBuilder.resourceLocation, bounds.x - 1, bounds.y - 1, 194, 82, width + 2, height + 2);
int innerDisplayHeight; int innerDisplayHeight;
if (animation.animationType != EntryAnimationType.NONE) { if (animation.animationType != EntryAnimationType.NONE) {
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) height) % height)); innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) height) % height));