Skip to content

Commit

Permalink
Fix issue building the texture atlas with textures under 16x16. (Fixe…
Browse files Browse the repository at this point in the history
…s chests)
  • Loading branch information
ThatRedox committed Aug 17, 2024
1 parent f9979a4 commit 0dadcce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ protected void buildTextures(Object2ObjectMap<Texture, TextureRecord> textures)

private static boolean insertTex(ArrayList<boolean[][]> layers, AtlasTexture tex) {
int l = 0;
int blockWidth = Math.max(1, tex.getWidth() / 16);
int blockHeight = Math.max(1, tex.getHeight() / 16);
for (boolean[][] layer : layers) {
for (int x = 0; x < 256; x++) {
for (int y = 0; y < 256; y++) {
if (insertAt(x, y, tex.getWidth()/16, tex.getHeight()/16, layer)) {
if (insertAt(x, y, blockWidth, blockHeight, layer)) {
tex.setLocation(x, y, l);
return true;
}
Expand Down

0 comments on commit 0dadcce

Please sign in to comment.