-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95be990
commit f3937b9
Showing
18 changed files
with
254 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,5 @@ | |
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "hollow:blocks/cattail" | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/generated/data/hollow/loot_table/blocks/cattail_stem.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "hollow:cattail" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,5 @@ | |
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "hollow:blocks/twig" | ||
] | ||
} |
23 changes: 0 additions & 23 deletions
23
src/main/generated/data/minecraft/worldgen/placed_feature/flower_swamp.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/main/java/dev/spiritstudios/hollow/block/CattailStemBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package dev.spiritstudios.hollow.block; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.MapCodec; | ||
import dev.spiritstudios.hollow.registry.HollowBlockRegistrar; | ||
import net.minecraft.block.*; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.fluid.Fluid; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.fluid.Fluids; | ||
import net.minecraft.item.ItemPlacementContext; | ||
import net.minecraft.registry.tag.FluidTags; | ||
import net.minecraft.state.StateManager; | ||
import net.minecraft.state.property.BooleanProperty; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.util.shape.VoxelShape; | ||
import net.minecraft.util.shape.VoxelShapes; | ||
import net.minecraft.world.*; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class CattailStemBlock extends AbstractPlantBlock implements FluidFillable { | ||
public static final MapCodec<CattailStemBlock> CODEC = createCodec(CattailStemBlock::new); | ||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; | ||
public static final BooleanProperty BOTTOM = Properties.BOTTOM; | ||
|
||
public CattailStemBlock(AbstractBlock.Settings settings) { | ||
super(settings, Direction.UP, VoxelShapes.fullCube(), true); | ||
setDefaultState(getDefaultState().with(BOTTOM, false)); | ||
} | ||
|
||
@Override | ||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { | ||
super.appendProperties(builder); | ||
builder.add(WATERLOGGED, BOTTOM); | ||
} | ||
|
||
@Override | ||
protected MapCodec<CattailStemBlock> getCodec() { | ||
return CODEC; | ||
} | ||
|
||
@Override | ||
protected AbstractPlantStemBlock getStem() { | ||
return HollowBlockRegistrar.CATTAIL; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public BlockState getPlacementState(ItemPlacementContext ctx) { | ||
BlockState below = ctx.getWorld().getBlockState(ctx.getBlockPos().down()); | ||
|
||
return super.getPlacementState(ctx) | ||
.with(WATERLOGGED, ctx.getWorld().isWater(ctx.getBlockPos())) | ||
.with(BOTTOM, !below.isOf(this) && !below.isOf(getStem())); | ||
} | ||
|
||
@Override | ||
protected BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { | ||
if (direction != Direction.DOWN) return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos).withIfExists(WATERLOGGED, world.isWater(pos)); | ||
|
||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos) | ||
.withIfExists(BOTTOM, !neighborState.isOf(this) && !neighborState.isOf(getStem())) | ||
.withIfExists(WATERLOGGED, world.isWater(pos)); | ||
} | ||
|
||
@Override | ||
protected FluidState getFluidState(BlockState state) { | ||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); | ||
} | ||
|
||
@Override | ||
public boolean canFillWithFluid(@Nullable PlayerEntity player, BlockView world, BlockPos pos, BlockState state, Fluid fluid) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.