Skip to content

Commit efdaba6

Browse files
committed
Cracked Ice
Geyser no tex
1 parent 2e3cba4 commit efdaba6

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.ethanicuss.astraladditions.blocks;
2+
3+
import com.github.ethanicuss.astraladditions.util.ModUtils;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.block.BlockState;
6+
import net.minecraft.block.Material;
7+
import net.minecraft.enchantment.EnchantmentHelper;
8+
import net.minecraft.entity.Entity;
9+
import net.minecraft.entity.FallingBlockEntity;
10+
import net.minecraft.entity.LivingEntity;
11+
import net.minecraft.entity.damage.DamageSource;
12+
import net.minecraft.particle.ParticleTypes;
13+
import net.minecraft.server.world.ServerWorld;
14+
import net.minecraft.tag.BlockTags;
15+
import net.minecraft.util.math.BlockPos;
16+
import net.minecraft.world.World;
17+
18+
public class CrackedIceBlock extends Block {
19+
20+
public CrackedIceBlock(Settings settings) {
21+
super(settings);
22+
}
23+
24+
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
25+
if (canFallThrough(world.getBlockState(pos.down())) && pos.getY() >= world.getBottomY()) {
26+
FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, pos, state);
27+
}
28+
29+
super.onSteppedOn(world, pos, state, entity);
30+
}
31+
32+
public static boolean canFallThrough(BlockState state) {
33+
Material material = state.getMaterial();
34+
return state.isAir() || state.isIn(BlockTags.FIRE) || material.isLiquid() || material.isReplaceable();
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.github.ethanicuss.astraladditions.blocks;
2+
3+
import com.github.ethanicuss.astraladditions.util.ModUtils;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.block.BlockState;
6+
import net.minecraft.enchantment.EnchantmentHelper;
7+
import net.minecraft.entity.Entity;
8+
import net.minecraft.entity.LivingEntity;
9+
import net.minecraft.entity.damage.DamageSource;
10+
import net.minecraft.particle.ParticleTypes;
11+
import net.minecraft.server.world.ServerWorld;
12+
import net.minecraft.util.math.BlockPos;
13+
import net.minecraft.world.World;
14+
15+
public class GeyserBlock extends Block {
16+
17+
public GeyserBlock(Settings settings) {
18+
super(settings);
19+
}
20+
21+
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
22+
if (!entity.isFireImmune() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity)) {
23+
entity.damage(DamageSource.HOT_FLOOR, 3.0F);
24+
}
25+
entity.addVelocity(0, 1, 0);
26+
27+
if (world instanceof ServerWorld) {
28+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.BUBBLE, pos.getX(), pos.getY() + 1.5, pos.getZ(), 20, 0.3, 3, 0.3, 0.1);
29+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.CLOUD, pos.getX(), pos.getY() + 2, pos.getZ(), 20, 0.5, 4, 0.5, 0.1);
30+
}
31+
32+
super.onSteppedOn(world, pos, state, entity);
33+
}
34+
}

src/main/java/com/github/ethanicuss/astraladditions/registry/ModBlocks.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ private static ToIntFunction<BlockState> createLightLevelFromLitBlockState(int l
5959

6060
public static final Block MISSING_BLOCK = new MissingBlock(FabricBlockSettings.of(Material.LAVA).ticksRandomly().sounds(BlockSoundGroup.CROP).collidable(false).nonOpaque().allowsSpawning(ModBlocks::never).suffocates(ModBlocks::never));
6161

62+
public static final Block PRISMATIC_GEYSER_BLOCK = new GeyserBlock(FabricBlockSettings.of(Material.STONE).ticksRandomly().sounds(BlockSoundGroup.STONE).allowsSpawning(ModBlocks::never));
63+
public static final Block CRACKED_ICE_BLOCK = new CrackedIceBlock(FabricBlockSettings.of(Material.ICE).ticksRandomly().sounds(BlockSoundGroup.GLASS).allowsSpawning(ModBlocks::never));
64+
6265
public static final Block ENDERRACK_BLOCK = new Block(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.NETHERRACK).strength(2.0f));
6366
public static final BlockItem ENDERRACK_ITEM = new BlockItem(ENDERRACK_BLOCK, new FabricItemSettings().group(ItemGroup.BUILDING_BLOCKS));
6467
public static final Block TWISTED_NYLIUM_BLOCK = new Block(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.NYLIUM).strength(2.5f));
@@ -120,6 +123,8 @@ public static void registerBlocks() {
120123
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "bramblebone"), BRAMBLEBONE_BLOCK);
121124
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "bramblebone"), BRAMBLEBONE_ITEM);
122125
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "missing_block"), MISSING_BLOCK);
126+
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "prismatic_geyser"), PRISMATIC_GEYSER_BLOCK);
127+
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "cracked_ice"), CRACKED_ICE_BLOCK);
123128
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "enderrack"), ENDERRACK_BLOCK);
124129
Registry.register(Registry.ITEM, new Identifier(AstralAdditions.MOD_ID, "enderrack"), ENDERRACK_ITEM);
125130
Registry.register(Registry.BLOCK, new Identifier(AstralAdditions.MOD_ID, "twisted_nylium"), TWISTED_NYLIUM_BLOCK);

0 commit comments

Comments
 (0)