Enhancements, fixes, new texture

This commit is contained in:
paulevsGitch 2020-12-06 16:01:49 +03:00
parent 86a2459b0f
commit 9a4bfa1698
19 changed files with 131 additions and 4 deletions

View file

@ -0,0 +1,14 @@
package ru.betterend.world.features;
import net.minecraft.block.Block;
public class CharniaFeature extends UnderwaterPlantFeature {
public CharniaFeature(Block plant) {
super(plant, 6);
}
@Override
protected int getChance() {
return 3;
}
}

View file

@ -0,0 +1,41 @@
package ru.betterend.world.features;
import java.util.Random;
import java.util.function.Function;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class MengerSpongeFeature extends UnderwaterPlantScatter {
private static final Function<BlockState, Boolean> REPLACE;
public MengerSpongeFeature(int radius) {
super(radius);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.MENGER_SPONGE_WET);
if (random.nextBoolean()) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
BlockPos pos = blockPos.offset(dir);
if (REPLACE.apply(world.getBlockState(pos))) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.MENGER_SPONGE_WET);
}
}
}
}
static {
REPLACE = (state) -> {
if (state.isOf(EndBlocks.END_LOTUS_STEM)) {
return false;
}
return !state.getFluidState().isEmpty() || state.getMaterial().isReplaceable();
};
}
}