Skip to content

Commit

Permalink
Add heavy core block.
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaik committed Apr 1, 2024
1 parent 166c215 commit 459971e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ private static void addBlocks(Texture texture, String... names) {
Texture.crafterSouth, Texture.crafterSouthTriggered, Texture.crafterWest, Texture.crafterWestCrafting, Texture.crafterWestTriggered,
Texture.crafterTop, Texture.crafterTopCrafting, Texture.crafterTopTriggered, Texture.crafterBottom));
addBlock("vault", (name, tag) -> new Vault(tag.get("Properties").get("facing").stringValue("north"), tag.get("Properties").get("vault_state").stringValue("active")));
addBlock("heavy_core", (name, tag) -> new HeavyCore());
}

@Override
Expand Down
12 changes: 12 additions & 0 deletions chunky/src/java/se/llbit/chunky/block/minecraft/HeavyCore.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package se.llbit.chunky.block.minecraft;

import se.llbit.chunky.block.AbstractModelBlock;
import se.llbit.chunky.model.minecraft.HeavyCoreModel;
import se.llbit.chunky.resources.Texture;

public class HeavyCore extends AbstractModelBlock {
public HeavyCore() {
super("heavy_core", Texture.heavyCore);
this.model = new HeavyCoreModel();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package se.llbit.chunky.model.minecraft;

import se.llbit.chunky.model.QuadModel;
import se.llbit.chunky.resources.Texture;
import se.llbit.math.Quad;
import se.llbit.math.Vector3;
import se.llbit.math.Vector4;

public class HeavyCoreModel extends QuadModel {
private static final Texture[] textures = new Texture[]{
Texture.heavyCore, Texture.heavyCore, Texture.heavyCore,
Texture.heavyCore, Texture.heavyCore, Texture.heavyCore,
};

private static final Quad[] quads = new Quad[]{
new Quad(
new Vector3(4 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(12 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(4 / 16.0, 8 / 16.0, 4 / 16.0),
new Vector4(0 / 16.0, 8 / 16.0, 8 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(4 / 16.0, 0 / 16.0, 4 / 16.0),
new Vector3(12 / 16.0, 0 / 16.0, 4 / 16.0),
new Vector3(4 / 16.0, 0 / 16.0, 12 / 16.0),
new Vector4(8 / 16.0, 16 / 16.0, 8 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(4 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(4 / 16.0, 8 / 16.0, 4 / 16.0),
new Vector3(4 / 16.0, 0 / 16.0, 12 / 16.0),
new Vector4(8 / 16.0, 0 / 16.0, 8 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(12 / 16.0, 8 / 16.0, 4 / 16.0),
new Vector3(12 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(12 / 16.0, 0 / 16.0, 4 / 16.0),
new Vector4(8 / 16.0, 0 / 16.0, 8 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(4 / 16.0, 8 / 16.0, 4 / 16.0),
new Vector3(12 / 16.0, 8 / 16.0, 4 / 16.0),
new Vector3(4 / 16.0, 0 / 16.0, 4 / 16.0),
new Vector4(8 / 16.0, 0 / 16.0, 8 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(12 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(4 / 16.0, 8 / 16.0, 12 / 16.0),
new Vector3(12 / 16.0, 0 / 16.0, 12 / 16.0),
new Vector4(8 / 16.0, 0 / 16.0, 8 / 16.0, 0 / 16.0)
)
};

@Override
public Quad[] getQuads() {
return quads;
}

@Override
public Texture[] getTextures() {
return textures;
}
}
5 changes: 3 additions & 2 deletions chunky/src/java/se/llbit/chunky/resources/Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,7 @@ public class Texture {
public static final Texture chiseledBookshelfTop = new Texture();

public static final Texture[] chiseledBookshelfCombinations = new ChiseledBookshelfTexture[64];

static {
static {
for(int i = 0; i < chiseledBookshelfCombinations.length; i++) {
chiseledBookshelfCombinations[i] = new ChiseledBookshelfTexture(Texture.chiseledBookshelfEmpty, Texture.chiseledBookshelfOccupied,
i % 2 == 1, (i >> 1) % 2 == 1, (i >> 2) % 2 == 1, (i >> 3) % 2 == 1, (i >> 4) % 2 == 1, (i >> 5) % 2 == 1);
Expand Down Expand Up @@ -1472,6 +1471,8 @@ public class Texture {
public static final Texture decoratedPotPatternGuster = new Texture();
@TexturePath("assets/minecraft/textures/entity/decorated_pot/scrape_pottery_pattern")
public static final Texture decoratedPotPatternScrape = new Texture();
@TexturePath("assets/minecraft/textures/block/heavy_core")
public static final Texture heavyCore = new Texture();

/** Banner base texture. */
public static final Texture bannerBase = new Texture();
Expand Down

0 comments on commit 459971e

Please sign in to comment.