Skip to content

Commit

Permalink
alter grass texture
Browse files Browse the repository at this point in the history
  • Loading branch information
valoeghese committed May 15, 2020
1 parent 4b2beea commit b7c8009
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/tk/valoeghese/fc0/client/model/ChunkMesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ private static int index(int x, int y, int z) { // @see Chunk.index
static class RenderedTileFace {
RenderedTileFace(Vector3f offset, int faceAxis, Tile tile, float light) {
this.pos = offset;
this.u = tile.u;
this.v = tile.v;
this.u = tile.getU(faceAxis);
this.v = tile.getV(faceAxis);
this.f = faceAxis;
this.l = light;
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/tk/valoeghese/fc0/world/GrassTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package tk.valoeghese.fc0.world;

public class GrassTile extends Tile {
public GrassTile(int id) {
super(id, 1, 0);
}

@Override
public int getV(int faceAxis) {
return faceAxis == 1 ? 0 : 1;
}
}
14 changes: 11 additions & 3 deletions src/main/java/tk/valoeghese/fc0/world/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ public Tile(int id, int u, int v) {
}

public final byte id;
public final int u;
public final int v;
protected final int u;
protected final int v;
private boolean opaque = true;
private boolean render = true;

public int getU(int faceAxis) {
return this.u;
}

public int getV(int faceAxis) {
return this.v;
}

protected Tile dontRender() {
this.render = false;
this.cutout();
Expand All @@ -36,5 +44,5 @@ public boolean shouldRender() {
public static final Tile[] BY_ID = new Tile[256];
public static final Tile AIR = new Tile(0, 0, 0).dontRender();
public static final Tile STONE = new Tile(1, 0, 1);
public static final Tile GRASS = new Tile(2, 1, 0);
public static final Tile GRASS = new GrassTile(2);
}
Binary file modified src/main/resources/assets/texture/tile_atlas.png
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 b7c8009

Please sign in to comment.