Skip to content

Commit

Permalink
change ActiveWidget icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dphaldes committed Nov 26, 2023
1 parent d1df19f commit 7966b95
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class PaintingMachineScreen extends MachineScreen<PaintingMachineMenu> {
private static final ResourceLocation PAINTING_MACHINE_BG = EnderIO.loc("textures/gui/painting_machine.png");

public PaintingMachineScreen(PaintingMachineMenu pMenu, Inventory pPlayerInventory, Component pTitle) {
super(pMenu, pPlayerInventory, pTitle, true);
super(pMenu, pPlayerInventory, pTitle);
this.inventoryLabelY = this.imageHeight - 106;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ protected void init() {
addRenderableWidget(new EnumIconWidget<>(this, leftPos + imageWidth - 8 - 16, topPos + 105 , () -> menu.getBlockEntity().getRedstoneControl(),
control -> menu.getBlockEntity().setRedstoneControl(control), EIOLang.REDSTONE_MODE));

// FIX
addRenderableWidget(new ToggleImageButton<>(this, leftPos + imageWidth - 8 - 16 * 2 -2, topPos + 105, 16, 16, 0, 0, 16, 0, RANGE_BUTTON_TEXTURE,
addRenderableWidget(new ToggleImageButton<>(this, leftPos + imageWidth - 8 - 16 * 2 - 2, topPos + 105, 16, 16, 0, 0, 16, 0, RANGE_BUTTON_TEXTURE,
() -> menu.getBlockEntity().isRangeVisible(), state -> menu.getBlockEntity().setIsRangeVisible(state),
() -> menu.getBlockEntity().isRangeVisible() ? EIOLang.HIDE_RANGE : EIOLang.SHOW_RANGE));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.enderio.machines.client.gui.widget;

import com.enderio.EnderIO;
import com.enderio.api.misc.Vector2i;
import com.enderio.core.client.gui.screen.EIOScreen;
import com.enderio.core.client.gui.widgets.EIOWidget;
import com.enderio.machines.common.blockentity.MachineState;
import com.enderio.machines.common.blockentity.MachineStateType;
import com.enderio.machines.common.lang.MachineLang;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.GuiGraphics;
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;

Expand All @@ -19,20 +18,19 @@
import java.util.function.Supplier;

public class ActiveWidget extends EIOWidget {
protected static final ResourceLocation WIDGETS = EnderIO.loc("textures/gui/40/widgetsv2.png");
protected static final ResourceLocation WIDGETS = EnderIO.loc("textures/gui/icons/machine_states.png");

private final EIOScreen<?> displayOn;
private final Screen displayOn;
private final Supplier<Set<MachineState>> state;

public ActiveWidget(EIOScreen<?> displayOn, Supplier<Set<MachineState>> state, int x, int y) {
public ActiveWidget(Screen displayOn, Supplier<Set<MachineState>> state, int x, int y) {
super(x, y, 16, 16);
this.displayOn = displayOn;
this.state = state;
}

@Override
protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
displayOn.renderSimpleArea(guiGraphics, new Vector2i(getX(), getY()), new Vector2i(getX() + getWidth(), getY() + getHeight()));
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
MachineState prio = null;
Expand All @@ -41,7 +39,7 @@ protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, flo
prio = machineState;
}
}
guiGraphics.blit(WIDGETS, x, y, 0, prio == null ? 16 : prio.type().getPriority()*16, 28*16, width, height, 256, 256);
guiGraphics.blit(WIDGETS, x, y, 0, prio == null ? 16 : prio.type().getPriority() * 16, 0, width, height, 64, 16);

RenderSystem.disableDepthTest();
renderToolTip(guiGraphics, mouseX, mouseY);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7966b95

Please sign in to comment.