From 4081447c45f9830deeacc08d2c7d4d172dc8612c Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Mon, 15 Jan 2024 06:09:10 +0100 Subject: [PATCH] BOYFRIEND TODAY :3 --- .../blockstates/hanging_runewood_leaves.json | 51 ++++ .../resources/assets/malum/lang/en_us.json | 1 + .../block/hanging_runewood_leaves_0.json | 7 + .../block/hanging_runewood_leaves_1.json | 7 + .../block/hanging_runewood_leaves_2.json | 7 + .../models/item/hanging_runewood_leaves.json | 3 + .../hanging_mystic_soulwood_leaves.json | 119 +++++++- .../blocks/hanging_runewood_leaves.json | 136 +++++++++ .../blocks/mystic_soulwood_leaves.json | 119 +++++++- .../data/minecraft/tags/blocks/leaves.json | 2 + .../minecraft/tags/blocks/mineable/hoe.json | 1 + .../data/minecraft/tags/items/leaves.json | 2 + .../block/blight/BlightedGrowthBlock.java | 9 +- .../block/blight/ClingingBlightBlock.java | 60 +++- .../block/nature/MalumHangingLeavesBlock.java | 18 +- .../common/block/nature/MalumLeavesBlock.java | 2 + .../common/worldgen/RunewoodTreeFeature.java | 93 ++++--- .../common/worldgen/SoulwoodTreeFeature.java | 263 +++++++++++------- .../java/com/sammy/malum/data/MalumLang.java | 2 +- .../data/block/MalumBlockLootTables.java | 4 +- .../data/block/MalumBlockStateSmithTypes.java | 31 ++- .../malum/data/block/MalumBlockStates.java | 1 + .../recipe/MalumSpiritInfusionRecipes.java | 32 +-- .../registry/common/block/BlockRegistry.java | 35 ++- .../registry/common/item/ItemRegistry.java | 1 + .../runewood/hanging_runewood_leaves_0.png | Bin 0 -> 312 bytes .../runewood/hanging_runewood_leaves_1.png | Bin 0 -> 303 bytes .../runewood/hanging_runewood_leaves_2.png | Bin 0 -> 303 bytes .../block/runewood/runewood_leaves.png | Bin 414 -> 411 bytes .../block/soulwood/mystic_soulwood_leaves.png | Bin 420 -> 423 bytes .../block/soulwood/soulwood_leaves.png | Bin 366 -> 420 bytes .../malum/textures/item/anomalous_design.png | Bin 492 -> 492 bytes .../malum/textures/item/complete_design.png | Bin 519 -> 516 bytes .../assets/malum/textures/item/warp_flux.png | Bin 0 -> 450 bytes 34 files changed, 817 insertions(+), 189 deletions(-) create mode 100644 src/generated/resources/assets/malum/blockstates/hanging_runewood_leaves.json create mode 100644 src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_0.json create mode 100644 src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_1.json create mode 100644 src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_2.json create mode 100644 src/generated/resources/assets/malum/models/item/hanging_runewood_leaves.json create mode 100644 src/generated/resources/data/malum/loot_tables/blocks/hanging_runewood_leaves.json create mode 100644 src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_0.png create mode 100644 src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_1.png create mode 100644 src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_2.png create mode 100644 src/main/resources/assets/malum/textures/item/warp_flux.png diff --git a/src/generated/resources/assets/malum/blockstates/hanging_runewood_leaves.json b/src/generated/resources/assets/malum/blockstates/hanging_runewood_leaves.json new file mode 100644 index 000000000..b99440fab --- /dev/null +++ b/src/generated/resources/assets/malum/blockstates/hanging_runewood_leaves.json @@ -0,0 +1,51 @@ +{ + "variants": { + "": [ + { + "model": "malum:block/hanging_runewood_leaves_0" + }, + { + "model": "malum:block/hanging_runewood_leaves_0", + "y": 90 + }, + { + "model": "malum:block/hanging_runewood_leaves_0", + "y": 180 + }, + { + "model": "malum:block/hanging_runewood_leaves_0", + "y": 270 + }, + { + "model": "malum:block/hanging_runewood_leaves_1" + }, + { + "model": "malum:block/hanging_runewood_leaves_1", + "y": 90 + }, + { + "model": "malum:block/hanging_runewood_leaves_1", + "y": 180 + }, + { + "model": "malum:block/hanging_runewood_leaves_1", + "y": 270 + }, + { + "model": "malum:block/hanging_runewood_leaves_2" + }, + { + "model": "malum:block/hanging_runewood_leaves_2", + "y": 90 + }, + { + "model": "malum:block/hanging_runewood_leaves_2", + "y": 180 + }, + { + "model": "malum:block/hanging_runewood_leaves_2", + "y": 270 + } + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/lang/en_us.json b/src/generated/resources/assets/malum/lang/en_us.json index ab80545ed..c7caa3294 100644 --- a/src/generated/resources/assets/malum/lang/en_us.json +++ b/src/generated/resources/assets/malum/lang/en_us.json @@ -43,6 +43,7 @@ "block.malum.exposed_runewood_log": "Exposed Runewood Log", "block.malum.exposed_soulwood_log": "Exposed Soulwood Log", "block.malum.hanging_mystic_soulwood_leaves": "Hanging Mystic Soulwood Leaves", + "block.malum.hanging_runewood_leaves": "Hanging Runewood Leaves", "block.malum.iridescent_ether": "Iridescent Ether", "block.malum.iridescent_ether_torch": "Iridescent Ether Torch", "block.malum.mass_of_blighted_gunk": "Mass of Blighted Gunk", diff --git a/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_0.json b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_0.json new file mode 100644 index 000000000..0a309fc1a --- /dev/null +++ b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_0.json @@ -0,0 +1,7 @@ +{ + "parent": "malum:block/templates/template_hanging_leaves", + "textures": { + "hanging_leaves": "malum:block/runewood/hanging_runewood_leaves_0", + "particle": "malum:block/runewood/hanging_runewood_leaves_0" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_1.json b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_1.json new file mode 100644 index 000000000..83a8aeda1 --- /dev/null +++ b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_1.json @@ -0,0 +1,7 @@ +{ + "parent": "malum:block/templates/template_hanging_leaves", + "textures": { + "hanging_leaves": "malum:block/runewood/hanging_runewood_leaves_1", + "particle": "malum:block/runewood/hanging_runewood_leaves_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_2.json b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_2.json new file mode 100644 index 000000000..5cf0094f5 --- /dev/null +++ b/src/generated/resources/assets/malum/models/block/hanging_runewood_leaves_2.json @@ -0,0 +1,7 @@ +{ + "parent": "malum:block/templates/template_hanging_leaves", + "textures": { + "hanging_leaves": "malum:block/runewood/hanging_runewood_leaves_2", + "particle": "malum:block/runewood/hanging_runewood_leaves_2" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/item/hanging_runewood_leaves.json b/src/generated/resources/assets/malum/models/item/hanging_runewood_leaves.json new file mode 100644 index 000000000..7fc349419 --- /dev/null +++ b/src/generated/resources/assets/malum/models/item/hanging_runewood_leaves.json @@ -0,0 +1,3 @@ +{ + "parent": "malum:block/hanging_runewood_leaves_0" +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/loot_tables/blocks/hanging_mystic_soulwood_leaves.json b/src/generated/resources/data/malum/loot_tables/blocks/hanging_mystic_soulwood_leaves.json index fedb593ca..80aebb321 100644 --- a/src/generated/resources/data/malum/loot_tables/blocks/hanging_mystic_soulwood_leaves.json +++ b/src/generated/resources/data/malum/loot_tables/blocks/hanging_mystic_soulwood_leaves.json @@ -1,17 +1,132 @@ { "type": "minecraft:block", "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "malum:hanging_mystic_soulwood_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.015, + 0.0225, + 0.033333335, + 0.05 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "name": "malum:soulwood_growth" + } + ] + } + ], + "rolls": 1.0 + }, { "bonus_rolls": 0.0, "conditions": [ { - "condition": "minecraft:survives_explosion" + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } } ], "entries": [ { "type": "minecraft:item", - "name": "malum:hanging_mystic_soulwood_leaves" + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" } ], "rolls": 1.0 diff --git a/src/generated/resources/data/malum/loot_tables/blocks/hanging_runewood_leaves.json b/src/generated/resources/data/malum/loot_tables/blocks/hanging_runewood_leaves.json new file mode 100644 index 000000000..d4e4badca --- /dev/null +++ b/src/generated/resources/data/malum/loot_tables/blocks/hanging_runewood_leaves.json @@ -0,0 +1,136 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "malum:hanging_runewood_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.015, + 0.0225, + 0.033333335, + 0.05 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "name": "malum:runewood_sapling" + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "malum:blocks/hanging_runewood_leaves" +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/loot_tables/blocks/mystic_soulwood_leaves.json b/src/generated/resources/data/malum/loot_tables/blocks/mystic_soulwood_leaves.json index aca644d46..f83b20153 100644 --- a/src/generated/resources/data/malum/loot_tables/blocks/mystic_soulwood_leaves.json +++ b/src/generated/resources/data/malum/loot_tables/blocks/mystic_soulwood_leaves.json @@ -1,17 +1,132 @@ { "type": "minecraft:block", "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "malum:mystic_soulwood_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.015, + 0.0225, + 0.033333335, + 0.05 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "name": "malum:soulwood_growth" + } + ] + } + ], + "rolls": 1.0 + }, { "bonus_rolls": 0.0, "conditions": [ { - "condition": "minecraft:survives_explosion" + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:shears" + ] + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } } ], "entries": [ { "type": "minecraft:item", - "name": "malum:mystic_soulwood_leaves" + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" } ], "rolls": 1.0 diff --git a/src/generated/resources/data/minecraft/tags/blocks/leaves.json b/src/generated/resources/data/minecraft/tags/blocks/leaves.json index 6166489de..e9d213aac 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/leaves.json +++ b/src/generated/resources/data/minecraft/tags/blocks/leaves.json @@ -2,6 +2,8 @@ "values": [ "malum:mystic_soulwood_leaves", "malum:soulwood_leaves", + "malum:hanging_runewood_leaves", + "malum:hanging_runewood_leaves", "malum:runewood_leaves", "malum:runewood_leaves", "malum:hanging_mystic_soulwood_leaves" diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/hoe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/hoe.json index aba3a7f9b..c4ce6a18d 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/mineable/hoe.json +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/hoe.json @@ -5,6 +5,7 @@ "malum:mass_of_blighted_gunk", "malum:blighted_earth", "malum:soulwood_leaves", + "malum:hanging_runewood_leaves", "malum:blighted_soil", "malum:runewood_leaves", "malum:hanging_mystic_soulwood_leaves", diff --git a/src/generated/resources/data/minecraft/tags/items/leaves.json b/src/generated/resources/data/minecraft/tags/items/leaves.json index 6166489de..e9d213aac 100644 --- a/src/generated/resources/data/minecraft/tags/items/leaves.json +++ b/src/generated/resources/data/minecraft/tags/items/leaves.json @@ -2,6 +2,8 @@ "values": [ "malum:mystic_soulwood_leaves", "malum:soulwood_leaves", + "malum:hanging_runewood_leaves", + "malum:hanging_runewood_leaves", "malum:runewood_leaves", "malum:runewood_leaves", "malum:hanging_mystic_soulwood_leaves" diff --git a/src/main/java/com/sammy/malum/common/block/blight/BlightedGrowthBlock.java b/src/main/java/com/sammy/malum/common/block/blight/BlightedGrowthBlock.java index 7b67b1a68..08e27592e 100644 --- a/src/main/java/com/sammy/malum/common/block/blight/BlightedGrowthBlock.java +++ b/src/main/java/com/sammy/malum/common/block/blight/BlightedGrowthBlock.java @@ -2,16 +2,23 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.TallGrassBlock; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.*; import static com.sammy.malum.registry.common.block.BlockTagRegistry.BLIGHTED_BLOCKS; public class BlightedGrowthBlock extends TallGrassBlock { + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 8.0D, 14.0D); public BlightedGrowthBlock(Properties p_57318_) { super(p_57318_); } + @Override + public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + return SHAPE; + } + @Override protected boolean mayPlaceOn(BlockState pState, BlockGetter pLevel, BlockPos pPos) { if (pState.is(BLIGHTED_BLOCKS)) { diff --git a/src/main/java/com/sammy/malum/common/block/blight/ClingingBlightBlock.java b/src/main/java/com/sammy/malum/common/block/blight/ClingingBlightBlock.java index 1f51157c6..6c201d8f0 100644 --- a/src/main/java/com/sammy/malum/common/block/blight/ClingingBlightBlock.java +++ b/src/main/java/com/sammy/malum/common/block/blight/ClingingBlightBlock.java @@ -14,7 +14,27 @@ import static net.minecraft.world.level.block.state.properties.BlockStateProperties.*; public class ClingingBlightBlock extends Block { - protected static final VoxelShape SHAPE = Block.box(2.0D, 2.0D, 2.0D, 14.0D, 14.0D, 14.0D); + protected static final VoxelShape SHAPE_GROUNDED_ROOTS_X = Block.box(0.0D, 0.0D, 2.0D, 16.0D, 6.0D, 14.0D); + protected static final VoxelShape SHAPE_GROUNDED_ROOTS_Z = Block.box(2.0D, 0.0D, 0.0D, 14.0D, 6.0D, 16.0D); + + protected static final VoxelShape SHAPE_ROOTED_EAST = Block.box(4.0D, 0.0D, 2.0D, 16.0D, 12.0D, 14.0D); + protected static final VoxelShape SHAPE_ROOTED_WEST = Block.box(0.0D, 0.0D, 2.0D, 12.0D, 12.0D, 14.0D); + protected static final VoxelShape SHAPE_ROOTED_SOUTH = Block.box(2.0D, 0.0D, 4.0D, 14.0D, 12.0D, 16.0D); + protected static final VoxelShape SHAPE_ROOTED_NORTH = Block.box(2.0D, 0.0D, 0.0D, 14.0D, 12.0D, 12.0D); + + protected static final VoxelShape SHAPE_BRACED_EAST = Block.box(4.0D, 0.0D, 4.0D, 16.0D, 16.0D, 12.0D); + protected static final VoxelShape SHAPE_BRACED_WEST = Block.box(0.0D, 0.0D, 4.0D, 8.0D, 16.0D, 12.0D); + protected static final VoxelShape SHAPE_BRACED_SOUTH = Block.box(4.0D, 0.0D, 4.0D, 12.0D, 16.0D, 16.0D); + protected static final VoxelShape SHAPE_BRACED_NORTH = Block.box(4.0D, 0.0D, 0.0D, 12.0D, 16.0D, 8.0D); + + protected static final VoxelShape SHAPE_HANGING_EAST = Block.box(4.0D, 0.0D, 2.0D, 16.0D, 16.0D, 14.0D); + protected static final VoxelShape SHAPE_HANGING_WEST = Block.box(0.0D, 0.0D, 2.0D, 12.0D, 16.0D, 14.0D); + protected static final VoxelShape SHAPE_HANGING_SOUTH = Block.box(2.0D, 0.0D, 4.0D, 14.0D, 16.0D, 16.0D); + protected static final VoxelShape SHAPE_HANGING_NORTH = Block.box(2.0D, 0.0D, 0.0D, 14.0D, 16.0D, 12.0D); + + protected static final VoxelShape SHAPE_HANGING_ROOTS_X = Block.box(0.0D, 12.0D, 2.0D, 16.0D, 16.0D, 14.0D); + protected static final VoxelShape SHAPE_HANGING_ROOTS_Z = Block.box(2.0D, 12.0D, 0.0D, 14.0D, 16.0D, 16.0D); + public static final EnumProperty BLIGHT_TYPE = EnumProperty.create("blight_type", BlightType.class); @@ -87,18 +107,46 @@ public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) return Block.canSupportCenter(pLevel, pos, direction); } + @Override + public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + VoxelShape[] shapeArray; + switch (pState.getValue(BLIGHT_TYPE)) { + case GROUNDED_ROOTS -> shapeArray = new VoxelShape[]{SHAPE_GROUNDED_ROOTS_X, SHAPE_GROUNDED_ROOTS_X, SHAPE_GROUNDED_ROOTS_Z, SHAPE_GROUNDED_ROOTS_Z}; + case ROOTED_BLIGHT -> shapeArray = new VoxelShape[]{SHAPE_ROOTED_EAST, SHAPE_ROOTED_WEST, SHAPE_ROOTED_SOUTH, SHAPE_ROOTED_NORTH}; + case SOULWOOD_SPIKE, HANGING_BLIGHT_CONNECTION -> shapeArray = new VoxelShape[]{SHAPE_BRACED_EAST, SHAPE_BRACED_WEST, SHAPE_BRACED_SOUTH, SHAPE_BRACED_NORTH}; + case HANGING_BLIGHT -> shapeArray = new VoxelShape[]{SHAPE_HANGING_EAST, SHAPE_HANGING_WEST, SHAPE_HANGING_SOUTH, SHAPE_HANGING_NORTH}; + case HANGING_ROOTS -> shapeArray = new VoxelShape[]{SHAPE_HANGING_ROOTS_X, SHAPE_HANGING_ROOTS_X, SHAPE_HANGING_ROOTS_Z, SHAPE_HANGING_ROOTS_Z}; + default -> throw new IllegalStateException("Unexpected value: " + pState.getValue(BLIGHT_TYPE)); + } + switch (pState.getValue(HORIZONTAL_FACING)) { + case EAST -> { + return shapeArray[0]; + } + case WEST -> { + return shapeArray[1]; + } + case SOUTH -> { + return shapeArray[2]; + } + case NORTH -> { + return shapeArray[3]; + } + } + return super.getShape(pState, pLevel, pPos, pContext); + } + @Override public VoxelShape getBlockSupportShape(BlockState pState, BlockGetter pReader, BlockPos pPos) { return Shapes.empty(); } public enum BlightType implements StringRepresentable { - HANGING_BLIGHT, - HANGING_BLIGHT_CONNECTION, - ROOTED_BLIGHT, GROUNDED_ROOTS, - HANGING_ROOTS, - SOULWOOD_SPIKE; + ROOTED_BLIGHT, + SOULWOOD_SPIKE, + HANGING_BLIGHT_CONNECTION, + HANGING_BLIGHT, + HANGING_ROOTS; final String name = name().toLowerCase(Locale.ROOT); diff --git a/src/main/java/com/sammy/malum/common/block/nature/MalumHangingLeavesBlock.java b/src/main/java/com/sammy/malum/common/block/nature/MalumHangingLeavesBlock.java index a26cfc91e..b6a9a81c0 100644 --- a/src/main/java/com/sammy/malum/common/block/nature/MalumHangingLeavesBlock.java +++ b/src/main/java/com/sammy/malum/common/block/nature/MalumHangingLeavesBlock.java @@ -25,9 +25,25 @@ public MalumHangingLeavesBlock(Properties properties, Color maxColor, Color minC super(properties, maxColor, minColor); } + @Override + protected boolean decaying(BlockState pState) { + return false; + } + + @Override + public BlockState updateShape(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pFacingPos) { + if (pFacing.equals(Direction.UP)) { + if (pFacingState.hasProperty(DISTANCE) && pFacingState.hasProperty(COLOR)) { + final int distance = Math.min(pFacingState.getValue(DISTANCE)+1, 7); + return super.updateShape(pState.setValue(DISTANCE, distance).setValue(COLOR, pFacingState.getValue(COLOR)), pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos); + } + } + return !pState.canSurvive(pLevel, pCurrentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(pState, pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos); + } @Override public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) { - return pLevel.getBlockState(pPos.above()).getBlock() instanceof LeavesBlock; + final Block block = pLevel.getBlockState(pPos.above()).getBlock(); + return block instanceof MalumLeavesBlock && !block.equals(pState.getBlock()); } @Override diff --git a/src/main/java/com/sammy/malum/common/block/nature/MalumLeavesBlock.java b/src/main/java/com/sammy/malum/common/block/nature/MalumLeavesBlock.java index 3bda57a1d..fb5cb73f9 100644 --- a/src/main/java/com/sammy/malum/common/block/nature/MalumLeavesBlock.java +++ b/src/main/java/com/sammy/malum/common/block/nature/MalumLeavesBlock.java @@ -21,6 +21,7 @@ import static com.sammy.malum.MalumMod.RANDOM; public class MalumLeavesBlock extends LeavesBlock implements IForgeBlock { + public static final IntegerProperty COLOR = IntegerProperty.create("color", 0, 4); public final Color maxColor; public final Color minColor; @@ -37,6 +38,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder context) { @@ -59,7 +65,8 @@ public boolean place(FeaturePlaceContext context) { LodestoneBlockFiller treeFiller = new LodestoneBlockFiller(false); LodestoneBlockFiller leavesFiller = new LodestoneBlockFiller(true); - int trunkHeight = minimumTrunkHeight + rand.nextInt(extraTrunkHeight + 1); + int trunkHeight = getTrunkHeight(rand); + int sapBlockCount = getSapBlockCount(rand); BlockPos trunkTop = pos.above(trunkHeight); Direction[] directions = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST}; @@ -73,10 +80,10 @@ public boolean place(FeaturePlaceContext context) { } } - makeLeafBlob(leavesFiller, rand, trunkTop); + makeLeafBlob(leavesFiller, trunkTop); for (Direction direction : directions) //side trunk placement { - int sideTrunkHeight = minimumSideTrunkHeight + rand.nextInt(extraSideTrunkHeight + 1); + int sideTrunkHeight = getSideTrunkHeight(rand); for (int i = 0; i < sideTrunkHeight; i++) { BlockPos sideTrunkPos = pos.relative(direction).above(i); if (canPlace(level, sideTrunkPos)) { @@ -89,10 +96,10 @@ public boolean place(FeaturePlaceContext context) { } for (Direction direction : directions) //tree top placement { - int branchCoreOffset = minimumDownwardsBranchOffset + rand.nextInt(extraDownwardsBranchOffset + 1); - int branchOffset = minimumBranchCoreOffset + rand.nextInt(branchCoreOffsetExtra + 1); - BlockPos branchStartPos = trunkTop.below(branchCoreOffset).relative(direction, branchOffset); - for (int i = 0; i < branchOffset; i++) //branch connection placement + int downwardsBranchOffset = getDownwardsBranchOffset(rand); + int branchEndOffset = getBranchEndOffset(rand); + BlockPos branchStartPos = trunkTop.below(downwardsBranchOffset).relative(direction, branchEndOffset); + for (int i = 0; i < branchEndOffset; i++) //branch connection placement { BlockPos branchConnectionPos = branchStartPos.relative(direction.getOpposite(), i); if (canPlace(level, branchConnectionPos)) { @@ -101,7 +108,7 @@ public boolean place(FeaturePlaceContext context) { return false; } } - int branchHeight = minimumBranchHeight + rand.nextInt(branchHeightExtra + 1); + int branchHeight = getBranchHeight(rand); for (int i = 0; i < branchHeight; i++) //branch placement { BlockPos branchPos = branchStartPos.above(i); @@ -111,9 +118,8 @@ public boolean place(FeaturePlaceContext context) { return false; } } - makeLeafBlob(leavesFiller, rand, branchStartPos.above(1)); + makeLeafBlob(leavesFiller, branchStartPos.above(1)); } - int sapBlockCount = minimumSapBlockCount + rand.nextInt(extraSapBlockCount + 1); ArrayList sapBlockPositions = new ArrayList<>(treeFiller.getEntries().keySet()); Collections.shuffle(sapBlockPositions); for (BlockPos blockPos : sapBlockPositions.subList(0, sapBlockCount)) { @@ -143,22 +149,35 @@ public static void downwardsTrunk(WorldGenLevel level, LodestoneBlockFiller fill while (true); } - public static void makeLeafBlob(LodestoneBlockFiller filler, RandomSource rand, BlockPos pos) { - makeLeafSlice(filler, pos, 1, 0); - makeLeafSlice(filler, pos.above(1), 2, 1); - makeLeafSlice(filler, pos.above(2), 2, 2); - makeLeafSlice(filler, pos.above(3), 2, 3); - makeLeafSlice(filler, pos.above(4), 1, 4); + public static void makeLeafBlob(LodestoneBlockFiller filler, BlockPos pos) { + final BlockPos.MutableBlockPos mutable = pos.mutable(); + int[] leafSizes = new int[]{1, 2, 2, 2, 1}; + int[] leafColors = new int[]{0, 1, 2, 3, 4}; + mutable.move(Direction.DOWN, 1); + for (int i = 0; i < 2; i++) { + int size = leafSizes[i]; + int color = leafColors[i]; + final BlockState state = BlockRegistry.HANGING_RUNEWOOD_LEAVES.get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, color); + makeLeafSlice(filler, mutable, size, state); + mutable.move(Direction.UP); + } + mutable.move(Direction.DOWN, 1); + for (int i = 0; i < 5; i++) { + int size = leafSizes[i]; + int color = leafColors[i]; + final BlockState state = BlockRegistry.RUNEWOOD_LEAVES.get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, color); + makeLeafSlice(filler, mutable, size, state); + mutable.move(Direction.UP); + } } - public static void makeLeafSlice(LodestoneBlockFiller filler, BlockPos pos, int leavesSize, int leavesColor) { + public static void makeLeafSlice(LodestoneBlockFiller filler, BlockPos.MutableBlockPos pos, int leavesSize, BlockState state) { for (int x = -leavesSize; x <= leavesSize; x++) { for (int z = -leavesSize; z <= leavesSize; z++) { if (Math.abs(x) == leavesSize && Math.abs(z) == leavesSize) { continue; } - BlockPos leavesPos = new BlockPos(pos).offset(x, 0, z); - filler.getEntries().put(leavesPos, new BlockStateEntry(BlockRegistry.RUNEWOOD_LEAVES.get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, leavesColor))); + filler.getEntries().put(pos.offset(x, 0, z), new BlockStateEntry(state)); } } } @@ -184,9 +203,9 @@ public static void updateLeaves(LevelAccessor pLevel, Set logPositions mutable.setWithOffset(pos, direction); if (!logPositions.contains(mutable)) { BlockState blockstate = pLevel.getBlockState(mutable); - if (blockstate.hasProperty(BlockStateProperties.DISTANCE)) { + if (blockstate.hasProperty(MalumLeavesBlock.DISTANCE)) { list.get(0).add(mutable.immutable()); - pLevel.setBlock(mutable, blockstate.setValue(BlockStateProperties.DISTANCE, 1), 19); + pLevel.setBlock(mutable, blockstate.setValue(MalumLeavesBlock.DISTANCE, 1), 19); } } } @@ -201,10 +220,10 @@ public static void updateLeaves(LevelAccessor pLevel, Set logPositions mutable.setWithOffset(pos, direction1); if (!set.contains(mutable) && !set1.contains(mutable)) { BlockState blockstate1 = pLevel.getBlockState(mutable); - if (blockstate1.hasProperty(BlockStateProperties.DISTANCE)) { - int k = blockstate1.getValue(BlockStateProperties.DISTANCE); + if (blockstate1.hasProperty(MalumLeavesBlock.DISTANCE)) { + int k = blockstate1.getValue(MalumLeavesBlock.DISTANCE); if (k > l + 1) { - BlockState blockstate2 = blockstate1.setValue(BlockStateProperties.DISTANCE, l + 1); + BlockState blockstate2 = blockstate1.setValue(MalumLeavesBlock.DISTANCE, l + 1); pLevel.setBlock(mutable, blockstate2, 19); set1.add(mutable.immutable()); } diff --git a/src/main/java/com/sammy/malum/common/worldgen/SoulwoodTreeFeature.java b/src/main/java/com/sammy/malum/common/worldgen/SoulwoodTreeFeature.java index 96482069b..5bfecf653 100644 --- a/src/main/java/com/sammy/malum/common/worldgen/SoulwoodTreeFeature.java +++ b/src/main/java/com/sammy/malum/common/worldgen/SoulwoodTreeFeature.java @@ -10,8 +10,7 @@ import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.*; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.state.BlockBehaviour; @@ -23,14 +22,18 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.synth.PerlinSimplexNoise; -import net.minecraft.world.phys.Vec3; -import team.lodestar.lodestone.helpers.BlockHelper; +import net.minecraft.world.phys.*; +import org.joml.*; +import team.lodestar.lodestone.helpers.*; import team.lodestar.lodestone.systems.worldgen.LodestoneBlockFiller; import team.lodestar.lodestone.systems.worldgen.LodestoneBlockFiller.BlockStateEntry; -import java.lang.reflect.*; +import java.lang.*; +import java.lang.Math; import java.util.*; +import java.util.function.*; +import static com.sammy.malum.common.block.blight.ClingingBlightBlock.BlightType.*; import static com.sammy.malum.common.worldgen.RunewoodTreeFeature.canPlace; import static com.sammy.malum.common.worldgen.RunewoodTreeFeature.updateLeaves; import static net.minecraft.tags.BlockTags.*; @@ -40,28 +43,41 @@ public SoulwoodTreeFeature() { super(NoneFeatureConfiguration.CODEC); } - private static final PerlinSimplexNoise BLIGHT_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(1234L)), ImmutableList.of(0)); - private static final int minimumSapBlockCount = 3; - private static final int extraSapBlockCount = 5; + private static final Direction[] DIRECTIONS = new Direction[]{Direction.NORTH, Direction.WEST, Direction.SOUTH, Direction.EAST}; + private static final PerlinSimplexNoise BLIGHT_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(1234L)), ImmutableList.of(0)); - private static final int minimumTrunkHeight = 12; - private static final int extraTrunkHeight = 6; - private static final int minimumTwistCooldown = 3; - private static final int extraTwistCooldown = 1; - private static final int minimumTrunkTwists = 2; - private static final int extraTrunkTwists = 4; - private static final int minimumSideTrunkHeight = 1; - private static final int extraSideTrunkHeight = 2; + private static BlockState makeClingingBlight(ClingingBlightBlock.BlightType blightType, Direction direction) { + return BlockRegistry.CLINGING_BLIGHT.get().defaultBlockState().setValue(ClingingBlightBlock.BLIGHT_TYPE, blightType).setValue(BlockStateProperties.HORIZONTAL_FACING, direction); + } - private static final int minimumDownwardsBranchOffset = 2; - private static final int extraDownwardsBranchOffset = 3; - private static final int minimumBranchCoreOffset = 2; - private static final int branchCoreOffsetExtra = 3; - private static final int minimumBranchTwists = 0; - private static final int extraBranchTwists = 2; - private static final int minimumBranchHeight = 5; - private static final int branchHeightExtra = 2; + private static int getSapBlockCount(RandomSource random) { + return Mth.nextInt(random, 5, 7); + } + private static int getTrunkHeight(RandomSource random) { + return Mth.nextInt(random, 12, 18); + } + private static int getTwistCooldown(RandomSource random) { + return Mth.nextInt(random, 3, 5); + } + private static int getTrunkTwistAmount(RandomSource random) { + return Mth.nextInt(random, 2, 6); + } + private static int getSideTrunkHeight(RandomSource random) { + return Mth.nextInt(random, 1, 3); + } + private static int getDownwardsBranchOffset(RandomSource random) { + return Mth.nextInt(random, 2, 4); + } + private static int getBranchEndOffset(RandomSource random) { + return Mth.nextInt(random, 3, 5); + } + private static int getBranchTwistAmount(RandomSource random) { + return Mth.nextInt(random, 0, 2); + } + private static int getBranchHeight(RandomSource random) { + return Mth.nextInt(random, 5, 6); + } @Override public boolean place(FeaturePlaceContext context) { @@ -75,52 +91,64 @@ public boolean place(FeaturePlaceContext context) { BlockState defaultLog = BlockRegistry.SOULWOOD_LOG.get().defaultBlockState(); BlockState blightedLog = BlockRegistry.BLIGHTED_SOULWOOD.get().defaultBlockState(); - BlockState clingingBlight = BlockRegistry.CLINGING_BLIGHT.get().defaultBlockState(); LodestoneBlockFiller treeFiller = new LodestoneBlockFiller(false); LodestoneBlockFiller blightFiller = new LodestoneBlockFiller(false); LodestoneBlockFiller leavesFiller = new LodestoneBlockFiller(true); + LodestoneBlockFiller hangingLeavesFiller = new LodestoneBlockFiller(true) { + @Override + public void fill(LevelAccessor level) { + getEntries().forEach((pos, entry) -> { + final BlockState state = entry.getState(); + if (blightFiller.getEntries().containsKey(pos) || blightFiller.getEntries().containsKey(pos.above())) { + return; + } + if (state.getBlock().equals(BlockRegistry.MYSTIC_SOULWOOD_LEAVES.get()) && level.getBlockState(pos).getBlock() instanceof MalumLeavesBlock) { + entry.place(level, pos); + } else if (!isCareful() || entry.canPlace(level, pos)) { + entry.place(level, pos); + } + }); + } + }; + Set hangingLeavesCoverage = new HashSet<>(); - int trunkHeight = minimumTrunkHeight + rand.nextInt(extraTrunkHeight + 1); - Direction[] directions = new Direction[]{Direction.NORTH, Direction.WEST, Direction.SOUTH, Direction.EAST}; - int twistDirection = rand.nextInt(directions.length); - int twistCooldown = 3; - int twists = minimumTrunkTwists + rand.nextInt(extraTrunkTwists + 1); - int lowestPossibleBranch = minimumDownwardsBranchOffset + extraDownwardsBranchOffset; + int sapBlockCount = getSapBlockCount(rand); + int trunkHeight = getTrunkHeight(rand); + int twistCooldown = getTwistCooldown(rand); + int twistDirection = rand.nextInt(DIRECTIONS.length); + int twistAmount = getTrunkTwistAmount(rand); + int lowestPossibleBranch = 5; BlockPos twistedPos = pos; - for (int i = 0; i <= trunkHeight; i++) //trunk placement + for (int i = 0; i <= trunkHeight+3; i++) //trunk placement { if (i < trunkHeight - lowestPossibleBranch) { - if (twistCooldown == 0 && twists != 0) { - twistCooldown = minimumTwistCooldown + rand.nextInt(extraTwistCooldown + 1); + if (twistCooldown == 0 && twistAmount != 0) { + twistCooldown = getTwistCooldown(rand); BlockPos trunkPos = twistedPos.above(i); if (canPlace(level, trunkPos)) { treeFiller.getEntries().put(trunkPos, new BlockStateEntry(defaultLog)); - for (Direction direction : directions) { + for (Direction direction : DIRECTIONS) { validSoulstoneSpikePositions.add(Pair.of(direction.getOpposite(), trunkPos.relative(direction))); } twistCooldown--; } else { return false; } - final Direction direction = directions[twistDirection % 4]; - - final BlockState state = clingingBlight - .setValue(ClingingBlightBlock.BLIGHT_TYPE, ClingingBlightBlock.BlightType.ROOTED_BLIGHT) - .setValue(BlockStateProperties.HORIZONTAL_FACING, direction); - blightFiller.getEntries().put(trunkPos.above(), new BlockStateEntry(state)); + final Direction direction = DIRECTIONS[twistDirection % 4]; + blightFiller.getEntries().put(trunkPos.above(), new BlockStateEntry(makeClingingBlight(ClingingBlightBlock.BlightType.ROOTED_BLIGHT, direction))); twistedPos = twistedPos.relative(direction); if (rand.nextFloat() < 0.85f) { twistDirection++; } - twists--; + twistAmount--; } } BlockPos trunkPos = twistedPos.above(i); if (canPlace(level, trunkPos)) { treeFiller.getEntries().put(trunkPos, new BlockStateEntry(i == 0 ? blightedLog : defaultLog)); if (i != 0 && i < trunkHeight-3) { - for (Direction direction : directions) { + for (Direction direction : DIRECTIONS) { validSoulstoneSpikePositions.add(Pair.of(direction.getOpposite(), trunkPos.relative(direction))); } } @@ -131,16 +159,16 @@ public boolean place(FeaturePlaceContext context) { } BlockPos trunkTop = twistedPos.above(trunkHeight); - makeLeafBlob(leavesFiller, rand, trunkTop); - for (Direction direction : directions) //side trunk placement + makeLeafBlob(leavesFiller, hangingLeavesFiller, hangingLeavesCoverage, rand, trunkTop); + for (Direction direction : DIRECTIONS) //side trunk placement { - BlockPos blightedPos = null; - int sideTrunkHeight = minimumSideTrunkHeight + rand.nextInt(extraSideTrunkHeight + 1); + Optional blightedPosOptional = Optional.empty(); + int sideTrunkHeight = getSideTrunkHeight(rand); for (int i = 0; i < sideTrunkHeight; i++) { BlockPos sideTrunkPos = pos.relative(direction).above(i); if (canPlace(level, sideTrunkPos)) { if (i == 0) { - blightedPos = sideTrunkPos; + blightedPosOptional = Optional.of(sideTrunkPos); } treeFiller.getEntries().put(sideTrunkPos, new BlockStateEntry(i == 0 ? blightedLog : defaultLog)); } else { @@ -148,55 +176,52 @@ public boolean place(FeaturePlaceContext context) { } } boolean success = downwardsTrunk(level, treeFiller, blightFiller, direction, pos.relative(direction)); - if (success) { - treeFiller.replace(blightedPos, e -> new BlockStateEntry(defaultLog)); - } else if (blightedPos != null) { - final BlockState state = clingingBlight - .setValue(ClingingBlightBlock.BLIGHT_TYPE, ClingingBlightBlock.BlightType.ROOTED_BLIGHT) - .setValue(BlockStateProperties.HORIZONTAL_FACING, direction.getOpposite()); - blightFiller.getEntries().put(blightedPos.relative(direction), new BlockStateEntry(state)); + if (blightedPosOptional.isPresent()) { + final BlockPos blightedPos = blightedPosOptional.get(); + if (success) { + treeFiller.replace(blightedPos, e -> new BlockStateEntry(defaultLog)); + } else { + blightFiller.getEntries().put(blightedPos.relative(direction), new BlockStateEntry(makeClingingBlight(ClingingBlightBlock.BlightType.ROOTED_BLIGHT, direction.getOpposite()))); + } } } - for (Direction direction : directions) //tree top placement + for (Direction direction : DIRECTIONS) //tree top placement { - int branchCoreOffset = minimumDownwardsBranchOffset + rand.nextInt(extraDownwardsBranchOffset + 1); - int branchOffset = minimumBranchCoreOffset + rand.nextInt(branchCoreOffsetExtra + 1); - BlockPos branchStartPos = trunkTop.below(branchCoreOffset); + int downwardsBranchOffset = getDownwardsBranchOffset(rand); + int branchEndOffset = getBranchEndOffset(rand); + twistAmount = getBranchTwistAmount(rand); + BlockPos branchStartPos = trunkTop.below(downwardsBranchOffset); twistCooldown = 1; - twists = minimumBranchTwists + rand.nextInt(extraBranchTwists + 1); - for (int i = 1; i < branchOffset; i++) //branch connection placement + for (int i = 1; i < branchEndOffset; i++) //branch connection placement { BlockPos branchConnectionPos = branchStartPos.relative(direction, i); - if (twistCooldown == 0 && twists != 0) { - twistCooldown = minimumTwistCooldown + rand.nextInt(extraTwistCooldown + 1); + final Direction.Axis axis = direction.getAxis(); + if (twistCooldown == 0 && twistAmount != 0) { + twistCooldown = getTwistCooldown(rand); BlockPos offsetPos = branchConnectionPos.above(); if (canPlace(level, offsetPos)) { - treeFiller.getEntries().put(offsetPos, new BlockStateEntry(defaultLog.setValue(RotatedPillarBlock.AXIS, direction.getAxis()))); + treeFiller.getEntries().put(offsetPos, new BlockStateEntry(defaultLog.setValue(RotatedPillarBlock.AXIS, axis))); } else { return false; } branchStartPos = branchStartPos.above(); - twists--; + twistAmount--; } if (canPlace(level, branchConnectionPos)) { - treeFiller.getEntries().put(branchConnectionPos, new BlockStateEntry(defaultLog.setValue(RotatedPillarBlock.AXIS, direction.getAxis()))); - final boolean start = i == 1; - BlockState state = clingingBlight - .setValue(ClingingBlightBlock.BLIGHT_TYPE, start ? ClingingBlightBlock.BlightType.HANGING_BLIGHT : ClingingBlightBlock.BlightType.HANGING_ROOTS) - .setValue(BlockStateProperties.HORIZONTAL_FACING, direction.getOpposite()); - blightFiller.getEntries().put(branchConnectionPos.below(), new BlockStateEntry(state)); + final Direction opposite = direction.getOpposite(); + treeFiller.getEntries().put(branchConnectionPos, new BlockStateEntry(defaultLog.setValue(RotatedPillarBlock.AXIS, axis))); + blightFiller.getEntries().put(branchConnectionPos.below(), new BlockStateEntry(makeClingingBlight(start ? HANGING_BLIGHT : HANGING_ROOTS, opposite))); if (start) { - state = state.setValue(ClingingBlightBlock.BLIGHT_TYPE, ClingingBlightBlock.BlightType.HANGING_BLIGHT_CONNECTION); - blightFiller.getEntries().put(branchConnectionPos.below(2), new BlockStateEntry(state)); + blightFiller.getEntries().put(branchConnectionPos.below(2), new BlockStateEntry(makeClingingBlight(HANGING_BLIGHT_CONNECTION, opposite))); } twistCooldown--; } else { return false; } } - BlockPos branchEndPos = branchStartPos.relative(direction, branchOffset); - int branchHeight = minimumBranchHeight + rand.nextInt(branchHeightExtra + 1); + BlockPos branchEndPos = branchStartPos.relative(direction, branchEndOffset); + int branchHeight = getBranchHeight(rand); for (int i = 0; i < branchHeight; i++) //branch placement { BlockPos branchPos = branchEndPos.above(i); @@ -206,11 +231,10 @@ public boolean place(FeaturePlaceContext context) { return false; } } - makeLeafBlob(leavesFiller, rand, branchEndPos.above(1)); + makeLeafBlob(leavesFiller, hangingLeavesFiller, hangingLeavesCoverage, rand, branchEndPos.above(1)); } generateBlight(level, blightFiller, pos.below(), 6); - int sapBlockCount = minimumSapBlockCount + rand.nextInt(extraSapBlockCount + 1); ArrayList sapBlockPositions = new ArrayList<>(treeFiller.getEntries().keySet()); Collections.shuffle(sapBlockPositions); for (BlockPos blockPos : sapBlockPositions.subList(0, sapBlockCount)) { @@ -221,19 +245,16 @@ public boolean place(FeaturePlaceContext context) { for (Pair entry : validSoulstoneSpikePositions) { final BlockPos entryPos = entry.getSecond(); if (!blightFiller.getEntries().containsKey(entryPos)) { - final BlockState state = clingingBlight - .setValue(ClingingBlightBlock.BLIGHT_TYPE, ClingingBlightBlock.BlightType.SOULWOOD_SPIKE) - .setValue(BlockStateProperties.HORIZONTAL_FACING, entry.getFirst()); - blightFiller.getEntries().put(entryPos, new BlockStateEntry(state)); + blightFiller.getEntries().put(entryPos, new BlockStateEntry(makeClingingBlight(SOULWOOD_SPIKE, entry.getFirst()))); if (spikeCount-- == 0) { break; } } } - blightFiller.fill(level); treeFiller.fill(level); leavesFiller.fill(level); + hangingLeavesFiller.fill(level); updateLeaves(level, treeFiller.getEntries().keySet()); return true; } @@ -265,39 +286,62 @@ public static boolean downwardsTrunk(WorldGenLevel level, LodestoneBlockFiller f return i > 1; } - public static void makeLeafBlob(LodestoneBlockFiller filler, RandomSource rand, BlockPos pos) { - makeLeafSlice(filler, rand, pos, 1, 0); - makeLeafSlice(filler, rand, pos.above(1), 2, 1); - makeLeafSlice(filler, rand, pos.above(2), 3, 2); - makeLeafSlice(filler, rand, pos.above(3), 3, 3); - makeLeafSlice(filler, rand, pos.above(4), 3, 3); - makeLeafSlice(filler, rand, pos.above(5), 2, 3); - makeLeafSlice(filler, rand, pos.above(6), 1, 4); + public static void makeLeafBlob(LodestoneBlockFiller leavesFiller, LodestoneBlockFiller hangingLeavesFiller, Set hangingLeavesCoverage, RandomSource rand, BlockPos pos) { + final BlockPos.MutableBlockPos mutable = pos.mutable(); + int[] leafSizes = new int[]{1, 2, 3, 3, 3, 2, 1}; + int[] leafColors = new int[]{4, 3, 2, 1, 2, 3, 4}; + for (int i = 0; i < 7; i++) { + int size = leafSizes[i]; + int color = leafColors[i]; + makeLeafSlice(leavesFiller, hangingLeavesFiller, hangingLeavesCoverage, rand, mutable, size, color, false); + mutable.move(Direction.UP); + } + mutable.move(Direction.DOWN, 7); + for (int i = 0; i < 3; i++) { + int size = leafSizes[i]; + int color = leafColors[i]; + makeLeafSlice(leavesFiller, hangingLeavesFiller, hangingLeavesCoverage, rand, mutable, size, color, true); + mutable.move(Direction.UP); + } } - public static void makeLeafSlice(LodestoneBlockFiller filler, RandomSource rand, BlockPos pos, int leavesSize, int leavesColor) { + public static void makeLeafSlice(LodestoneBlockFiller filler, LodestoneBlockFiller hangingLeavesFiller, Set hangingLeavesCoverage, RandomSource rand, BlockPos.MutableBlockPos pos, int leavesSize, int leavesColor, boolean makeHangingLeaves) { for (int x = -leavesSize; x <= leavesSize; x++) { int offsetColor = leavesColor + Mth.nextInt(rand, leavesColor == 0 ? 0 : -1, leavesColor == 4 ? 0 : 1); for (int z = -leavesSize; z <= leavesSize; z++) { if (Math.abs(x) == leavesSize && Math.abs(z) == leavesSize) { continue; } - BlockPos leavesPos = new BlockPos(pos).offset(x, 0, z); - if (!filler.getEntries().containsKey(leavesPos)) { - filler.getEntries().put(leavesPos, new BlockStateEntry(BlockRegistry.SOULWOOD_LEAVES.get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, offsetColor))); - } - if (!filler.getEntries().containsKey(leavesPos.below())) { - if (rand.nextFloat() < (0.2f+leavesSize*0.2f)) { - int spawnHeight = 1 - rand.nextInt(3); - int length = leavesSize-2+rand.nextInt(3); - for (int i = spawnHeight; i <= length; i++) { - final int gradient = Mth.clamp(offsetColor+1-i, 0, 4); - BlockPos vinePos = leavesPos.below(i); - BlockState state = (i == length ? BlockRegistry.HANGING_MYSTIC_SOULWOOD_LEAVES : BlockRegistry.MYSTIC_SOULWOOD_LEAVES).get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, gradient); - filler.getEntries().put(vinePos, new BlockStateEntry(state)); + BlockPos leavesPos = pos.offset(x, 0, z); + if (makeHangingLeaves && !(x == 0 && z == 0)) { + final Vector2i column = new Vector2i(leavesPos.getX(), leavesPos.getZ()); + if (!hangingLeavesCoverage.contains(column)) { + if (rand.nextFloat() < (0.4f + leavesSize * 0.2f)) { + int length = leavesSize - 2 + RandomHelper.randomBetween(rand, 0, leavesSize); + if (length < 2) { + length-=2; + } + if (length < 2) { + continue; + } + int spawnHeight = rand.nextInt(2); + BlockPos.MutableBlockPos hangingLeavesPos = leavesPos.mutable().move(Direction.UP, spawnHeight); + for (int i = -spawnHeight; i <= length; i++) { + final int gradient = Mth.clamp(leavesColor + 1 + i, 0, 4); + BlockPos vinePos = hangingLeavesPos.move(Direction.DOWN).immutable(); + final boolean hanging = i == length; + BlockState state = (hanging ? BlockRegistry.HANGING_MYSTIC_SOULWOOD_LEAVES : BlockRegistry.MYSTIC_SOULWOOD_LEAVES).get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, gradient); + hangingLeavesFiller.getEntries().put(vinePos, new BlockStateEntry(state)); + if (hanging) { + hangingLeavesCoverage.add(column); + } + } } } } + else { + filler.getEntries().put(leavesPos, new BlockStateEntry(BlockRegistry.SOULWOOD_LEAVES.get().defaultBlockState().setValue(MalumLeavesBlock.COLOR, offsetColor))); + } } } } @@ -366,13 +410,14 @@ public static void generateBlight(ServerLevelAccessor level, LodestoneBlockFille if (level.getBlockState(blockPos.move(0, -1, 0)).is(DIRT)) { filler.getEntries().put(blockPos.immutable(), new BlockStateEntry(BlockRegistry.BLIGHTED_EARTH.get().defaultBlockState())); } - if (level.getRandom().nextFloat() < 0.75f) { + final RandomSource random = level.getRandom(); + if (random.nextFloat() < 0.75f) { BlockPos plantPos = blockPos.offset(0, 2, 0); BlockState blockState = level.getBlockState(plantPos); if (naturalNoiseValue > 2.5f) { if (lastSaplingPos == null || lastSaplingPos.distanceToSqr(plantPos.getX(), plantPos.getY(), plantPos.getZ()) > 5) { if (BlockHelper.fromBlockPos(center).distanceToSqr(plantPos.getX(), plantPos.getY(), plantPos.getZ()) > 4) { - if (level.getRandom().nextFloat() < 0.5f / (Math.pow(saplingsPlaced + 1, 2))) { + if (random.nextFloat() < 0.5f / (Math.pow(saplingsPlaced + 1, 2))) { filler.getEntries().put(plantPos, new BlockStateEntry(BlockRegistry.SOULWOOD_GROWTH.get().defaultBlockState())); lastSaplingPos = new Vec3(plantPos.getX(), plantPos.getY(), plantPos.getZ()); saplingsPlaced++; @@ -381,8 +426,12 @@ public static void generateBlight(ServerLevelAccessor level, LodestoneBlockFille } } if (!filler.getEntries().containsKey(plantPos)) { + BlockState state = (BlockRegistry.BLIGHTED_GROWTH).get().defaultBlockState(); + if (random.nextFloat() < 0.4f) { + state = BlockRegistry.CLINGING_BLIGHT.get().defaultBlockState().setValue(ClingingBlightBlock.BLIGHT_TYPE, GROUNDED_ROOTS).setValue(BlockStateProperties.HORIZONTAL_FACING, DIRECTIONS[random.nextInt(4)]); + } if ((blockState.isAir() || blockState.canBeReplaced()) && !blockState.is(BlockTagRegistry.BLIGHTED_PLANTS)) { - filler.getEntries().put(plantPos, new BlockStateEntry((BlockRegistry.BLIGHTED_GROWTH).get().defaultBlockState())); + filler.getEntries().put(plantPos, new BlockStateEntry(state)); } } } diff --git a/src/main/java/com/sammy/malum/data/MalumLang.java b/src/main/java/com/sammy/malum/data/MalumLang.java index 6ebce7f11..b291d87bb 100644 --- a/src/main/java/com/sammy/malum/data/MalumLang.java +++ b/src/main/java/com/sammy/malum/data/MalumLang.java @@ -372,7 +372,7 @@ protected void addTranslations() { addSimpleEntryHeader("impurity_stabilizer", "Impurity Stabilizer", "Potency from weakness"); addPages("impurity_stabilizer", - "The wicked spirit is, in most applications, drawn to the weak, seeking to cull. The Impurity Stabilizer takes advantage of that property, providing a powerful percentage bonus to the weakest crucible attribute, excluding fuel usage rate and instability, which receive a small improvement overall instead."); + "The wicked spirit is, in most applications, drawn to the weak, seeking to cull. The Impurity Stabilizer utilizes that property, providing a powerful percentage bonus to the weakest crucible attribute, excluding fuel usage rate and instability, which receive a small improvement overall instead."); addSimpleEntryHeader("shielding_apparatus", "Shielding Apparatus", "Alchemical protection"); addPages("shielding_apparatus", diff --git a/src/main/java/com/sammy/malum/data/block/MalumBlockLootTables.java b/src/main/java/com/sammy/malum/data/block/MalumBlockLootTables.java index 8e1cd402a..444dba8ff 100644 --- a/src/main/java/com/sammy/malum/data/block/MalumBlockLootTables.java +++ b/src/main/java/com/sammy/malum/data/block/MalumBlockLootTables.java @@ -90,8 +90,8 @@ protected void generate() { takeAll(blocks, b -> b.get().properties instanceof LodestoneBlockProperties && ((LodestoneBlockProperties) b.get().properties).getDatagenData().hasInheritedLootTable); - add(take(blocks, BlockRegistry.RUNEWOOD_LEAVES).get(), (b) -> createLeavesDrops(b, BlockRegistry.RUNEWOOD_SAPLING.get(), MAGIC_SAPLING_DROP_CHANCE)); - add(take(blocks, BlockRegistry.SOULWOOD_LEAVES).get(), (b) -> createLeavesDrops(b, BlockRegistry.SOULWOOD_GROWTH.get(), MAGIC_SAPLING_DROP_CHANCE)); + takeAll(blocks, BlockRegistry.RUNEWOOD_LEAVES, BlockRegistry.HANGING_RUNEWOOD_LEAVES).forEach((b) -> add(b.get(), createLeavesDrops(b.get(), BlockRegistry.RUNEWOOD_SAPLING.get(), MAGIC_SAPLING_DROP_CHANCE))); + takeAll(blocks, BlockRegistry.SOULWOOD_LEAVES, BlockRegistry.MYSTIC_SOULWOOD_LEAVES, BlockRegistry.HANGING_MYSTIC_SOULWOOD_LEAVES).forEach((b) -> add(b.get(), createLeavesDrops(b.get(), BlockRegistry.SOULWOOD_GROWTH.get(), MAGIC_SAPLING_DROP_CHANCE))); add(take(blocks, BlockRegistry.BLIGHTED_SOULWOOD).get(), createSingleItemTableWithSilkTouch(BlockRegistry.BLIGHTED_SOULWOOD.get(), ItemRegistry.SOULWOOD_LOG.get())); add(take(blocks, BlockRegistry.BLIGHTED_SOIL).get(), createBlightedDrop(BlockRegistry.BLIGHTED_SOIL.get(), 4)); diff --git a/src/main/java/com/sammy/malum/data/block/MalumBlockStateSmithTypes.java b/src/main/java/com/sammy/malum/data/block/MalumBlockStateSmithTypes.java index 263525bc9..c4e78cce9 100644 --- a/src/main/java/com/sammy/malum/data/block/MalumBlockStateSmithTypes.java +++ b/src/main/java/com/sammy/malum/data/block/MalumBlockStateSmithTypes.java @@ -45,6 +45,26 @@ public class MalumBlockStateSmithTypes { provider.getVariantBuilder(block).forAllStates(s -> ConfiguredModel.builder().modelFile(s.getValue(PrimordialSoupBlock.TOP) ? topModel : model).build()); }); + public static BlockStateSmith HANGING_RUNEWOOD_LEAVES = new BlockStateSmith<>(Block.class, ItemModelSmithTypes.AFFIXED_MODEL.apply("_0"), (block, provider) -> { + String name = provider.getBlockName(block); + Function modelProvider = (i) -> + provider.models().withExistingParent(name+"_"+i, malumPath("block/templates/template_hanging_leaves")).texture("hanging_leaves", provider.getBlockTexture(name + "_" + i)).texture("particle", provider.getBlockTexture(name + "_" + i)); + + ConfiguredModel.Builder builder = provider.getVariantBuilder(block).partialState().modelForState(); + + for (int i = 0; i < 3; i++) { + final ModelFile model = modelProvider.apply(i); + builder = builder.modelFile(model) + .nextModel().modelFile(model).rotationY(90) + .nextModel().modelFile(model).rotationY(180) + .nextModel().modelFile(model).rotationY(270); + if (i != 2) { + builder = builder.nextModel(); + } + } + builder.addModel(); + }); + public static BlockStateSmith CLINGING_BLIGHT = new BlockStateSmith<>(ClingingBlightBlock.class, ItemModelSmithTypes.GENERATED_ITEM, (block, provider) -> { String name = provider.getBlockName(block); ResourceLocation creeping = malumPath("block/templates/template_creeping_blight"); @@ -82,7 +102,6 @@ public class MalumBlockStateSmithTypes { .nextModel().modelFile(soil0).rotationY(90) .nextModel().modelFile(soil0).rotationY(180) .nextModel().modelFile(soil0).rotationY(270) - .nextModel().modelFile(soil1) .nextModel().modelFile(soil1).rotationY(90) .nextModel().modelFile(soil1).rotationY(180) @@ -94,10 +113,12 @@ public class MalumBlockStateSmithTypes { String name = provider.getBlockName(block); Function tumorFunction = (i) -> provider.models().withExistingParent(name + "_" + i, new ResourceLocation("block/cross")).texture("cross", malumPath("block/" + name + "_" + i)); - ConfiguredModel.Builder builder = provider.getVariantBuilder(block).partialState().modelForState() - .modelFile(tumorFunction.apply(0)); - for (int i = 1; i <= 9; i++) { - builder = builder.nextModel().modelFile(tumorFunction.apply(i)); + ConfiguredModel.Builder builder = provider.getVariantBuilder(block).partialState().modelForState(); + for (int i = 0; i < 10; i++) { + builder = builder.modelFile(tumorFunction.apply(i)); + if (i != 9) { + builder = builder.nextModel(); + } } builder.addModel(); }); diff --git a/src/main/java/com/sammy/malum/data/block/MalumBlockStates.java b/src/main/java/com/sammy/malum/data/block/MalumBlockStates.java index 7af7411a4..1ed73b876 100644 --- a/src/main/java/com/sammy/malum/data/block/MalumBlockStates.java +++ b/src/main/java/com/sammy/malum/data/block/MalumBlockStates.java @@ -111,6 +111,7 @@ protected void registerStatesAndModels() { BlockStateSmithTypes.LOG_BLOCK.act(data, RUNEWOOD_BEAM, RUNEWOOD_LOG, STRIPPED_RUNEWOOD_LOG, EXPOSED_RUNEWOOD_LOG, REVEALED_RUNEWOOD_LOG); BlockStateSmithTypes.WOOD_BLOCK.act(data, RUNEWOOD, STRIPPED_RUNEWOOD); BlockStateSmithTypes.LEAVES_BLOCK.act(data, RUNEWOOD_LEAVES); + MalumBlockStateSmithTypes.HANGING_RUNEWOOD_LEAVES.act(data, HANGING_RUNEWOOD_LEAVES); BlockStateSmithTypes.CROSS_MODEL_BLOCK.act(data, RUNEWOOD_SAPLING); BlockStateSmithTypes.BUTTON_BLOCK.act(data, RUNEWOOD_BUTTON); diff --git a/src/main/java/com/sammy/malum/data/recipe/MalumSpiritInfusionRecipes.java b/src/main/java/com/sammy/malum/data/recipe/MalumSpiritInfusionRecipes.java index e41dd44b9..96e096bca 100644 --- a/src/main/java/com/sammy/malum/data/recipe/MalumSpiritInfusionRecipes.java +++ b/src/main/java/com/sammy/malum/data/recipe/MalumSpiritInfusionRecipes.java @@ -112,9 +112,9 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(ItemRegistry.SOUL_STAINED_STEEL_INGOT.get(), 4) .addExtraItem(ItemRegistry.HEX_ASH.get(), 2) .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) - .addSpirit(EARTHEN_SPIRIT, 8) - .addSpirit(WICKED_SPIRIT, 4) - .addSpirit(ARCANE_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 16) + .addSpirit(WICKED_SPIRIT, 8) + .addSpirit(ARCANE_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.IRON_HELMET, 1, ItemRegistry.SOUL_STAINED_STEEL_HELMET.get(), 1) @@ -130,27 +130,27 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(ItemRegistry.SOUL_STAINED_STEEL_PLATING.get(), 6) .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(ItemRegistry.TWISTED_ROCK.get(), 8) - .addSpirit(EARTHEN_SPIRIT, 8) - .addSpirit(WICKED_SPIRIT, 4) - .addSpirit(ARCANE_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 16) + .addSpirit(WICKED_SPIRIT, 8) + .addSpirit(ARCANE_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.IRON_LEGGINGS, 1, ItemRegistry.SOUL_STAINED_STEEL_LEGGINGS.get(), 1) .addExtraItem(ItemRegistry.SOUL_STAINED_STEEL_PLATING.get(), 6) .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(ItemRegistry.TWISTED_ROCK.get(), 8) - .addSpirit(EARTHEN_SPIRIT, 8) - .addSpirit(WICKED_SPIRIT, 4) - .addSpirit(ARCANE_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 16) + .addSpirit(WICKED_SPIRIT, 8) + .addSpirit(ARCANE_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.IRON_BOOTS, 1, ItemRegistry.SOUL_STAINED_STEEL_BOOTS.get(), 1) .addExtraItem(ItemRegistry.SOUL_STAINED_STEEL_PLATING.get(), 6) .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(ItemRegistry.TWISTED_ROCK.get(), 8) - .addSpirit(EARTHEN_SPIRIT, 8) - .addSpirit(WICKED_SPIRIT, 4) - .addSpirit(ARCANE_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 16) + .addSpirit(WICKED_SPIRIT, 8) + .addSpirit(ARCANE_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Ingredient.of(ItemTags.WOOL), 2, ItemRegistry.SPIRIT_FABRIC.get(), 4) @@ -166,7 +166,7 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(Ingredient.of(Tags.Items.LEATHER), 2) .addSpirit(AERIAL_SPIRIT, 8) - .addSpirit(EARTHEN_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.LEATHER_CHESTPLATE, 1, ItemRegistry.SOUL_HUNTER_ROBE.get(), 1) @@ -174,7 +174,7 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(Ingredient.of(Tags.Items.LEATHER), 2) .addSpirit(AERIAL_SPIRIT, 8) - .addSpirit(EARTHEN_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.LEATHER_LEGGINGS, 1, ItemRegistry.SOUL_HUNTER_LEGGINGS.get(), 1) @@ -182,7 +182,7 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(ItemRegistry.PROCESSED_SOULSTONE.get(), 4) .addExtraItem(Ingredient.of(Tags.Items.LEATHER), 2) .addSpirit(AERIAL_SPIRIT, 8) - .addSpirit(EARTHEN_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(Items.LEATHER_BOOTS, 1, ItemRegistry.SOUL_HUNTER_BOOTS.get(), 1) @@ -191,7 +191,7 @@ protected static void buildRecipes(Consumer consumer) { .addExtraItem(Ingredient.of(Tags.Items.LEATHER), 2) .addExtraItem(Ingredient.of(Tags.Items.FEATHERS), 2) .addSpirit(AERIAL_SPIRIT, 8) - .addSpirit(EARTHEN_SPIRIT, 2) + .addSpirit(EARTHEN_SPIRIT, 8) .build(consumer); new SpiritInfusionRecipeBuilder(ItemRegistry.ORNATE_RING.get(), 1, ItemRegistry.RING_OF_ESOTERIC_SPOILS.get(), 1) diff --git a/src/main/java/com/sammy/malum/registry/common/block/BlockRegistry.java b/src/main/java/com/sammy/malum/registry/common/block/BlockRegistry.java index c7dcb998a..4cdbcee0b 100644 --- a/src/main/java/com/sammy/malum/registry/common/block/BlockRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/block/BlockRegistry.java @@ -35,6 +35,7 @@ import net.minecraftforge.registries.*; import team.lodestar.lodestone.systems.block.*; import team.lodestar.lodestone.systems.block.sign.*; +import team.lodestar.lodestone.systems.easing.*; import java.awt.*; @@ -191,7 +192,8 @@ public class BlockRegistry { //region runewood public static final RegistryObject RUNEWOOD_SAPLING = BLOCKS.register("runewood_sapling", () -> new MalumSaplingBlock(MalumBlockProperties.RUNEWOOD_SAPLING().setCutoutRenderType().randomTicks(), FeatureRegistry.RUNEWOOD_TREE)); - public static final RegistryObject RUNEWOOD_LEAVES = BLOCKS.register("runewood_leaves", () -> new MalumLeavesBlock(MalumBlockProperties.RUNEWOOD_LEAVES().setCutoutRenderType(), new Color(175, 65, 48), new Color(251, 193, 76))); + public static final RegistryObject RUNEWOOD_LEAVES = BLOCKS.register("runewood_leaves", () -> new MalumLeavesBlock(MalumBlockProperties.RUNEWOOD_LEAVES().setCutoutRenderType(), new Color(217, 110, 23), new Color(251, 193, 76))); + public static final RegistryObject HANGING_RUNEWOOD_LEAVES = BLOCKS.register("hanging_runewood_leaves", () -> new MalumHangingLeavesBlock(MalumBlockProperties.RUNEWOOD_LEAVES().setCutoutRenderType().noOcclusion().noCollission(), new Color(217, 110, 23), new Color(251, 193, 76))); public static final RegistryObject STRIPPED_RUNEWOOD_LOG = BLOCKS.register("stripped_runewood_log", () -> new RotatedPillarBlock(MalumBlockProperties.RUNEWOOD().addTags(LOGS, STRIPPED_LOGS, RUNEWOOD_LOGS))); public static final RegistryObject RUNEWOOD_LOG = BLOCKS.register("runewood_log", () -> new MalumLogBLock(MalumBlockProperties.RUNEWOOD().addTags(LOGS, RUNEWOOD_LOGS), STRIPPED_RUNEWOOD_LOG, false)); @@ -239,9 +241,9 @@ public class BlockRegistry { //region soulwood public static final RegistryObject SOULWOOD_GROWTH = BLOCKS.register("soulwood_growth", () -> new SoulwoodGrowthBlock(MalumBlockProperties.BLIGHTED_PLANTS().setCutoutRenderType().randomTicks(), FeatureRegistry.SOULWOOD_TREE)); - public static final RegistryObject SOULWOOD_LEAVES = BLOCKS.register("soulwood_leaves", () -> new MalumLeavesBlock(MalumBlockProperties.SOULWOOD_LEAVES().setCutoutRenderType(), new Color(187, 13, 59), new Color(255, 61, 243))); + public static final RegistryObject SOULWOOD_LEAVES = BLOCKS.register("soulwood_leaves", () -> new MalumLeavesBlock(MalumBlockProperties.SOULWOOD_LEAVES().setCutoutRenderType(), new Color(213, 8, 63), new Color(255, 61, 243))); public static final RegistryObject MYSTIC_SOULWOOD_LEAVES = BLOCKS.register("mystic_soulwood_leaves", () -> new MalumLeavesBlock(MalumBlockProperties.SOULWOOD_LEAVES().setCutoutRenderType(), new Color(213, 8, 63), new Color(255, 61, 243))); - public static final RegistryObject HANGING_MYSTIC_SOULWOOD_LEAVES = BLOCKS.register("hanging_mystic_soulwood_leaves", () -> new MalumHangingLeavesBlock(MalumBlockProperties.SOULWOOD_LEAVES().setCutoutRenderType(), new Color(213, 8, 63), new Color(255, 61, 243))); + public static final RegistryObject HANGING_MYSTIC_SOULWOOD_LEAVES = BLOCKS.register("hanging_mystic_soulwood_leaves", () -> new MalumHangingLeavesBlock(MalumBlockProperties.SOULWOOD_LEAVES().setCutoutRenderType().noOcclusion().noCollission(), new Color(213, 8, 63), new Color(255, 61, 243))); public static final RegistryObject STRIPPED_SOULWOOD_LOG = BLOCKS.register("stripped_soulwood_log", () -> new RotatedPillarBlock(MalumBlockProperties.SOULWOOD().addTags(LOGS, STRIPPED_LOGS, SOULWOOD_LOGS))); public static final RegistryObject SOULWOOD_LOG = BLOCKS.register("soulwood_log", () -> new SoulwoodLogBlock(MalumBlockProperties.SOULWOOD().addTags(LOGS, SOULWOOD_LOGS), STRIPPED_SOULWOOD_LOG, true)); @@ -371,14 +373,29 @@ public static void setBlockColors(RegisterColorHandlersEvent.Block event) { return -1; }, ETHER.get(), IRIDESCENT_ETHER.get()); blockColors.register((s, l, p, c) -> { - float i = s.getValue(MalumLeavesBlock.COLOR); - float max = MalumLeavesBlock.COLOR.getPossibleValues().size(); + float colorMax = MalumLeavesBlock.COLOR.getPossibleValues().size(); + float color = s.getValue(MalumLeavesBlock.COLOR); + float pct = (colorMax - (color / colorMax)); + float value = Easing.SINE_IN_OUT.ease(pct, 0, 1, 1); MalumLeavesBlock malumLeavesBlock = (MalumLeavesBlock) s.getBlock(); - int red = (int) Mth.lerp(i / max, malumLeavesBlock.minColor.getRed(), malumLeavesBlock.maxColor.getRed()); - int green = (int) Mth.lerp(i / max, malumLeavesBlock.minColor.getGreen(), malumLeavesBlock.maxColor.getGreen()); - int blue = (int) Mth.lerp(i / max, malumLeavesBlock.minColor.getBlue(), malumLeavesBlock.maxColor.getBlue()); + int red = (int) Mth.lerp(value, malumLeavesBlock.minColor.getRed(), malumLeavesBlock.maxColor.getRed()); + int green = (int) Mth.lerp(value, malumLeavesBlock.minColor.getGreen(), malumLeavesBlock.maxColor.getGreen()); + int blue = (int) Mth.lerp(value, malumLeavesBlock.minColor.getBlue(), malumLeavesBlock.maxColor.getBlue()); return red << 16 | green << 8 | blue; - }, RUNEWOOD_LEAVES.get(), SOULWOOD_LEAVES.get(), MYSTIC_SOULWOOD_LEAVES.get(), HANGING_MYSTIC_SOULWOOD_LEAVES.get()); + }, RUNEWOOD_LEAVES.get(), HANGING_RUNEWOOD_LEAVES.get()); + blockColors.register((s, l, p, c) -> { + float distanceMax = MalumLeavesBlock.DISTANCE.getPossibleValues().size(); + float distance = s.getValue(MalumLeavesBlock.DISTANCE); + float colorMax = MalumLeavesBlock.COLOR.getPossibleValues().size(); + float color = s.getValue(MalumLeavesBlock.COLOR); + float pct = Math.max((distanceMax - distance) / distanceMax, color / colorMax); + float value = Easing.SINE_IN_OUT.ease(pct, 0, 1, 1); + MalumLeavesBlock malumLeavesBlock = (MalumLeavesBlock) s.getBlock(); + int red = (int) Mth.lerp(value, malumLeavesBlock.minColor.getRed(), malumLeavesBlock.maxColor.getRed()); + int green = (int) Mth.lerp(value, malumLeavesBlock.minColor.getGreen(), malumLeavesBlock.maxColor.getGreen()); + int blue = (int) Mth.lerp(value, malumLeavesBlock.minColor.getBlue(), malumLeavesBlock.maxColor.getBlue()); + return red << 16 | green << 8 | blue; + }, SOULWOOD_LEAVES.get(), MYSTIC_SOULWOOD_LEAVES.get(), HANGING_MYSTIC_SOULWOOD_LEAVES.get()); } } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/registry/common/item/ItemRegistry.java b/src/main/java/com/sammy/malum/registry/common/item/ItemRegistry.java index 1db01fb78..13fa8b901 100644 --- a/src/main/java/com/sammy/malum/registry/common/item/ItemRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/item/ItemRegistry.java @@ -249,6 +249,7 @@ public static RegistryObject register(String name, Item.Prop public static final RegistryObject HOLY_CARAMEL = register("holy_caramel", NATURE_PROPERTIES(), (p) -> new HolyCaramelItem(FarmersDelightCompat.LOADED ? NATURE_PROPERTIES().food((new FoodProperties.Builder()).nutrition(4).saturationMod(0.15F).effect(() -> new MobEffectInstance(MobEffects.REGENERATION, 100, 0), 1).build()) : HIDDEN_PROPERTIES())); public static final RegistryObject RUNEWOOD_LEAVES = register("runewood_leaves", NATURE_PROPERTIES(), (p) -> new BlockItem(BlockRegistry.RUNEWOOD_LEAVES.get(), p)); + public static final RegistryObject HANGING_RUNEWOOD_LEAVES = register("hanging_runewood_leaves", NATURE_PROPERTIES(), (p) -> new BlockItem(BlockRegistry.HANGING_RUNEWOOD_LEAVES.get(), p)); public static final RegistryObject RUNEWOOD_SAPLING = register("runewood_sapling", NATURE_PROPERTIES(), (p) -> new BlockItem(BlockRegistry.RUNEWOOD_SAPLING.get(), p)); public static final RegistryObject RUNEWOOD_LOG = register("runewood_log", NATURE_PROPERTIES(), (p) -> new BlockItem(BlockRegistry.RUNEWOOD_LOG.get(), p)); diff --git a/src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_0.png b/src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_0.png new file mode 100644 index 0000000000000000000000000000000000000000..179a9e5d9a6f01a8e45ac10c7efee6304f54bc1d GIT binary patch literal 312 zcmV-80muG{P)k=*xv$PFKs z_uliDyJ$#)j(=U(ZX8FCDY`UG?*v-&JbTtYLrI9G zAx8B>3){AN21P|MsX~%wgb|vU>|h`YRpP8YZPCBxL=m-pm;ukJ=|Vx0u!S6JUI^lW z#zN3B(2y~HOAs5x`!kwLf=^~&5uBO*MDT2Oc!jG002ov KPDHLkV1fYr&xZ;C literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_1.png b/src/main/resources/assets/malum/textures/block/runewood/hanging_runewood_leaves_1.png new file mode 100644 index 0000000000000000000000000000000000000000..d10ff183092ba91e54be37c2169bc75ff3dc3d55 GIT binary patch literal 303 zcmV+~0nq-5P)Nklk)kMdXng*8&(FTY&CL3~4|QEz zQ53lGTb9N4eYdXbqMv1%ZQEvLS=xD?F;`WUy8y>=1QlY3VTgoH)5H?MkP-ttj$_1L z1R;b-Aa?!=Lc6*1tO0wt$uit;rEQrQtU z9TVak0ZA4`0-1DDS5zTiV+wpD&%GZ3D6o;>J5pW!b zN1f)TY1}kT9tbK@1|pY$oO_Cgmm<(qRh7dHgRH&xUaA0rP?z(#z=iVB08}v9=i9bz zh$Kh^q)K_72Nz_NLxzZ_K6+vV+2K(6xChzA4fWL7B?5(1l}NG*4E4{Ri-S}ZfNZAV z_%pl~@ebJEseTTn`!_&p_1n-b;Mbu);Qgi^s_VEBZ0@tQ00000NkvXXu0mjf001gb Bf@S~! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/malum/textures/block/runewood/runewood_leaves.png b/src/main/resources/assets/malum/textures/block/runewood/runewood_leaves.png index 4acc6a093e58f6836b69c9a425ad2d43289643bb..c4d81815c917b37a55c60affe30865941769db8e 100644 GIT binary patch delta 384 zcmV-`0e}9U1DgYoB!6N_L_t(IPj!>At%E=iMDMDA5Q#1zwB#-@L`bfH(54DvCFoymQX2>w5C!lx69sX*%;fcc0J4JsuCclOv`$_j#V3 zS22k+O+#_~A)tH*U<|_D@B1DSNs>74y%#HisE|1C95FKh3V%5ii;<+L0I>W0ZUACS zt*`6a^o`?q=}Zhs@+M}g7==s=I|a%JI~WPAIA}j@yL8rtKVG!0AFAT=x<(=KE>|$isb(TY7@Ic0C zq&Q4W5`X29gMHZXWm&>9k<<@_1ReH53JN*c-E0+qSthO%FykO=CGE1`lMM zMvBA4B=Ibd9PCX3$!VIxWg@8`2nkx;i}(8-_DDVaJn;~&YD{R8*iI2-Q8Rv7>Q002ovPDHLkV1i0Cv916B diff --git a/src/main/resources/assets/malum/textures/block/soulwood/mystic_soulwood_leaves.png b/src/main/resources/assets/malum/textures/block/soulwood/mystic_soulwood_leaves.png index d85bbde86efce64b2d4cdfcd3d6cdee4d7d19f4f..a67f7143cd180ace78053a89b96cdd4f8b283d9f 100644 GIT binary patch delta 397 zcmV;80doGN1E&L!B!6s4L_t(IPi>RIt%EQSMC~fVF;cpKBNAOC$~6^m1gb#d1fh#a z9HEOyIVM#&daFN{KmS`ofOkDRGrRWAId{L`!|8N#Jgn#QX%A~z7FU*Kj47^M&qmWU zp>12YZJQ-N9uIp9sH&P-Y==(m>lc}nj z0*EQhe`yy0vZw;cFbvj>X_`!Kp6B)tYd~WcNQVA6juwRUse?cig=eZrmI1rarC=9IwpQR$Q-zRK)Gh>< zu?r!~Sj9ZP3r8mM1krKsoO^z*-Z|&SaSTb4IBu?O+m4%c{Jkg&tI_3oY1=k*UFX(y zwc>f6?I|D*ox%CWzNdRtRsQ?^hRfyR_I-B22$fS-v-j9!T==mbVi^!UO;S002ovPDHLkU;}~x0BLEzIsgCw diff --git a/src/main/resources/assets/malum/textures/block/soulwood/soulwood_leaves.png b/src/main/resources/assets/malum/textures/block/soulwood/soulwood_leaves.png index 7a33232fb5fbcbe0b5b3d9d9fd629e588dfa7d14..0ea7848611d9b4e34151fbab3da5003b6ceadc43 100644 GIT binary patch delta 394 zcmV;50d@ZF0;B_wB!6j1L_t(IPj!>A&4WM;g?&>%8Hp{DG7@6|6;h@kDKh~zVT(wV zumut&TM&Jg-syz?|B9IS>}NmwU6|+jFf;ppzqW0gT`m_Z%MzEZ>*}^B3b#7M;;X7E z1OWJhQwadbmjVcgSk5#}7WREVvMjUb^BF4M{3ugq!N)|`Sk5qP`ZJc)qU>lLsRQOi^XU>F83?mtu&?>x^v zsjlmTAiy+KfeVKSynaK``g*s*)fLyx9|I%=Xu&4#}U?bP3ykzHPy;)vKxs0ud7`Dw!xI5r1S3ND_b|l~k1|P@(~F zp*GsKH4rND(Wm;Sm~S<;fOyk1J?K#xR(x+}>=99HOarOvtEpGfm-?QC0n~M!^q>v( zCorN|vi?j#$y^FR$y6oTi|GY5fiMe?bt$FCaZD98!jFg~zGv=1Sj$YTuj@*MY>Z67 z)79F$(F-hFi%e~@GJXe$Lq8&|{V0`4q&0IQ8<|G#f_JZOwjzS!Q7YzP3w=(=C@Iz@*fVj$J&NSJ3 zrh%P+HV`^6g5L$Gj9J+cfDVW2au3jqtqiz;&gce^f&~IPT$T%>W;Z<%0njNLFAFQqx=XMgU;LjLv-t@rv7x%SB^00000NkvXX Iu0mjf0FVIJ`2YX_ delta 466 zcmV;@0WJRQ1MCBkB!9C>L_t(IPi<2@NJ3E*zAo+MP$EKLDikyp4F-jav@|qIlnC~Q zAP|avAcB4<5Q>IZA=Tj6AmJzlIYf;?ftC=6ScA5^7~d!7;eF4uoOjQ==R4o|&bcnt z!y=JL8{y%R0RMh}ebN^S1(*H07LY{KJmS5#k6-%n(Ls8{*ne~YSpZ1B&t37tnVF*x z27~nFa+!W=dXj#Bd)Hz^03@U8ar&AU{QiJim=7zj$IbKWdtE(0y{Jm1(@JbPW`Xns z*hs}yt=UqIpFgd7_9ja`jMX(|o}ZG125^@vvNAmAyNCK&QGn0_K%&t(9U!q{v=J1+ zAl}w`N)!C>B!5jnv;sprnG3VSpc?>}l8bTW^ZB$fR;yK&&u7Wb0RRzq4)%yHG-dWe z13Lk2Ahe?e`xKxudX>KkWmE&m#F&R5wR(ePwNJ4QC$4?R*f@pAXkW8(}#s~_cs28~;giEvr zIb@{tZ*XyNap)gf8KKY`HCRxK(JP3cAR03&wZOr_A%X^>c=5f*@1;I(Iex$QyU*Qy z@1B7g*u>a?f@`OJlE3B(r|i!!?+o?NYc53K-d2F$rSmrSUVq02`?pQ59dRo#v=dK-)C#Hrwl*ULf2SG( zZcI@^l{x@K^sU914y8vT-wj*%ij-JrT?_S7fXaYWi-=&c2S_GHsha{+#s&i7?sRdv z<-!?f78{9?1Ex*E<*+I<{w1CO?D5CRBf~z3egW(?=41E_9S#zkl+71a5dm=6t=jI3 zWf6))7XXE!l6;}~4-k-XX};zW76yi;5kD5r7xFF#s{^hwRDvU_fz|(w$O;p|I)Gpa gP&K?hP<;CX8r}U7G<0H`00000NkvXXu0mjf04*HgMgRZ+ delta 493 zcmVP+C`4ft$In=>Qo|6_G?~IoQL+$OjH0`d4K*8@ z@@T{?l#(P$iY7^s#r2pxN^GV~);G#5L>5xi42mX69!*)XaP>d8@49pEoXzR`?stCY zoc}r3MmbE9Bo)`5s%rlFcz?%UQ52i`dDevpl;sG&yS{y8Uw>Cq#y%XLw19K~f{)@G z{9r|nv-f(v>{F=}`{tG=_H$D+dNm9{FtRQzZSjN3%4!O9`pM;V@cH8Ah0adT>ES_Z zCDwYs3e_E{{sZX-`bY-2nz$l(uf}m=fue|2Wta17%IUL)xgYuBeKFo jumvDk0%U}n1I4#L9vS=*bbmc=00000NkvXXu0mjfMt|!! diff --git a/src/main/resources/assets/malum/textures/item/warp_flux.png b/src/main/resources/assets/malum/textures/item/warp_flux.png new file mode 100644 index 0000000000000000000000000000000000000000..7167964e3a1063da9007d133f795b760ca3b340a GIT binary patch literal 450 zcmV;z0X_bSP)q`ChLzcO82YEj zF`W2!48stD1{5-xGJM{i#lY)1jp3=V8-^h$2EhCbaw^F7<8`tObFG^gl8@Fgd@L+w z*eSf2VXYt!iYrhI0BiD^&Cq}P0YlO)afUUgco~u>{$cpI^gF{mwU_YlM)nHa0GRC{ z|1zAZV_-08VqkDmVqn;J4{kfi3m~xSbt}V(D+|DSQ4FwPvSKLATm*48`vQim!VwH7 zo^gP^05Wvdj#*$YJbJqyy8*B$1DVVp&B-t~p9O5t+@A?3hJfVz|D6UK0(Sw(|DX^D zIaB)WE^yrQ_jf~FGw~1D>9DW>$zvD*QUHs0kP|_Mg?Xew!s1LFSTiUwfdE!7zzhJ< zpu__T4-f!_I7ma7Xf-(SKyr6)tYbL)awBRWBIgN^OF;bJuirDUiVA`?fdEJ&2*5O> s!~(8NWi0Lw&rrx3Ve0WFWnywV050;w5%LK7f&c&j07*qoM6N<$f(p^TNdN!< literal 0 HcmV?d00001