forked from ethanicusss/AstralAdditions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrackedIceBlock.java
More file actions
33 lines (27 loc) · 1.37 KB
/
CrackedIceBlock.java
File metadata and controls
33 lines (27 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.github.ethanicuss.astraladditions.blocks;
import com.github.ethanicuss.astraladditions.util.ModUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class CrackedIceBlock extends Block {
public CrackedIceBlock(Settings settings) {
super(settings);
}
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
if (canFallThrough(world.getBlockState(pos.down())) && pos.getY() >= world.getBottomY() && !world.isClient()) {
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SNOWFLAKE, pos.getX(), pos.getY(), pos.getZ(), 20, 0.5, 0.5, 0.5, 0.3);
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.CAMPFIRE_COSY_SMOKE, pos.getX(), pos.getY(), pos.getZ(), 3, 0.5, 0.5, 0.5, 0);
}
super.onSteppedOn(world, pos, state, entity);
}
public static boolean canFallThrough(BlockState state) {
Material material = state.getMaterial();
return state.isAir() || state.isIn(BlockTags.FIRE) || material.isLiquid() || material.isReplaceable();
}
}