From d02d56d01b3227bb9e9868a420232452c593474f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 10 May 2016 15:08:12 +1000 Subject: [PATCH] Textures array should be bytes not ints. --- ClassicalSharp/Blocks/BlockInfo.Atlas.cs | 12 ++++++------ ClassicalSharp/TexturePack/TerrainAtlas1D.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ClassicalSharp/Blocks/BlockInfo.Atlas.cs b/ClassicalSharp/Blocks/BlockInfo.Atlas.cs index 255cd3d9e..c3acc6f04 100644 --- a/ClassicalSharp/Blocks/BlockInfo.Atlas.cs +++ b/ClassicalSharp/Blocks/BlockInfo.Atlas.cs @@ -6,7 +6,7 @@ namespace ClassicalSharp { /// Stores various properties about the blocks in Minecraft Classic. public partial class BlockInfo { - internal int[] textures = new int[BlocksCount * Side.Sides]; + internal byte[] textures = new byte[BlocksCount * Side.Sides]; void SetupTextures() { // Row 1 @@ -67,23 +67,23 @@ namespace ClassicalSharp { void SetAll( int textureId, Block blockId ) { int index = (byte)blockId * Side.Sides; for( int i = index; i < index + Side.Sides; i++ ) { - textures[i] = textureId; + textures[i] = (byte)textureId; } } internal void SetSide( int textureId, Block blockId ) { int index = (byte)blockId * Side.Sides; for( int i = index; i < index + Side.Bottom; i++ ) - textures[i] = textureId; + textures[i] = (byte)textureId; } internal void SetTopAndBottom( int textureId, Block blockId ) { - textures[(byte)blockId * Side.Sides + Side.Bottom] = textureId; - textures[(byte)blockId * Side.Sides + Side.Top] = textureId; + textures[(byte)blockId * Side.Sides + Side.Bottom] = (byte)textureId; + textures[(byte)blockId * Side.Sides + Side.Top] = (byte)textureId; } internal void SetTex( int textureId, int face, Block blockId ) { - textures[(byte)blockId * Side.Sides + face] = textureId; + textures[(byte)blockId * Side.Sides + face] = (byte)textureId; } int texId; diff --git a/ClassicalSharp/TexturePack/TerrainAtlas1D.cs b/ClassicalSharp/TexturePack/TerrainAtlas1D.cs index eae72b382..46daa1a41 100644 --- a/ClassicalSharp/TexturePack/TerrainAtlas1D.cs +++ b/ClassicalSharp/TexturePack/TerrainAtlas1D.cs @@ -84,7 +84,7 @@ namespace ClassicalSharp.TexturePack { return Utils.CeilDiv( totalElements, verElements ); } - int GetMaxUsedRow( int[] textures ) { + int GetMaxUsedRow( byte[] textures ) { int maxElem = 0; for( int i = 0; i < textures.Length; i++ ) maxElem = Math.Max( maxElem, textures[i] );