Skip to content

Commit

Permalink
feat: MixedSlabs (WIP)
Browse files Browse the repository at this point in the history
Add blastResistance and onSteppedOn
  • Loading branch information
xYundy committed May 1, 2024
1 parent a6795e6 commit db5d919
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import pl.xyundy.squaredadditions.block.entity.MixedSlabBlockEntity;

Expand Down Expand Up @@ -43,4 +47,15 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.ENTITYBLOCK_ANIMATED;
}
}

@Override
public void onSteppedOn(World world, BlockPos blockPos, BlockState blockState, Entity entity) {
//TODO support vertical blocks - should I run function from both blocks, or random or what?
this.topSlabState.getBlock().onSteppedOn(world, blockPos, blockState, entity);
}

@Override
public float getBlastResistance() {
return Math.max(this.topSlabState.getBlock().getBlastResistance(), this.bottomSlabState.getBlock().getBlastResistance());
}
}

0 comments on commit db5d919

Please sign in to comment.