Merge branch 'master' of https://github.com/paulevsGitch/BetterEnd
This commit is contained in:
commit
e6a09c53aa
49 changed files with 988 additions and 43 deletions
|
@ -47,4 +47,14 @@ public class BlockBubbleCoral extends BlockUnderwaterPlant {
|
|||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
@ -26,6 +27,7 @@ import net.minecraft.util.math.Direction;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
|
@ -103,4 +105,14 @@ public class BlockEndLily extends BlockUnderwaterPlant {
|
|||
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
|
||||
return new ItemStack(EndBlocks.END_LILY_SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
90
src/main/java/ru/betterend/blocks/BlockHydralux.java
Normal file
90
src/main/java/ru/betterend/blocks/BlockHydralux.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
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.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.BlockProperties.HydraluxShape;
|
||||
import ru.betterend.blocks.basis.BlockUnderwaterPlant;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class BlockHydralux extends BlockUnderwaterPlant {
|
||||
public static final EnumProperty<HydraluxShape> SHAPE = BlockProperties.HYDRALUX_SHAPE;
|
||||
|
||||
public BlockHydralux() {
|
||||
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.WET_GRASS)
|
||||
.breakByHand(true)
|
||||
.luminance((state) -> { return state.get(SHAPE).hasGlow() ? 15 : 0; })
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(SHAPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
BlockState down = world.getBlockState(pos.down());
|
||||
HydraluxShape shape = state.get(SHAPE);
|
||||
if (shape == HydraluxShape.FLOWER_BIG_TOP || shape == HydraluxShape.FLOWER_SMALL_TOP) {
|
||||
return down.isOf(this);
|
||||
}
|
||||
else if (shape == HydraluxShape.ROOTS) {
|
||||
return down.isOf(EndBlocks.SULPHURIC_ROCK.stone) && world.getBlockState(pos.up()).isOf(this);
|
||||
}
|
||||
else {
|
||||
return down.isOf(this) && world.getBlockState(pos.up()).isOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
|
||||
return new ItemStack(EndBlocks.HYDRALUX_SAPLING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
HydraluxShape shape = state.get(SHAPE);
|
||||
if (shape == HydraluxShape.FLOWER_BIG_BOTTOM || shape == HydraluxShape.FLOWER_SMALL_BOTTOM) {
|
||||
return Lists.newArrayList(new ItemStack(EndItems.HYDRALUX_PETAL, MHelper.randRange(1, 4, MHelper.RANDOM)));
|
||||
}
|
||||
else if (shape == HydraluxShape.ROOTS) {
|
||||
return Lists.newArrayList(new ItemStack(EndBlocks.HYDRALUX_SAPLING, MHelper.randRange(1, 2, MHelper.RANDOM)));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
49
src/main/java/ru/betterend/blocks/BlockHydraluxSapling.java
Normal file
49
src/main/java/ru/betterend/blocks/BlockHydraluxSapling.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.BlockProperties.HydraluxShape;
|
||||
import ru.betterend.blocks.basis.BlockUnderwaterPlantWithAge;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class BlockHydraluxSapling extends BlockUnderwaterPlantWithAge {
|
||||
@Override
|
||||
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
|
||||
int h = MHelper.randRange(4, 8, random);
|
||||
Mutable mut = new Mutable().set(pos);
|
||||
|
||||
for (int i = 1; i < h; i++) {
|
||||
mut.setY(pos.getY() + i);
|
||||
if (!world.getBlockState(mut).isOf(Blocks.WATER)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mut.setY(pos.getY());
|
||||
BlockState state = EndBlocks.HYDRALUX.getDefaultState();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state.with(BlockProperties.HYDRALUX_SHAPE, HydraluxShape.ROOTS));
|
||||
for (int i = 1; i < h - 2; i++) {
|
||||
mut.setY(pos.getY() + i);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state.with(BlockProperties.HYDRALUX_SHAPE, HydraluxShape.VINE));
|
||||
}
|
||||
|
||||
mut.setY(mut.getY() + 1);
|
||||
boolean big = random.nextBoolean();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state.with(BlockProperties.HYDRALUX_SHAPE, big ? HydraluxShape.FLOWER_BIG_BOTTOM : HydraluxShape.FLOWER_SMALL_BOTTOM));
|
||||
|
||||
mut.setY(mut.getY() + 1);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state.with(BlockProperties.HYDRALUX_SHAPE, big ? HydraluxShape.FLOWER_BIG_TOP : HydraluxShape.FLOWER_SMALL_TOP));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isOf(EndBlocks.SULPHURIC_ROCK.stone);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@ import java.util.Random;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
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.Block;
|
||||
|
@ -22,6 +24,7 @@ import net.minecraft.fluid.FluidState;
|
|||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
|
@ -37,9 +40,11 @@ import net.minecraft.world.WorldView;
|
|||
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
||||
import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
||||
public class BlockHydrothermalVent extends BlockBaseNotFull implements BlockEntityProvider, FluidFillable, Waterloggable {
|
||||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVATED;
|
||||
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 1, 1, 15, 16, 15);
|
||||
|
||||
public BlockHydrothermalVent() {
|
||||
|
@ -48,12 +53,12 @@ public class BlockHydrothermalVent extends BlockBaseNotFull implements BlockEnti
|
|||
.sounds(BlockSoundGroup.STONE)
|
||||
.noCollision()
|
||||
.requiresTool());
|
||||
this.setDefaultState(getDefaultState().with(WATERLOGGED, true));
|
||||
this.setDefaultState(getDefaultState().with(WATERLOGGED, true).with(ACTIVATED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(WATERLOGGED);
|
||||
builder.add(WATERLOGGED, ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,4 +121,20 @@ public class BlockHydrothermalVent extends BlockBaseNotFull implements BlockEnti
|
|||
scheduledTick(state,(ServerWorld) world, pos, world.random);
|
||||
}
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
if (!state.get(ACTIVATED) && random.nextBoolean()) {
|
||||
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();
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
world.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.util.StringIdentifiable;
|
|||
public class BlockProperties {
|
||||
public static final EnumProperty<TripleShape> TRIPLE_SHAPE = EnumProperty.of("shape", TripleShape.class);
|
||||
public final static EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.of("state", PedestalState.class);
|
||||
public static final EnumProperty<HydraluxShape> HYDRALUX_SHAPE = EnumProperty.of("shape", HydraluxShape.class);
|
||||
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
|
||||
public static final BooleanProperty HAS_LIGHT = BooleanProperty.of("has_light");
|
||||
public static final BooleanProperty ACTIVATED = BooleanProperty.of("active");
|
||||
|
@ -57,4 +58,35 @@ public class BlockProperties {
|
|||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum HydraluxShape implements StringIdentifiable {
|
||||
FLOWER_BIG_BOTTOM("flower_big_bottom", true),
|
||||
FLOWER_BIG_TOP("flower_big_top", true),
|
||||
FLOWER_SMALL_BOTTOM("flower_small_bottom", true),
|
||||
FLOWER_SMALL_TOP("flower_small_top", true),
|
||||
VINE("vine", false),
|
||||
ROOTS("roots", false);
|
||||
|
||||
private final String name;
|
||||
private final boolean glow;
|
||||
|
||||
HydraluxShape(String name, boolean glow) {
|
||||
this.name = name;
|
||||
this.glow = glow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean hasGlow() {
|
||||
return glow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
17
src/main/java/ru/betterend/blocks/HydraluxPetalBlock.java
Normal file
17
src/main/java/ru/betterend/blocks/HydraluxPetalBlock.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import ru.betterend.blocks.basis.BlockBase;
|
||||
|
||||
public class HydraluxPetalBlock extends BlockBase {
|
||||
public HydraluxPetalBlock() {
|
||||
super(FabricBlockSettings.of(Material.PLANT).hardness(1).resistance(1).breakByHand(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLandedUpon(World world, BlockPos pos, Entity entity, float distance) {}
|
||||
}
|
|
@ -16,13 +16,13 @@ public class BlockEntityHydrothermalVent extends BlockEntity implements Tickable
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (world.random.nextInt(32) == 0) {
|
||||
if (world.random.nextInt(20) == 0) {
|
||||
double x = pos.getX() + world.random.nextDouble();
|
||||
double y = pos.getY() + 0.9 + world.random.nextDouble() * 0.3;
|
||||
double z = pos.getZ() + world.random.nextDouble();
|
||||
BlockState state = getCachedState();
|
||||
if (state.isOf(EndBlocks.HYDROTHERMAL_VENT)) {
|
||||
if (getCachedState().get(BlockHydrothermalVent.WATERLOGGED)) {
|
||||
if (state.isOf(EndBlocks.HYDROTHERMAL_VENT) && state.get(BlockHydrothermalVent.ACTIVATED)) {
|
||||
if (state.get(BlockHydrothermalVent.WATERLOGGED)) {
|
||||
world.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -28,6 +28,8 @@ import ru.betterend.blocks.BlockEndLotusSeed;
|
|||
import ru.betterend.blocks.BlockEndLotusStem;
|
||||
import ru.betterend.blocks.BlockEndstoneDust;
|
||||
import ru.betterend.blocks.BlockGlowingMoss;
|
||||
import ru.betterend.blocks.BlockHydralux;
|
||||
import ru.betterend.blocks.BlockHydraluxSapling;
|
||||
import ru.betterend.blocks.BlockHydrothermalVent;
|
||||
import ru.betterend.blocks.BlockLacugroveSapling;
|
||||
import ru.betterend.blocks.BlockMossyGlowshroomCap;
|
||||
|
@ -51,6 +53,7 @@ import ru.betterend.blocks.EndStoneSmelter;
|
|||
import ru.betterend.blocks.EnderBlock;
|
||||
import ru.betterend.blocks.EternalPedestal;
|
||||
import ru.betterend.blocks.EternalRunedFlavolite;
|
||||
import ru.betterend.blocks.HydraluxPetalBlock;
|
||||
import ru.betterend.blocks.InfusionPedestal;
|
||||
import ru.betterend.blocks.PedestalVanilla;
|
||||
import ru.betterend.blocks.RunedFlavolite;
|
||||
|
@ -163,6 +166,10 @@ public class EndBlocks {
|
|||
public static final Block END_LILY = registerBlockNI("end_lily", new BlockEndLily());
|
||||
public static final Block END_LILY_SEED = registerBlock("end_lily_seed", new BlockEndLilySeed());
|
||||
|
||||
public static final Block HYDRALUX_SAPLING = registerBlock("hydralux_sapling", new BlockHydraluxSapling());
|
||||
public static final Block HYDRALUX = registerBlockNI("hydralux", new BlockHydralux());
|
||||
public static final Block HYDRALUX_PETAL_BLOCK = registerBlock("hydralux_petal_block", new HydraluxPetalBlock());
|
||||
|
||||
public static final Block CAVE_BUSH = registerBlock("cave_bush", new BlockSimpleLeaves(MaterialColor.MAGENTA));
|
||||
|
||||
public static final Block MURKWEED = registerBlock("murkweed", new BlockMurkweed());
|
||||
|
|
|
@ -18,6 +18,7 @@ import ru.betterend.world.features.EndFeature;
|
|||
import ru.betterend.world.features.EndLilyFeature;
|
||||
import ru.betterend.world.features.EndLotusFeature;
|
||||
import ru.betterend.world.features.EndLotusLeafFeature;
|
||||
import ru.betterend.world.features.HydraluxFeature;
|
||||
import ru.betterend.world.features.SinglePlantFeature;
|
||||
import ru.betterend.world.features.UnderwaterPlantFeature;
|
||||
import ru.betterend.world.features.VineFeature;
|
||||
|
@ -87,6 +88,7 @@ public class EndFeatures {
|
|||
public static final EndFeature END_LILY_RARE = new EndFeature("end_lily_rare", new EndLilyFeature(3), 4);
|
||||
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5);
|
||||
public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(20), 25);
|
||||
public static final EndFeature HYDRALUX = new EndFeature("hydralux", new HydraluxFeature(5), 5);
|
||||
|
||||
// Terrain //
|
||||
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
|
||||
|
|
|
@ -63,6 +63,7 @@ public class EndItems {
|
|||
public final static Item AMBER_GEM = registerItem("amber_gem");
|
||||
public final static Item GLOWING_BULB = registerItem("glowing_bulb");
|
||||
public final static Item CRYSTALLINE_SULPHUR = registerItem("crystalline_sulphur");
|
||||
public final static Item HYDRALUX_PETAL = registerItem("hydralux_petal");
|
||||
|
||||
// Armor //
|
||||
public static final Item TERMINITE_HELMET = registerItem("terminite_helmet", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.HEAD, makeItemSettings()));
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.carver.ConfiguredCarvers;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.world.surface.SurfaceBuilders;
|
||||
|
@ -11,7 +9,8 @@ public class BiomeSulfurSprings extends EndBiome {
|
|||
public BiomeSulfurSprings() {
|
||||
super(new BiomeDefinition("sulfur_springs")
|
||||
.setSurface(SurfaceBuilders.SULPHURIC_SURFACE)
|
||||
.setWaterAndFogColor(25, 90, 157)
|
||||
.setWaterColor(25, 90, 157)
|
||||
.setWaterFogColor(30, 65, 61)
|
||||
.setFogColor(207, 194, 62)
|
||||
.setFogDensity(1.5F)
|
||||
.setCaves(false)
|
||||
|
@ -19,7 +18,7 @@ public class BiomeSulfurSprings extends EndBiome {
|
|||
.addFeature(EndFeatures.GEYSER)
|
||||
.addFeature(EndFeatures.SULPHURIC_LAKE)
|
||||
.addFeature(EndFeatures.SULPHURIC_CAVE)
|
||||
.addCarver(GenerationStep.Carver.AIR, ConfiguredCarvers.CAVE)
|
||||
.addFeature(EndFeatures.HYDRALUX)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.BlockHydraluxSapling;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class HydraluxFeature extends UnderwaterPlantScatter {
|
||||
public HydraluxFeature(int radius) {
|
||||
super(radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
BlockHydraluxSapling seed = (BlockHydraluxSapling) EndBlocks.HYDRALUX_SAPLING;
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getChance() {
|
||||
return 15;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.blocks.BlockHydrothermalVent;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -140,7 +141,7 @@ public class GeyserFeature extends DefaultFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, pos, WATER);
|
||||
Mutable mut = new Mutable().set(pos);
|
||||
count = getYOnSurface(world, pos.getX(), pos.getZ()) - pos.getY();
|
||||
for (int i = 0; i <= count; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, WATER);
|
||||
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut.offset(dir), WATER);
|
||||
|
@ -150,25 +151,58 @@ public class GeyserFeature extends DefaultFeature {
|
|||
|
||||
for (int i = 0; i < 150; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 4 + 0.5), -halfHeight - 10, MHelper.floor(random.nextGaussian() * 4 + 0.5));
|
||||
int dist = MHelper.floor(6 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
for (int j = 0; j < dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
float distRaw = MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ());
|
||||
int dist = MHelper.floor(6 - distRaw) + random.nextInt(2);
|
||||
if (dist >= 0) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 0.7 + 0.5), -halfHeight - 10, MHelper.floor(random.nextGaussian() * 0.7 + 0.5));
|
||||
float distRaw = MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ());
|
||||
int dist = MHelper.floor(6 - distRaw) + random.nextInt(2);
|
||||
if (dist >= 0) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
double hr = radius * 0.75;
|
||||
double nr = radius * 0.25;
|
||||
|
||||
BlockState state;
|
||||
Set<BlockPos> brimstone = Sets.newHashSet();
|
||||
BlockState rock = EndBlocks.SULPHURIC_ROCK.stone.getDefaultState();
|
||||
int waterLevel = pos.getY() + MHelper.randRange(MHelper.floor(radius * 0.8), radius, random);
|
||||
|
@ -74,13 +75,14 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
double r2 = r + 5;
|
||||
double dist = xsq + ysq + zsq;
|
||||
if (dist < r * r) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
state = world.getBlockState(mut);
|
||||
if (isReplaceable(state)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, y < waterLevel ? WATER : CAVE_AIR);
|
||||
}
|
||||
}
|
||||
else if (dist < r2 * r2) {
|
||||
if (world.getBlockState(mut).isIn(EndTags.GEN_TERRAIN)) {
|
||||
state = world.getBlockState(mut);
|
||||
if (state.isIn(EndTags.GEN_TERRAIN) || state.isOf(Blocks.AIR)) {
|
||||
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.4) {
|
||||
brimstone.add(mut.toImmutable());
|
||||
|
@ -101,25 +103,27 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
int count = MHelper.randRange(5, 20, random);
|
||||
for (int i = 0; i < count; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 0, MHelper.floor(random.nextGaussian() * 2 + 0.5));
|
||||
int dist = MHelper.floor(6 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN) || state.isOf(Blocks.AIR)) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT);
|
||||
mut.setY(mut.getY() + 1);
|
||||
int dist = MHelper.floor(3 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
|
||||
if (dist > 0) {
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue