Skip to content

Commit

Permalink
+ visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyof429 committed Aug 19, 2024
1 parent cd94e57 commit 3fb4abd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static void register() {


public static final Block LUMINOUS_FUNGUS = ModRegistry.ofBlock("luminous_fungus",
new LuminousFungusBlock(FabricBlockSettings.copyOf(Blocks.WARPED_FUNGUS).luminance(10).ticksRandomly()))
new LuminousFungusBlock(FabricBlockSettings.copyOf(Blocks.WARPED_FUNGUS)
.luminance(a -> a.get(LuminousFungusBlock.IS_LIT) ? 15 : 0).ticksRandomly()))
.drop().cutout().build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.PlantBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
Expand All @@ -13,11 +14,13 @@
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.world.BlockView;
import net.minecraft.world.World;

public class LuminousFungusBlock extends PlantBlock {
public static final BooleanProperty IS_LIT = BooleanProperty.of("is_lit");
public static final VoxelShape BOX = Block.createCuboidShape(4, 0, 4, 12, 8, 12);

public LuminousFungusBlock(Settings settings) {
super(settings);
Expand All @@ -34,6 +37,11 @@ protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos)
return floor.isSideSolidFullSquare(world, pos, Direction.UP);
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return BOX;
}

@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
super.onEntityCollision(state, world, pos, entity);
Expand Down

0 comments on commit 3fb4abd

Please sign in to comment.