Skip to content

Commit

Permalink
Add 24w40a blocks and pale garden biome (#1786)
Browse files Browse the repository at this point in the history
* Add pale garden biome, pale oak leaves, pale oak logs, pale moss block and pale hanging moss.

* Add missing pale oak blocks.

* Add pale moss carpet.

* Add creaking heart block.
  • Loading branch information
leMaik authored Oct 27, 2024
1 parent d9fe92f commit c4b66a6
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 1 deletion.
34 changes: 34 additions & 0 deletions chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import se.llbit.chunky.entity.SkullEntity;
import se.llbit.chunky.model.minecraft.FlowerPotModel;
import se.llbit.chunky.model.minecraft.FlowerPotModel.Kind;
import se.llbit.chunky.model.minecraft.PaleMossCarpetModel;
import se.llbit.chunky.resources.ShulkerTexture;
import se.llbit.chunky.resources.Texture;
import se.llbit.nbt.ListTag;
Expand Down Expand Up @@ -1122,6 +1123,39 @@ private static void addBlocks(Texture texture, String... names) {
addBlock("vault", (name, tag) -> new Vault(tag.get("Properties").get("facing").stringValue("north"), tag.get("Properties").get("ominous").stringValue().equals("true"), tag.get("Properties").get("vault_state").stringValue("active")));
addBlock("heavy_core", (name, tag) -> new HeavyCore());
addBlock("trial_spawner", (name, tag) -> new TrialSpawner(tag.get("Properties").get("ominous").stringValue().equals("true"), tag.get("Properties").get("trial_spawner_state").stringValue("active")));

// Winter drop (1.22?)
addBlock("pale_moss_block", Texture.paleMossBlock);
addBlock("pale_oak_leaves", (name, tag) -> new UntintedLeaves(name, Texture.paleOakLeaves));
addBlock("pale_oak_log", (name, tag) -> log(tag, Texture.paleOakLog, Texture.paleOakLogTop));
addBlock("pale_hanging_moss", (name, tag) -> new SpriteBlock(name, tag.get("Properties").get("tip").stringValue().equals("true") ? Texture.paleHangingMossTip : Texture.paleHangingMoss));
addBlock("pale_oak_button", (name, tag) -> button(tag, Texture.paleOakPlanks));
addBlock("pale_oak_planks", Texture.paleOakPlanks);
addBlock("pale_oak_slab", (name, tag) -> slab(tag, Texture.paleOakPlanks));
addBlock("pale_oak_stairs", (name, tag) -> stairs(tag, Texture.paleOakPlanks));
addBlock("pale_oak_pressure_plate", (name, tag) -> new PressurePlate(name, Texture.sprucePlanks));
addBlock("pale_oak_fence", (name, tag) -> fence(tag, Texture.paleOakPlanks));
addBlock("pale_oak_fence_gate", (name, tag) -> fenceGate(tag, Texture.paleOakPlanks));
addBlock("pale_oak_trapdoor", (name, tag) -> orientableTrapdoor(tag, Texture.paleOakTrapdoor));
addBlock("pale_oak_door", (name, tag) -> door(tag, Texture.paleOakDoorTop, Texture.paleOakDoorBottom));
addBlock("stripped_pale_oak_log", (name, tag) -> log(tag, Texture.strippedPaleOakLog, Texture.strippedPaleOakLogTop));
addBlock("stripped_pale_oak_wood", (name, tag) -> log(tag, Texture.strippedPaleOakLog, Texture.strippedPaleOakLog));
addBlock("pale_oak_wood", (name, tag) -> log(tag, Texture.paleOakLog, Texture.paleOakLog));
addBlock("pale_oak_sapling", (name, tag) -> new SpriteBlock(name, Texture.paleOakSapling));
addBlock("potted_pale_oak_sapling", (name, tag) -> new FlowerPot(name, FlowerPotModel.Kind.PALE_OAK_SAPLING));
addBlock("pale_oak_sign", (name, tag) -> sign(tag, "pale_oak"));
addBlock("pale_oak_wall_sign", (name, tag) -> wallSign(tag, "pale_oak"));
addBlock("pale_oak_hanging_sign", (name, tag) -> hangingSign(tag, "pale_oak"));
addBlock("pale_oak_wall_hanging_sign", (name, tag) -> wallHangingSign(tag, "pale_oak"));
addBlock("pale_moss_carpet", (name, tag) -> new PaleMossCarpet(name,
tag.get("Properties").get("bottom").stringValue("false").equals("true"),
tag.get("Properties").get("north").stringValue("none"),
tag.get("Properties").get("east").stringValue("none"),
tag.get("Properties").get("south").stringValue("none"),
tag.get("Properties").get("west").stringValue("none")));
addBlock("creaking_heart", (name, tag) -> new CreakingHeart(name,
tag.get("Properties").get("axis").stringValue("y"),
tag.get("Properties").get("creaking").stringValue("active")));
}

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

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

public class CreakingHeart extends AbstractModelBlock {
private final String description;

public CreakingHeart(String name, String axis, String creaking) {
super(name, Texture.creakingHeartTop);
this.model = new LogModel(
axis,
creaking.equals("disabled") ? Texture.creakingHeart : Texture.creakingHeartActive,
creaking.equals("disabled") ? Texture.creakingHeartTop : Texture.creakingHeartTopActive
);
this.description = String.format("axis=%s, creaking=%s", axis, creaking);
}

@Override
public String description() {
return description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package se.llbit.chunky.block.minecraft;

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

public class PaleMossCarpet extends AbstractModelBlock {
private final String description;

public PaleMossCarpet(String name, boolean bottom, String north, String east, String south, String west) {
super(name, Texture.paleMossCarpet);
this.model = new PaleMossCarpetModel(bottom, north, east, south, west);
this.description = String.format("bottom=%s, north=%s, east=%s, south=%s, west=%s", bottom, north, east, south, west);
}

@Override
public String description() {
return description;
}
}
2 changes: 2 additions & 0 deletions chunky/src/java/se/llbit/chunky/entity/HangingSignEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ public static Texture textureFromMaterial(String material) {
return Texture.bambooHangingSign;
case "cherry":
return Texture.cherryHangingSign;
case "pale_oak":
return Texture.paleOakHangingSign;
default:
throw new IllegalArgumentException("Unknown hanging sign material: " + material);
}
Expand Down
2 changes: 2 additions & 0 deletions chunky/src/java/se/llbit/chunky/entity/SignEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ public static Texture textureFromMaterial(String material) {
return Texture.bambooSignPost;
case "cherry":
return Texture.cherrySignPost;
case "pale_oak":
return Texture.paleOakSignPost;
default:
throw new IllegalArgumentException("Unknown sign material: " + material);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public enum Kind {
FLOWERING_AZALEA_BUSH,
MANGROVE_PROPAGULE,
TORCHFLOWER,
CHERRY_SAPLING
CHERRY_SAPLING,
PALE_OAK_SAPLING
}

private static final Texture flowerpot = Texture.flowerPot;
Expand Down Expand Up @@ -616,6 +617,9 @@ public FlowerPotModel(Kind kind) {
case TORCHFLOWER:
Arrays.fill(textures, flowerPotTex.length, textures.length, Texture.torchflower);
break;
case PALE_OAK_SAPLING:
Arrays.fill(textures, flowerPotTex.length, textures.length, Texture.paleOakSapling);
break;
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package se.llbit.chunky.model.minecraft;

import se.llbit.chunky.model.Model;
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;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PaleMossCarpetModel extends QuadModel {
private static final Quad[] carpet = new Quad[]{
new Quad(
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(16 / 16.0, 1 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 1 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 1 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(16 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 1 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 1 / 16.0, 0 / 16.0)
)
};

private static final Quad[] carpetSide = new Quad[]{
new Quad(
new Vector3(0 / 16.0, 16 / 16.0, 0.1 / 16.0),
new Vector3(16 / 16.0, 16 / 16.0, 0.1 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 0.1 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0),
true
)
};

private final Quad[] quads;
private final Texture[] textures;

public PaleMossCarpetModel(boolean bottom, String north, String east, String south, String west) {
List<Quad> quads = new ArrayList<>();
List<Texture> textures = new ArrayList<>();

boolean noSides = !bottom && north.equals("none") && east.equals("none") && south.equals("none") && west.equals("none");

// bottom
if (bottom || noSides) {
quads.addAll(Arrays.asList(carpet));
for (Quad quad : quads) {
textures.add(Texture.paleMossCarpet);
}
}

// north side
if (!north.equals("none") || noSides) {
quads.addAll(Arrays.asList(carpetSide));
textures.add(north.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
}

// east side
if (!east.equals("none") || noSides) {
quads.addAll(Arrays.asList(Model.rotateY(carpetSide)));
textures.add(east.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
}

// east side
if (!south.equals("none") || noSides) {
quads.addAll(Arrays.asList(Model.rotateY(carpetSide, Math.toRadians(180))));
textures.add(south.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
}

// east side
if (!west.equals("none") || noSides) {
quads.addAll(Arrays.asList(Model.rotateNegY(carpetSide)));
textures.add(west.equals("tall") || noSides ? Texture.paleMossCarpetSideTall : Texture.paleMossCarpetSideSmall);
}

this.quads = quads.toArray(new Quad[0]);
this.textures = textures.toArray(new Texture[0]);
}

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

@Override
public Texture[] getTextures() {
return textures;
}
}
45 changes: 45 additions & 0 deletions chunky/src/java/se/llbit/chunky/resources/Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,51 @@ public class Texture {
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_ejecting_reward_ominous")
public static final Texture trialSpawnerTopEjectingRewardOminous = new Texture();

@TexturePath("assets/minecraft/textures/block/pale_moss_block")
public static final Texture paleMossBlock = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_leaves")
public static final Texture paleOakLeaves = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_log")
public static final Texture paleOakLog= new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_log_top")
public static final Texture paleOakLogTop = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_hanging_moss")
public static final Texture paleHangingMoss = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_hanging_moss_tip")
public static final Texture paleHangingMossTip = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_planks")
public static final Texture paleOakPlanks = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_trapdoor")
public static final Texture paleOakTrapdoor = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_door_top")
public static final Texture paleOakDoorTop = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_door_bottom")
public static final Texture paleOakDoorBottom = new Texture();
@TexturePath("assets/minecraft/textures/block/stripped_pale_oak_log")
public static final Texture strippedPaleOakLog = new Texture();
@TexturePath("assets/minecraft/textures/block/stripped_pale_oak_log_top")
public static final Texture strippedPaleOakLogTop = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_oak_sapling")
public static final Texture paleOakSapling = new Texture();
@TexturePath("assets/minecraft/textures/entity/signs/pale_oak")
public static final Texture paleOakSignPost = new Texture();
@TexturePath("assets/minecraft/textures/entity/signs/hanging/pale_oak")
public static final Texture paleOakHangingSign = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet")
public static final Texture paleMossCarpet = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet_side_small")
public static final Texture paleMossCarpetSideSmall = new Texture();
@TexturePath("assets/minecraft/textures/block/pale_moss_carpet_side_tall")
public static final Texture paleMossCarpetSideTall = new Texture();
@TexturePath("assets/minecraft/textures/block/creaking_heart")
public static final Texture creakingHeart = new Texture();
@TexturePath("assets/minecraft/textures/block/creaking_heart_top")
public static final Texture creakingHeartTop = new Texture();
@TexturePath("assets/minecraft/textures/block/creaking_heart_active")
public static final Texture creakingHeartActive = new Texture();
@TexturePath("assets/minecraft/textures/block/creaking_heart_top_active")
public static final Texture creakingHeartTopActive = new Texture();

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

Expand Down
1 change: 1 addition & 0 deletions chunky/src/java/se/llbit/chunky/world/biome/Biomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public class Biomes {
private static final Biome deepDark = register(Biome.create("minecraft:deep_dark", "Deep Dark", 0.8, 0.4).mapColor(0x7E7E7E).defaultColors(0x91BD59, 0x77AB2F));
private static final Biome mangroveSwamp = register(Biome.create("minecraft:mangrove_swamp", "Mangrove Swamp", 0.8, 0.9).defaultColors(0x6A7039, 0x8DB127).waterColor(0x3A7A6A).mapColor(0x07F9B2).swamp());
private static final Biome cherryGrove = register(Biome.create("minecraft:cherry_grove", "Cherry Grove", 0.5, 0.8).mapColor(0xFCCBE7).defaultColors(0x91BD59, 0x77AB2F));
private static final Biome paleGarden = register(Biome.create("minecraft:pale_garden", "Pale Garden", 0.7, 0.8).mapColor(0xB9B9B9).grassColor(0x778272).foliageColor(0x878D76).waterColor(0x76889D));

/**
* Pre-1.18 biomes, i.e. before the biomes palette was introduced.
Expand Down

0 comments on commit c4b66a6

Please sign in to comment.