From c4b66a6217c9bb7ca32f4c265c45747e40bd137e Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Sun, 27 Oct 2024 16:00:34 +0100 Subject: [PATCH] Add 24w40a blocks and pale garden biome (#1786) * 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. --- .../chunky/block/MinecraftBlockProvider.java | 34 +++++ .../chunky/block/minecraft/CreakingHeart.java | 24 ++++ .../block/minecraft/PaleMossCarpet.java | 20 +++ .../chunky/entity/HangingSignEntity.java | 2 + .../se/llbit/chunky/entity/SignEntity.java | 2 + .../model/minecraft/FlowerPotModel.java | 6 +- .../model/minecraft/PaleMossCarpetModel.java | 118 ++++++++++++++++++ .../se/llbit/chunky/resources/Texture.java | 45 +++++++ .../se/llbit/chunky/world/biome/Biomes.java | 1 + 9 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 chunky/src/java/se/llbit/chunky/block/minecraft/CreakingHeart.java create mode 100644 chunky/src/java/se/llbit/chunky/block/minecraft/PaleMossCarpet.java create mode 100644 chunky/src/java/se/llbit/chunky/model/minecraft/PaleMossCarpetModel.java diff --git a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java index 96dd0b8823..9dffa6a663 100644 --- a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java +++ b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java @@ -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; @@ -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 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 0000000000..3f83203394 --- /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/block/minecraft/PaleMossCarpet.java b/chunky/src/java/se/llbit/chunky/block/minecraft/PaleMossCarpet.java new file mode 100644 index 0000000000..d6b09f947c --- /dev/null +++ b/chunky/src/java/se/llbit/chunky/block/minecraft/PaleMossCarpet.java @@ -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; + } +} diff --git a/chunky/src/java/se/llbit/chunky/entity/HangingSignEntity.java b/chunky/src/java/se/llbit/chunky/entity/HangingSignEntity.java index 4863ce9bb7..5c85ba9d59 100644 --- a/chunky/src/java/se/llbit/chunky/entity/HangingSignEntity.java +++ b/chunky/src/java/se/llbit/chunky/entity/HangingSignEntity.java @@ -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); } diff --git a/chunky/src/java/se/llbit/chunky/entity/SignEntity.java b/chunky/src/java/se/llbit/chunky/entity/SignEntity.java index e8524edf81..4ccbe059f9 100644 --- a/chunky/src/java/se/llbit/chunky/entity/SignEntity.java +++ b/chunky/src/java/se/llbit/chunky/entity/SignEntity.java @@ -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); } diff --git a/chunky/src/java/se/llbit/chunky/model/minecraft/FlowerPotModel.java b/chunky/src/java/se/llbit/chunky/model/minecraft/FlowerPotModel.java index 05762dbade..860223c598 100644 --- a/chunky/src/java/se/llbit/chunky/model/minecraft/FlowerPotModel.java +++ b/chunky/src/java/se/llbit/chunky/model/minecraft/FlowerPotModel.java @@ -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; @@ -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; } diff --git a/chunky/src/java/se/llbit/chunky/model/minecraft/PaleMossCarpetModel.java b/chunky/src/java/se/llbit/chunky/model/minecraft/PaleMossCarpetModel.java new file mode 100644 index 0000000000..eeac549efc --- /dev/null +++ b/chunky/src/java/se/llbit/chunky/model/minecraft/PaleMossCarpetModel.java @@ -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 quads = new ArrayList<>(); + List 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; + } +} diff --git a/chunky/src/java/se/llbit/chunky/resources/Texture.java b/chunky/src/java/se/llbit/chunky/resources/Texture.java index 72809051b0..3fc9da0805 100644 --- a/chunky/src/java/se/llbit/chunky/resources/Texture.java +++ b/chunky/src/java/se/llbit/chunky/resources/Texture.java @@ -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(); diff --git a/chunky/src/java/se/llbit/chunky/world/biome/Biomes.java b/chunky/src/java/se/llbit/chunky/world/biome/Biomes.java index a40724cead..7ed5a748d9 100644 --- a/chunky/src/java/se/llbit/chunky/world/biome/Biomes.java +++ b/chunky/src/java/se/llbit/chunky/world/biome/Biomes.java @@ -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.