From 2d141681f4775f20ed76c4c74000218e6635db5a Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Sun, 27 Oct 2024 15:48:16 +0100 Subject: [PATCH] Add creaking heart block. --- .../chunky/block/MinecraftBlockProvider.java | 3 +++ .../chunky/block/minecraft/CreakingHeart.java | 24 +++++++++++++++++++ .../se/llbit/chunky/resources/Texture.java | 8 +++++++ 3 files changed, 35 insertions(+) create mode 100644 chunky/src/java/se/llbit/chunky/block/minecraft/CreakingHeart.java diff --git a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java index 2a790242e..9dffa6a66 100644 --- a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java +++ b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java @@ -1153,6 +1153,9 @@ private static void addBlocks(Texture texture, String... names) { 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 diff --git a/chunky/src/java/se/llbit/chunky/block/minecraft/CreakingHeart.java b/chunky/src/java/se/llbit/chunky/block/minecraft/CreakingHeart.java new file mode 100644 index 000000000..3f8320339 --- /dev/null +++ b/chunky/src/java/se/llbit/chunky/block/minecraft/CreakingHeart.java @@ -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; + } +} diff --git a/chunky/src/java/se/llbit/chunky/resources/Texture.java b/chunky/src/java/se/llbit/chunky/resources/Texture.java index 6700884e2..3fc9da080 100644 --- a/chunky/src/java/se/llbit/chunky/resources/Texture.java +++ b/chunky/src/java/se/llbit/chunky/resources/Texture.java @@ -1548,6 +1548,14 @@ public class Texture { 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();