Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/generated/resources/assets/clinker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "clinker:block/carapace_husk"
}
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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<CarapaceHuskBlock> CODEC = simpleCodec(CarapaceHuskBlock::new);
public static final BooleanProperty DECAYING = BooleanProperty.create("decaying");

@Override
public MapCodec<CarapaceHuskBlock> codec() {
return CODEC;
}

public CarapaceHuskBlock(BlockBehaviour.Properties properties) {
super(properties);
this.registerDefaultState(this.stateDefinition.any()
.setValue(DECAYING, false)
);
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> 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);
}
}

}
7 changes: 7 additions & 0 deletions src/main/java/birsy/clinker/core/registry/ClinkerBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ public static BlockBehaviour.Properties getOthershoreWoodProperties(MapColor col
);

//Special
public static final DeferredBlock<Block> 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<Block> BLANK_SARCOPHAGUS = createBlock("blank_sarcophagus", () -> new SarcophagusBlock(BlockBehaviour.Properties.ofFullCopy(BRIMSTONE.get()).noOcclusion()));

public static void defineFlammability(FireBlock fire) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/assets/clinker/blockstates/carapace_husk.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
57 changes: 57 additions & 0 deletions src/main/resources/assets/clinker/models/block/carapace_husk.json
Original file line number Diff line number Diff line change
@@ -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]
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading