diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index 400ec4e..cfbf87f 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -1,13 +1,11 @@ package com.github.halotroop.litecraft.types.block; -import java.util.*; - import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { - public static List blocks = new ArrayList(); + public static Block[] blocks = new Block[255];//real number is 256 //TODO: get all mods to say how many blocks they have and increace the number by that public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.04f)); diff --git a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java index e1417ac..f1cc93c 100644 --- a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java +++ b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java @@ -108,6 +108,20 @@ public class Loader public int createBlockAtlas() { + int width = 16; + int height = 16; + //Prepare the atlas texture and gen it + int atlasId = GL11.glGenTextures(); + //Bind it to openGL + GL11.glBindTexture(GL11.GL_TEXTURE_2D, atlasId); + //Apply the settings for the texture + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + //Fill the image with blank image data + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width*2, height*2, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null); + + int maxX = Blocks.blocks.length/2;//if the block list gets too big just increace the 2 by 4 or somthing to account for it + for(Block block: Blocks.blocks) { }