Skip to content

Commit

Permalink
ore template created, and some gem ores
Browse files Browse the repository at this point in the history
  • Loading branch information
kismama committed Jul 17, 2024
1 parent 693613e commit 85ac7ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
9 changes: 7 additions & 2 deletions src/util/Blocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Blocks {
public static bool[] translucentCache = new bool[MAXBLOCKS];
public static bool[] inventoryBlacklist = new bool[MAXBLOCKS];

public static readonly int maxBlock = 34;
public static readonly int maxBlock = 37;

public static Block register(Block block) {
return blocks[block.id] = block;
Expand Down Expand Up @@ -58,8 +58,10 @@ public static bool isBlacklisted(int block) {
public static Block BASALT = register(new Block(4, "Basalt", BlockModel.makeCube(Block.cubeUVs(4, 0))));
public static Block STONE = register(new Block(5, "Stone", BlockModel.makeCube(Block.cubeUVs(5, 0))));
public static Block GRAVEL = register(new Block(33, "Gravel", BlockModel.makeCube(Block.cubeUVs(15, 0))));
public static Block ORE = register(new Block(37, "Ore", BlockModel.makeCube(Block.cubeUVs(7, 0))));
public static Block HELLSTONE = register(new Block(34, "Hellstone", BlockModel.makeCube(Block.grassUVs(1, 1, 2, 1, 2, 1))).light(15));


public static Block GLASS = register(new Block(6, "Glass", BlockModel.makeCube(Block.cubeUVs(6, 0)))
.transparency()
);
Expand All @@ -73,12 +75,15 @@ public static bool isBlacklisted(int block) {

public static Block LOG = register(new Block(10, "Wooden Log", BlockModel.makeCube(Block.grassUVs(10, 0, 9, 0, 11, 0))));
public static Block LEAVES = register(new Block(11, "Leaves", BlockModel.makeCube(Block.cubeUVs(12, 0))).transparency());
public static Block MAPLELOG = register(new Block(35, "Maple Log", BlockModel.makeCube(Block.grassUVs(10, 1, 9, 1, 11, 1))));
public static Block MAPLELEAVES = register(new Block(36, "Maple Leaves", BlockModel.makeCube(Block.cubeUVs(12, 1))).transparency());

public static Block YELLOW_FLOWER = register(new Flower(12, "Yellow Flower", BlockModel.makeGrass(Block.crossUVs(13, 0)))).transparency().flowerAABB().noCollision();
public static Block RED_FLOWER = register(new Flower(13, "Red Flower", BlockModel.makeGrass(Block.crossUVs(14, 0)))).transparency().flowerAABB().noCollision();

public static Block LANTERN = register(new Block(14, "Lantern", BlockModel.makeCube(Block.grassUVs(15, 1, 13, 1, 14, 1))).light(15));
public static Block METAL_CUBE_BLUE = register(new Block(15, "Blue Metalish Block", BlockModel.makeCube(Block.cubeUVs(0, 1))));

public static Block METAL_CUBE_BLUE = register(new Block(15, "Blue Metal Block", BlockModel.makeCube(Block.cubeUVs(0, 1))));
public static Block CANDY_LIGHT_BLUE = register(new Block(16, "Light Blue Candy", BlockModel.makeCube(Block.cubeUVs(0, 2))));
public static Block CANDY_CYAN = register(new Block(17, "Cyan Candy", BlockModel.makeCube(Block.cubeUVs(1, 2))));
public static Block CANDY_TURQUOISE = register(new Block(18, "Turquoise Candy", BlockModel.makeCube(Block.cubeUVs(2, 2))));
Expand Down
37 changes: 18 additions & 19 deletions src/world/worldgen/OverworldChunkGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void generate(ChunkCoord coord) {
flatNoise *= mountainness * 64;
flatNoise += 64;
//Console.Out.WriteLine(flatNoise);

chunk.setBlockFast(x, 0, z, Blocks.HELLSTONE.id);
// hack until we can propagate them properly AND cheaply
chunk.setBlockLight(x, 0, z, Blocks.HELLSTONE.lightLevel);
Expand Down Expand Up @@ -105,32 +105,31 @@ public Random getRandom(ChunkCoord coord) {
private void placeTree(int x, int y, int z) {
var world = generator.world;
// tree
for (int i = 0; i < 7; i++) {
world.setBlock(x, y + i, z, Blocks.LOG.id);
for (int i = 0; i <= 6; i++) {
world.setBlock(x, y + i, z, Blocks.MAPLELOG.id);
}
// leaves, bottom
world.setBlock(x - 1, y + 3, z, Blocks.MAPLELEAVES.id);
world.setBlock(x + 1, y + 3, z, Blocks.MAPLELEAVES.id);
world.setBlock(x, y + 3, z - 1, Blocks.MAPLELEAVES.id);
world.setBlock(x, y + 3, z + 1, Blocks.MAPLELEAVES.id);
world.setBlock(x - 1, y + 6, z, Blocks.MAPLELEAVES.id);
world.setBlock(x + 1, y + 6, z, Blocks.MAPLELEAVES.id);
world.setBlock(x, y + 6, z - 1, Blocks.MAPLELEAVES.id);
world.setBlock(x, y + 6, z + 1, Blocks.MAPLELEAVES.id);
// leaves, thick
for (int x1 = -2; x1 <= 2; x1++) {
for (int z1 = -2; z1 <= 2; z1++) {
for (int x1 = -1; x1 <= 1; x1++) {
for (int z1 = -1; z1 <= 1; z1++) {
// don't overwrite the trunk
if (x1 == 0 && z1 == 0) {
continue;
}
for (int y1 = 4; y1 < 6; y1++) {
world.setBlock(x + x1, y + y1, z + z1, Blocks.LEAVES.id);
}
}
}
// leaves, thin on top
for (int x2 = -1; x2 <= 1; x2++) {
for (int z2 = -1; z2 <= 1; z2++) {
for (int y2 = 6; y2 <= 7; y2++) {
// don't overwrite the trunk
if (x2 == 0 && z2 == 0 && y2 == 6) {
continue;
}
world.setBlock(x + x2, y + y2, z + z2, Blocks.LEAVES.id);
for (int y1 = 4; y1 <= 5; y1++) {
world.setBlock(x + x1, y + y1, z + z1, Blocks.MAPLELEAVES.id);
}
}
}

world.setBlock(x, y + 7, z, Blocks.MAPLELEAVES.id);
}
}
Binary file modified textures/blocks.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 85ac7ba

Please sign in to comment.