Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.14.4-forge' into 1.15.2-forge
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Jun 27, 2024
2 parents d68cd8b + 64b202d commit 71ecbe5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/cam72cam/mod/gui/helpers/GUIHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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().getMainWindow().getScaledWidth();
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/cam72cam/mod/world/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 71ecbe5

Please sign in to comment.