diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b773c8f0..571c8b33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,13 @@ on: [workflow_dispatch] jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + branch: [1.7.10-forge, 1.10.2-forge, 1.11.2-forge, 1.12.2-forge, 1.14.4-forge, 1.15.2-forge, 1.16.5-forge] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} - uses: actions/setup-java@v1 with: java-version: '1.8' # The JDK version to make available on the path. diff --git a/src/main/java/cam72cam/mod/gui/helpers/GUIHelpers.java b/src/main/java/cam72cam/mod/gui/helpers/GUIHelpers.java index ef54fffb..d20e39a0 100644 --- a/src/main/java/cam72cam/mod/gui/helpers/GUIHelpers.java +++ b/src/main/java/cam72cam/mod/gui/helpers/GUIHelpers.java @@ -107,6 +107,18 @@ public static void drawTankBlock(int x, int y, int width, int height, Fluid flui } } + /** Draw a left-aligned shadowed string */ + public static void drawString(String text, int x, int y, int color) { + drawString(text, x, y, color, new Matrix4()); + } + public static void drawString(String text, int x, int y, int color, Matrix4 matrix) { + RenderState state = new RenderState().color(1, 1, 1, 1).alpha_test(true); + state.model_view().multiply(matrix); + try (With ctx = RenderContext.apply(state)) { + Minecraft.getInstance().fontRenderer.drawString(text, x, y, color); + } + } + /** Draw a shadowed string offset from the center of coords */ public static void drawCenteredString(String text, int x, int y, int color) { drawCenteredString(text, x, y, color, new Matrix4()); @@ -119,6 +131,11 @@ public static void drawCenteredString(String text, int x, int y, int color, Matr } } + /** Gat a string's internal width for further use */ + public static int getTextWidth(String text) { + return Minecraft.getInstance().fontRenderer.getStringWidth(text); + } + /** Screen Width in pixels (std coords) */ public static int getScreenWidth() { return Minecraft.getInstance().mainWindow.getScaledWidth(); diff --git a/src/main/java/cam72cam/mod/world/World.java b/src/main/java/cam72cam/mod/world/World.java index d398d472..08d2ed7c 100644 --- a/src/main/java/cam72cam/mod/world/World.java +++ b/src/main/java/cam72cam/mod/world/World.java @@ -469,12 +469,19 @@ public float getTemperature(Vec3i pos) { /** Drop a stack on the ground at pos */ public void dropItem(ItemStack stack, Vec3i pos) { - dropItem(stack, new Vec3d(pos)); + dropItem(stack, new Vec3d(pos), Vec3d.ZERO); } /** Drop a stack on the ground at pos */ public void dropItem(ItemStack stack, Vec3d pos) { - internal.addEntity(new ItemEntity(internal, pos.x, pos.y, pos.z, stack.internal)); + dropItem(stack, pos, Vec3d.ZERO); + } + + /** Drop a stack on the ground at pos with velocity */ + public void dropItem(ItemStack stack, Vec3d pos, Vec3d velocity) { + ItemEntity entity = new ItemEntity(internal, pos.x, pos.y, pos.z, stack.internal); + entity.setVelocity(velocity.x, velocity.y, velocity.z); + internal.addEntity(entity); } /** Check if the block is currently in a loaded chunk */