Fixed some issues including line endings being wrong for the Linux scripts.

This commit is contained in:
Jackson Abney
2024-05-27 18:25:45 -08:00
parent deabaf56e8
commit a78710397e
8 changed files with 18 additions and 58 deletions

View File

@@ -101,10 +101,13 @@ dependencies {
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
}
System.setProperty("line.separator", "\n")
task packageScripts(type: Zip) {
archiveFileName = "scripts.zip"
destinationDirectory = file("$buildDir/resources/main/data/oc2/file_systems")
from "src/main/scripts"
filter { line -> line }
}
task copyLicensesToResources(type: Copy) {

View File

@@ -3,7 +3,6 @@
package li.cil.oc2.client.gui;
import com.mojang.blaze3d.platform.InputConstants;
import li.cil.oc2.client.gui.widget.ImageButton;
import li.cil.oc2.client.gui.widget.ToggleImageButton;
import li.cil.oc2.common.Constants;
import li.cil.oc2.common.container.AbstractMonitorContainer;
@@ -26,7 +25,7 @@ import static li.cil.oc2.common.util.TextFormatUtils.withFormat;
@OnlyIn(Dist.CLIENT)
public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorContainer> extends AbstractModContainerScreen<T> {
private static final int CONTROLS_TOP = 8;
private static final int ENERGY_TOP = CONTROLS_TOP + Sprites.SIDEBAR_3.height + 4;
private static final int ENERGY_TOP = CONTROLS_TOP + Sprites.MONITOR_SIDEBAR_1.height + 4;
private static boolean isInputCaptureEnabled;
@@ -37,8 +36,8 @@ public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorCont
protected AbstractMonitorDisplayScreen(final T container, final Inventory playerInventory, final Component title) {
super(container, playerInventory, title);
this.terminalWidget = new MonitorDisplayWidget(this);
imageWidth = Sprites.TERMINAL_SCREEN.width;
imageHeight = Sprites.TERMINAL_SCREEN.height;
imageWidth = Sprites.MONITOR_SCREEN.width;
imageHeight = Sprites.MONITOR_SCREEN.height;
}
///////////////////////////////////////////////////////////////////
@@ -98,7 +97,7 @@ public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorCont
setFocusIndicatorEditBox(focusIndicatorEditBox);
addRenderableWidget(new ToggleImageButton(
leftPos - Sprites.SIDEBAR_3.width + 4, topPos + CONTROLS_TOP + 4,
leftPos - Sprites.MONITOR_SIDEBAR_1.width + 4, topPos + CONTROLS_TOP + 4,
12, 12,
Sprites.POWER_BUTTON_BASE,
Sprites.POWER_BUTTON_PRESSED,
@@ -124,7 +123,7 @@ public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorCont
);
addRenderableWidget(new ToggleImageButton(
leftPos - Sprites.SIDEBAR_3.width + 4, topPos + CONTROLS_TOP + 4 + 14,
leftPos - Sprites.MONITOR_SIDEBAR_1.width + 4, topPos + CONTROLS_TOP + 4 + 14,
12, 12,
Sprites.INPUT_BUTTON_BASE,
Sprites.INPUT_BUTTON_PRESSED,
@@ -148,22 +147,6 @@ public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorCont
Component.translatable(Constants.TERMINAL_CAPTURE_INPUT_CAPTION),
Component.translatable(Constants.TERMINAL_CAPTURE_INPUT_DESCRIPTION)
);
addRenderableWidget(new ImageButton(
leftPos - Sprites.SIDEBAR_3.width + 4, topPos + CONTROLS_TOP + 4 + 14 + 14,
12, 12,
Sprites.INVENTORY_BUTTON_INACTIVE,
Sprites.INVENTORY_BUTTON_ACTIVE
) {
@Override
protected void updateWidgetNarration(final NarrationElementOutput narrationElementOutput) {
}
@Override
public void onPress() {
menu.switchToInventory();
}
}).withTooltip(Component.translatable(Constants.MACHINE_OPEN_INVENTORY_CAPTION));
}
@Override
@@ -194,7 +177,7 @@ public abstract class AbstractMonitorDisplayScreen<T extends AbstractMonitorCont
@Override
protected void renderBg(final GuiGraphics graphics, final float partialTicks, final int mouseX, final int mouseY) {
Sprites.SIDEBAR_3.draw(graphics, leftPos - Sprites.SIDEBAR_3.width, topPos + CONTROLS_TOP);
Sprites.MONITOR_SIDEBAR_1.draw(graphics, leftPos - Sprites.MONITOR_SIDEBAR_1.width, topPos + CONTROLS_TOP);
if (shouldRenderEnergyBar()) {
final int x = leftPos - Sprites.SIDEBAR_2.width;

View File

@@ -31,8 +31,8 @@ public final class MonitorDisplayWidget {
private static final int TERMINAL_X = MARGIN_SIZE;
private static final int TERMINAL_Y = MARGIN_SIZE;
public static final int WIDTH = Sprites.TERMINAL_SCREEN.width;
public static final int HEIGHT = Sprites.TERMINAL_SCREEN.height;
public static final int WIDTH = Sprites.MONITOR_SCREEN.width;
public static final int HEIGHT = Sprites.MONITOR_SCREEN.height;
///////////////////////////////////////////////////////////////////
@@ -52,7 +52,7 @@ public final class MonitorDisplayWidget {
public void renderBackground(final GuiGraphics graphics, final int mouseX, final int mouseY) {
isMouseOverTerminal = isMouseOverTerminal(mouseX, mouseY);
Sprites.TERMINAL_SCREEN.draw(graphics, leftPos, topPos);
Sprites.MONITOR_SCREEN.draw(graphics, leftPos, topPos);
if (shouldCaptureInput()) {
Sprites.TERMINAL_FOCUSED.draw(graphics, leftPos, topPos);
@@ -63,7 +63,7 @@ public final class MonitorDisplayWidget {
if (container.getPowerState() && container.isMounted() && container.hasPower()) {
final PoseStack terminalStack = new PoseStack();
terminalStack.translate(leftPos + TERMINAL_X, topPos + TERMINAL_Y, 0);
terminalStack.scale((Sprites.TERMINAL_SCREEN.width - 16f) / MonitorDevice.WIDTH, (Sprites.TERMINAL_SCREEN.height - 16f) / MonitorDevice.HEIGHT, 1f);
terminalStack.scale((Sprites.MONITOR_SCREEN.width - 16f) / MonitorDevice.WIDTH, (Sprites.MONITOR_SCREEN.height - 16f) / MonitorDevice.HEIGHT, 1f);
if (rendererView == null) {
rendererView = container.getMonitor().getMonitor().getRenderer(container.getMonitor());

View File

@@ -10,6 +10,7 @@ public final class Sprites {
public static final Sprite COMPUTER_CONTAINER = new Sprite(COMPUTER_CONTAINER_TEXTURE);
public static final Sprite ROBOT_CONTAINER = new Sprite(ROBOT_CONTAINER_TEXTURE);
public static final Sprite TERMINAL_SCREEN = new Sprite(TERMINAL_SCREEN_TEXTURE);
public static final Sprite MONITOR_SCREEN = new Sprite(MONITOR_SCREEN_TEXTURE);
public static final Sprite BUS_INTERFACE_SCREEN = new Sprite(BUS_INTERFACE_SCREEN_TEXTURE);
public static final Sprite NETWORK_INTERFACE_CARD_SCREEN = new Sprite(NETWORK_INTERFACE_CARD_SCREEN_TEXTURE);
public static final Sprite NETWORK_TUNNEL_SCREEN = new Sprite(NETWORK_TUNNEL_SCREEN_TEXTURE);
@@ -20,6 +21,7 @@ public final class Sprites {
public static final Sprite WARN_ICON = new Sprite(WARN_ICON_TEXTURE);
public static final Sprite HOTBAR = new Sprite(HOTBAR_TEXTURE);
public static final Sprite MONITOR_SIDEBAR_1 = new Sprite(MONITOR_SIDEBAR_1_TEXTURE);
public static final Sprite SIDEBAR_2 = new Sprite(SIDEBAR_2_TEXTURE);
public static final Sprite SIDEBAR_3 = new Sprite(SIDEBAR_3_TEXTURE);

View File

@@ -8,6 +8,7 @@ public final class Textures {
public static final Texture COMPUTER_CONTAINER_TEXTURE = new Texture("textures/gui/widget/computer_container.png", 176, 197);
public static final Texture ROBOT_CONTAINER_TEXTURE = new Texture("textures/gui/widget/robot_container.png", 176, 197);
public static final Texture TERMINAL_SCREEN_TEXTURE = new Texture("textures/gui/widget/terminal_screen.png", 336, 208);
public static final Texture MONITOR_SCREEN_TEXTURE = new Texture("textures/gui/widget/monitor_screen.png", 265, 208);
public static final Texture BUS_INTERFACE_SCREEN_TEXTURE = new Texture("textures/gui/widget/bus_interface_screen.png", 240, 30);
public static final Texture NETWORK_INTERFACE_CARD_SCREEN_TEXTURE = new Texture("textures/gui/widget/network_interface_card_screen.png", 176, 130);
public static final Texture NETWORK_TUNNEL_SCREEN_TEXTURE = new Texture("textures/gui/widget/network_tunnel_screen.png", 176, 197);
@@ -21,6 +22,7 @@ public final class Textures {
public static final Texture BLOCK_FACE_DISABLED_TEXTURE = new Texture("textures/gui/overlay/block_face_disabled.png", 16, 16);
public static final Texture HOTBAR_TEXTURE = new Texture("textures/gui/widget/hotbar.png", 224, 26);
public static final Texture MONITOR_SIDEBAR_1_TEXTURE = new Texture("textures/gui/widget/monitor_sidebar_1.png", 19, 32);
public static final Texture SIDEBAR_2_TEXTURE = new Texture("textures/gui/widget/sidebar_2.png", 19, 34);
public static final Texture SIDEBAR_3_TEXTURE = new Texture("textures/gui/widget/sidebar_3.png", 19, 48);

View File

@@ -162,8 +162,6 @@ public final class MonitorBlockEntity extends ModBlockEntity implements Tickable
if (level != null && !level.isClientSide() && level.isLoaded(getBlockPos())) {
if (this.isMounted && !isMounted) {
Arrays.fill(picture.getPlaneData(0), (byte) -128);
Arrays.fill(picture.getPlaneData(1), (byte) 0);
Arrays.fill(picture.getPlaneData(2), (byte) 0);
}
this.isMounted = isMounted;

View File

@@ -27,7 +27,7 @@ public final class ProjectorDevice extends IdentityProxy<BlockEntity> implements
private static final String BLOB_HANDLE_TAG_NAME = "blob";
public static final int WIDTH = 640;
public static final int HEIGHT = 360;
public static final int HEIGHT = 480;
///////////////////////////////////////////////////////////////

View File

@@ -15,8 +15,6 @@ import java.util.BitSet;
public final class SimpleFramebufferDevice implements MemoryMappedDevice {
public static final int STRIDE = 2;
private static final ThreadLocal<int[][]> conversionBuffer = ThreadLocal.withInitial(() -> new int[4][3]);
///////////////////////////////////////////////////////////////
private final int width, height;
@@ -69,31 +67,6 @@ public final class SimpleFramebufferDevice implements MemoryMappedDevice {
synchronized (buffer) {
convertR5G6B5ToYUV420J(buffer, width, height, picture);
/*final int[][] quadrant = conversionBuffer.get();
final byte[][] pictureData = picture.getData();
for (int halfRow = dirtyLines.nextSetBit(0); halfRow >= 0; halfRow = dirtyLines.nextSetBit(halfRow + 1)) {
dirtyLines.clear(halfRow);
final int row = halfRow * 2;
int bufferIndex = row * width * STRIDE, lumaIndex = row * width, chromaIndex = halfRow * (width / 2);
for (int halfCol = 0; halfCol < width / 2; halfCol++, bufferIndex += STRIDE * 2, lumaIndex += 2, chromaIndex++) {
r5g6b5ToYuv420(this.buffer.getShort(bufferIndex) & 0xFFFF, quadrant[0]);
pictureData[0][lumaIndex] = (byte) quadrant[0][0];
r5g6b5ToYuv420(this.buffer.getShort(bufferIndex + STRIDE) & 0xFFFF, quadrant[1]);
pictureData[0][lumaIndex + 1] = (byte) quadrant[1][0];
r5g6b5ToYuv420(this.buffer.getShort(bufferIndex + width * STRIDE) & 0xFFFF, quadrant[2]);
pictureData[0][lumaIndex + width] = (byte) quadrant[2][0];
r5g6b5ToYuv420(this.buffer.getShort(bufferIndex + width * STRIDE + STRIDE) & 0xFFFF, quadrant[3]);
pictureData[0][lumaIndex + width + 1] = (byte) quadrant[3][0];
// Average chroma values for quadrant.
pictureData[1][chromaIndex] = (byte) ((quadrant[0][1] + quadrant[1][1] + quadrant[2][1] + quadrant[3][1] + 2) >> 2);
pictureData[2][chromaIndex] = (byte) ((quadrant[0][2] + quadrant[1][2] + quadrant[2][2] + quadrant[3][2] + 2) >> 2);
}
}*/
}
return true;
@@ -117,7 +90,6 @@ public final class SimpleFramebufferDevice implements MemoryMappedDevice {
// Extract pixel data from ByteBuffer
short pixel = rgbBuffer.getShort(index * 2);
// Extract R, G, B from R5G6B5 with correct endianness
final int r5 = (pixel >>> 11) & 0b11111;
final int g6 = (pixel >>> 5) & 0b111111;
final int b5 = pixel & 0b11111;