Geyser prototype
This commit is contained in:
parent
9504432cdd
commit
bf47e9a2b5
9 changed files with 254 additions and 5 deletions
|
@ -43,7 +43,7 @@ public class BlockBrimstone extends BlockBase {
|
|||
if (deactivate) {
|
||||
world.setBlockState(pos, getDefaultState().with(ACTIVATED, false));
|
||||
}
|
||||
else if (state.get(ACTIVATED)) {
|
||||
else if (state.get(ACTIVATED) && random.nextInt(16) == 0) {
|
||||
Direction dir = BlocksHelper.randomDirection(random);
|
||||
BlockPos side = pos.offset(dir);
|
||||
BlockState sideState = world.getBlockState(side);
|
||||
|
|
69
src/main/java/ru/betterend/blocks/BlockSulphuricGeyser.java
Normal file
69
src/main/java/ru/betterend/blocks/BlockSulphuricGeyser.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class BlockSulphuricGeyser extends BlockBaseNotFull implements FluidFillable {
|
||||
public BlockSulphuricGeyser() {
|
||||
super(FabricBlockSettings.of(Material.STONE)
|
||||
.breakByTool(FabricToolTags.PICKAXES)
|
||||
.sounds(BlockSoundGroup.STONE)
|
||||
.nonOpaque()
|
||||
.requiresTool());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
state = world.getBlockState(pos.down());
|
||||
return state.isOf(EndBlocks.SULPHURIC_ROCK.stone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (!canPlaceAt(state, world, pos)) {
|
||||
return Blocks.WATER.getDefaultState();
|
||||
}
|
||||
else {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
double x = pos.getX() + random.nextDouble();
|
||||
double y = pos.getY() + 0.9 + random.nextDouble() * 0.3;
|
||||
double z = pos.getZ() + random.nextDouble();
|
||||
world.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ import ru.betterend.blocks.BlockPythadendronSapling;
|
|||
import ru.betterend.blocks.BlockShadowBerry;
|
||||
import ru.betterend.blocks.BlockShadowGrass;
|
||||
import ru.betterend.blocks.BlockSulphurCrystal;
|
||||
import ru.betterend.blocks.BlockSulphuricGeyser;
|
||||
import ru.betterend.blocks.BlockTenaneaFlowers;
|
||||
import ru.betterend.blocks.BlockTenaneaSapling;
|
||||
import ru.betterend.blocks.BlockTerrain;
|
||||
|
@ -111,6 +112,8 @@ public class EndBlocks {
|
|||
public static final Block QUARTZ_PEDESTAL = registerBlock("quartz_pedestal", new PedestalVanilla(Blocks.QUARTZ_BLOCK));
|
||||
public static final Block PURPUR_PEDESTAL = registerBlock("purpur_pedestal", new PedestalVanilla(Blocks.PURPUR_BLOCK));
|
||||
|
||||
public static final Block SULPHURIC_GEYSER = registerBlock("sulphuric_geyser", new BlockSulphuricGeyser());
|
||||
|
||||
// Wooden Materials And Trees //
|
||||
public static final Block MOSSY_GLOWSHROOM_SAPLING = registerBlock("mossy_glowshroom_sapling", new BlockMossyGlowshroomSapling());
|
||||
public static final Block MOSSY_GLOWSHROOM_CAP = registerBlock("mossy_glowshroom_cap", new BlockMossyGlowshroomCap());
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
else if (dist < r2 * r2) {
|
||||
if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
|
||||
double v = noise.eval(x * 0.1, y * 0.1, z * 0.1) + noise.eval(x * 0.03, y * 0.03, z * 0.03) * 0.5;
|
||||
if (v < 0) {
|
||||
if (v > 0.4) {
|
||||
brimstone.add(bpos.toImmutable());
|
||||
}
|
||||
else {
|
||||
|
@ -129,7 +129,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(3) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||
.with(BlockSulphurCrystal.FACING, dir)
|
||||
|
|
|
@ -193,7 +193,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(3) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||
.with(BlockSulphurCrystal.FACING, dir)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"variants": {
|
||||
"": [
|
||||
{ "model": "betterend:block/sulphuric_geyser" },
|
||||
{ "model": "betterend:block/sulphuric_geyser", "y": 90 },
|
||||
{ "model": "betterend:block/sulphuric_geyser", "y": 180 },
|
||||
{ "model": "betterend:block/sulphuric_geyser", "y": 270 }
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
{
|
||||
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"particle": "betterend:block/sulphuric_rock",
|
||||
"texture": "betterend:block/sulphuric_rock",
|
||||
"rock_top": "betterend:block/sulphuric_rock_top",
|
||||
"geyser_top": "betterend:block/geyser_top"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 9, 10, 8 ],
|
||||
"to": [ 13, 16, 12 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 0, 0, 4, 4 ], "texture": "#geyser_top", "cullface": "up" },
|
||||
"north": { "uv": [ 3, 0, 7, 6 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 9, 0, 13, 6 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 8, 0, 12, 6 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 4, 0, 8, 6 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 8, 0, 7 ],
|
||||
"to": [ 14, 10, 13 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5, 5, 11, 11 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 10, 5, 16, 11 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 5, 6, 11, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5, 6, 11, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5, 6, 11, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 5, 6, 11, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 4, 0, 1 ],
|
||||
"to": [ 8, 5, 5 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 4, 11, 8, 15 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 4, 1, 8, 5 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 8, 11, 12, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 1, 11, 5, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 11, 11, 15, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 5, 5, 2 ],
|
||||
"to": [ 7, 11, 4 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 0, 4, 2, 6 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 8, 5, 10, 11 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 5, 8, 11 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 1, 5, 3, 11 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 13, 5, 15, 11 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 1, 0, 8 ],
|
||||
"to": [ 5, 8, 12 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 1, 4, 5, 8 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 5, 12, 9, 16 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 11, 8, 15, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 1, 8, 5, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 8, 8, 12, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 4, 8, 8, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 2, 8, 9 ],
|
||||
"to": [ 4, 14, 11 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 0, 4, 2, 6 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 12, 2, 14, 8 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 2, 2, 4, 8 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 9, 2, 11, 8 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 5, 2, 7, 8 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 2, 0, 4 ],
|
||||
"to": [ 5, 4, 7 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 2, 9, 5, 12 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 9, 13, 12, 16 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 11, 12, 14, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 2, 12, 5, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 4, 12, 7, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 9, 12, 12, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 3, 0, 13 ],
|
||||
"to": [ 6, 4, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 3, 0, 6, 3 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 9, 0, 12, 3 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 10, 12, 13, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 3, 12, 6, 16 ], "texture": "#texture", "cullface": "south" },
|
||||
"west": { "uv": [ 13, 12, 16, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 0, 12, 3, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 12, 0, 2 ],
|
||||
"to": [ 15, 4, 5 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 12, 11, 15, 14 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 9, 13, 12, 16 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 1, 12, 4, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 12, 12, 15, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 2, 12, 5, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 11, 12, 14, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 7, 0, 3 ],
|
||||
"to": [ 12, 7, 8 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 7, 8, 12, 13 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 4, 0, 9, 5 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 4, 9, 9, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 7, 9, 12, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 3, 9, 8, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 8, 9, 13, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 4, 0, 9 ],
|
||||
"to": [ 9, 7, 14 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 4, 2, 9, 7 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 4, 0, 9, 5 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 7, 9, 12, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 4, 9, 9, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 9, 9, 14, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 2, 9, 7, 16 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box7",
|
||||
"from": [ 3, 0, 5 ],
|
||||
"to": [ 8, 9, 10 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 3, 6, 8, 11 ], "texture": "#rock_top", "cullface": "down" },
|
||||
"up": { "uv": [ 4, 0, 9, 5 ], "texture": "#geyser_top" },
|
||||
"north": { "uv": [ 8, 7, 13, 16 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 3, 7, 8, 16 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5, 7, 10, 16 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 7, 11, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "betterend:block/sulphuric_geyser"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
Loading…
Add table
Add a link
Reference in a new issue