diff --git a/src/generated/resources/assets/clinker/lang/en_us.json b/src/generated/resources/assets/clinker/lang/en_us.json index e0913c6f..96325367 100644 --- a/src/generated/resources/assets/clinker/lang/en_us.json +++ b/src/generated/resources/assets/clinker/lang/en_us.json @@ -44,6 +44,7 @@ "block.clinker.capstone_slab": "Capstone Slab", "block.clinker.capstone_stairs": "Capstone Stairs", "block.clinker.capstone_wall": "Capstone Wall", + "block.clinker.carapace_husk": "Carapace Husk", "block.clinker.cave_fig_roots": "Cave Fig Roots", "block.clinker.cave_fig_stem": "Cave Fig Stem", "block.clinker.cave_sprouts": "Cave Sprouts", diff --git a/src/generated/resources/assets/clinker/models/item/carapace_husk.json b/src/generated/resources/assets/clinker/models/item/carapace_husk.json new file mode 100644 index 00000000..a762eaa5 --- /dev/null +++ b/src/generated/resources/assets/clinker/models/item/carapace_husk.json @@ -0,0 +1,3 @@ +{ + "parent": "clinker:block/carapace_husk" +} \ No newline at end of file diff --git a/src/generated/resources/data/clinker/loot_table/blocks/carapace_husk.json b/src/generated/resources/data/clinker/loot_table/blocks/carapace_husk.json new file mode 100644 index 00000000..f1abfcb7 --- /dev/null +++ b/src/generated/resources/data/clinker/loot_table/blocks/carapace_husk.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "clinker:carapace_husk" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "clinker:blocks/carapace_husk" +} \ No newline at end of file diff --git a/src/main/java/birsy/clinker/common/world/block/CarapaceHuskBlock.java b/src/main/java/birsy/clinker/common/world/block/CarapaceHuskBlock.java new file mode 100644 index 00000000..424f9c61 --- /dev/null +++ b/src/main/java/birsy/clinker/common/world/block/CarapaceHuskBlock.java @@ -0,0 +1,72 @@ +package birsy.clinker.common.world.block; + +import birsy.clinker.core.registry.ClinkerBlocks; +import com.mojang.serialization.MapCodec; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.Tilt; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.ticks.ScheduledTick; + +public class CarapaceHuskBlock extends HorizontalDirectionalBlock { + public static final MapCodec CODEC = simpleCodec(CarapaceHuskBlock::new); + public static final BooleanProperty DECAYING = BooleanProperty.create("decaying"); + + @Override + public MapCodec codec() { + return CODEC; + } + + public CarapaceHuskBlock(BlockBehaviour.Properties properties) { + super(properties); + this.registerDefaultState(this.stateDefinition.any() + .setValue(DECAYING, false) + ); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, DECAYING); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); + } + + @Override + public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) { + if (!state.getValue(DECAYING) && !level.isClientSide) { + int i = level.random.nextIntBetweenInclusive(10, 15); + level.playSound(null, entity, SoundEvents.FUNGUS_STEP, entity.getSoundSource(), 0.125F, 0.125F); + level.setBlock(pos, state.setValue(DECAYING, true), 2); + level.scheduleTick(pos, this, i); + } + super.stepOn(level, pos, state, entity); + } + + @Override + protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { + if (state.getValue(DECAYING)) { + level.destroyBlock(pos, true); + } + } + +} diff --git a/src/main/java/birsy/clinker/core/registry/ClinkerBlocks.java b/src/main/java/birsy/clinker/core/registry/ClinkerBlocks.java index 38423a49..17570ad9 100644 --- a/src/main/java/birsy/clinker/core/registry/ClinkerBlocks.java +++ b/src/main/java/birsy/clinker/core/registry/ClinkerBlocks.java @@ -482,6 +482,13 @@ public static BlockBehaviour.Properties getOthershoreWoodProperties(MapColor col ); //Special + public static final DeferredBlock CARAPACE_HUSK = createBlock("carapace_husk", () -> new CarapaceHuskBlock(BlockBehaviour.Properties.of() + .noOcclusion() + .pushReaction(PushReaction.DESTROY) + .strength(0.4F) + .mapColor(MapColor.TERRACOTTA_GRAY) + .sound(SoundType.FROGLIGHT) + )); public static final DeferredBlock BLANK_SARCOPHAGUS = createBlock("blank_sarcophagus", () -> new SarcophagusBlock(BlockBehaviour.Properties.ofFullCopy(BRIMSTONE.get()).noOcclusion())); public static void defineFlammability(FireBlock fire) { diff --git a/src/main/java/birsy/clinker/core/registry/ClinkerCreativeModeTabs.java b/src/main/java/birsy/clinker/core/registry/ClinkerCreativeModeTabs.java index 93bc0a3e..89f9a167 100644 --- a/src/main/java/birsy/clinker/core/registry/ClinkerCreativeModeTabs.java +++ b/src/main/java/birsy/clinker/core/registry/ClinkerCreativeModeTabs.java @@ -146,6 +146,7 @@ public static void addBlocks(CreativeModeTab.ItemDisplayParameters pParameters, pOutput.accept(STROMATOLITE.get()); + pOutput.accept(CARAPACE_HUSK.get()); pOutput.accept(PEAT_MOSS.get()); pOutput.accept(PEAT_MOSS_BUDS.get()); pOutput.accept(INDIGO_TORMENTIL.get()); diff --git a/src/main/java/birsy/clinker/datagen/providers/ClinkerBlockStateProvider.java b/src/main/java/birsy/clinker/datagen/providers/ClinkerBlockStateProvider.java index 791aceb8..f01e4474 100644 --- a/src/main/java/birsy/clinker/datagen/providers/ClinkerBlockStateProvider.java +++ b/src/main/java/birsy/clinker/datagen/providers/ClinkerBlockStateProvider.java @@ -617,6 +617,11 @@ protected void registerStatesAndModels() { ); this.flatBlockItem(CAVE_SPROUTS.get()); + this.simpleBlockItem( + CARAPACE_HUSK.get(), + this.models().getExistingFile(this.modLoc(ModelProvider.BLOCK_FOLDER + "/" + "carapace_husk")) + ); + this.simpleBlockItem( PEAT_MOSS.get(), this.models().getExistingFile(this.modLoc(ModelProvider.BLOCK_FOLDER + "/" + "peat_moss")) diff --git a/src/main/resources/assets/clinker/blockstates/carapace_husk.json b/src/main/resources/assets/clinker/blockstates/carapace_husk.json new file mode 100644 index 00000000..ed748fa3 --- /dev/null +++ b/src/main/resources/assets/clinker/blockstates/carapace_husk.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=east": { + "model": "clinker:block/carapace_husk", + "y": 90 + }, + "facing=north": { + "model": "clinker:block/carapace_husk" + }, + "facing=south": { + "model": "clinker:block/carapace_husk", + "y": 180 + }, + "facing=west": { + "model": "clinker:block/carapace_husk", + "y": 270 + } + } +} diff --git a/src/main/resources/assets/clinker/models/block/carapace_husk.json b/src/main/resources/assets/clinker/models/block/carapace_husk.json new file mode 100644 index 00000000..d4227530 --- /dev/null +++ b/src/main/resources/assets/clinker/models/block/carapace_husk.json @@ -0,0 +1,57 @@ +{ + "format_version": "1.21.11", + "credit": "Made with Blockbench", + "textures": { + "0": "clinker:block/carapace_husk_bottom", + "1": "clinker:block/carapace_husk_end", + "2": "clinker:block/carapace_husk_side", + "3": "clinker:block/carapace_husk_side_1", + "4": "clinker:block/carapace_husk_top", + "particle": "clinker:block/carapace_husk_bottom" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#3"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#4"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, -135, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, -135, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/clinker/textures/block/carapace_husk_bottom.png b/src/main/resources/assets/clinker/textures/block/carapace_husk_bottom.png new file mode 100644 index 00000000..3ca46d81 Binary files /dev/null and b/src/main/resources/assets/clinker/textures/block/carapace_husk_bottom.png differ diff --git a/src/main/resources/assets/clinker/textures/block/carapace_husk_end.png b/src/main/resources/assets/clinker/textures/block/carapace_husk_end.png new file mode 100644 index 00000000..57ebf837 Binary files /dev/null and b/src/main/resources/assets/clinker/textures/block/carapace_husk_end.png differ diff --git a/src/main/resources/assets/clinker/textures/block/carapace_husk_side.png b/src/main/resources/assets/clinker/textures/block/carapace_husk_side.png new file mode 100644 index 00000000..f82ea1b6 Binary files /dev/null and b/src/main/resources/assets/clinker/textures/block/carapace_husk_side.png differ diff --git a/src/main/resources/assets/clinker/textures/block/carapace_husk_side_1.png b/src/main/resources/assets/clinker/textures/block/carapace_husk_side_1.png new file mode 100644 index 00000000..ce764be9 Binary files /dev/null and b/src/main/resources/assets/clinker/textures/block/carapace_husk_side_1.png differ diff --git a/src/main/resources/assets/clinker/textures/block/carapace_husk_top.png b/src/main/resources/assets/clinker/textures/block/carapace_husk_top.png new file mode 100644 index 00000000..52ccc949 Binary files /dev/null and b/src/main/resources/assets/clinker/textures/block/carapace_husk_top.png differ