Merge branch 'master' of https://github.com/paulevsGitch/BetterEnd
This commit is contained in:
commit
d52371cf97
15 changed files with 107 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -21,18 +22,22 @@ import net.minecraft.particle.ParticleTypes;
|
|||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockVentBubbleColumn extends Block implements FluidDrainable, FluidFillable {
|
||||
public class BlockVentBubbleColumn extends Block implements FluidDrainable, FluidFillable, BlockPatterned {
|
||||
public BlockVentBubbleColumn() {
|
||||
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).nonOpaque().noCollision().dropsNothing());
|
||||
}
|
||||
|
@ -120,4 +125,20 @@ public class BlockVentBubbleColumn extends Block implements FluidDrainable, Flui
|
|||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getStill(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, "stone", "stone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class EndFeatures {
|
|||
public static final EndFeature LANCELEAF = new EndFeature("lanceleaf", new LanceleafFeature(), 3);
|
||||
public static final EndFeature GLOW_PILLAR = new EndFeature("glow_pillar", new GlowPillarFeature(), 1);
|
||||
public static final EndFeature TWISTED_UMBRELLA_MOSS = new EndFeature("twisted_umbrella_moss", new DoublePlantFeature(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS_TALL, 6), 5);
|
||||
public static final EndFeature JUNGLE_GRASS = new EndFeature("jungle_grass", new CavePlantFeature(EndBlocks.JUNGLE_GRASS, 7), 8);
|
||||
public static final EndFeature JUNGLE_GRASS = new EndFeature("jungle_grass", new SinglePlantFeature(EndBlocks.JUNGLE_GRASS, 7, 3), 8);
|
||||
|
||||
// Vines //
|
||||
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
|
||||
|
|
|
@ -11,9 +11,15 @@ public class BiomeUmbrellaJungle extends EndBiome {
|
|||
.setFoliageColor(27, 183, 194)
|
||||
.setFogDensity(2.3F)
|
||||
.setSurface(EndBlocks.JUNGLE_MOSS)
|
||||
.addFeature(EndFeatures.END_LAKE)
|
||||
.addFeature(EndFeatures.UMBRELLA_TREE)
|
||||
.addFeature(EndFeatures.TWISTED_UMBRELLA_MOSS)
|
||||
.addFeature(EndFeatures.JUNGLE_GRASS)
|
||||
.addFeature(EndFeatures.END_LAKE));
|
||||
.addFeature(EndFeatures.CYAN_MOSS)
|
||||
.addFeature(EndFeatures.CYAN_MOSS_WOOD)
|
||||
.addFeature(EndFeatures.CHARNIA_CYAN)
|
||||
.addFeature(EndFeatures.CHARNIA_GREEN)
|
||||
.addFeature(EndFeatures.CHARNIA_LIGHT_BLUE)
|
||||
.addFeature(EndFeatures.CHARNIA_RED_RARE));
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
@ -124,14 +125,14 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
|
||||
for (Center c: centers) {
|
||||
if (!world.getBlockState(new BlockPos(c.px, c.py, c.pz)).isAir()) {
|
||||
count = MHelper.floor(MHelper.randRange(1F, 5F, random) * scale);
|
||||
count = MHelper.floor(MHelper.randRange(5F, 10F, random) * scale);
|
||||
float startAngle = random.nextFloat() * MHelper.PI2;
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / count * MHelper.PI2 + startAngle;
|
||||
float dist = MHelper.randRange(1.8F, 3.4F, random) * scale;
|
||||
float dist = MHelper.randRange(1.5F, 2.5F, random) * scale;
|
||||
double px = c.px + Math.sin(angle) * dist;
|
||||
double pz = c.pz + Math.cos(angle) * dist;
|
||||
makeFruits(world, px, c.py - 1, pz, random, fruit, scale);
|
||||
makeFruits(world, px, c.py - 1, pz, fruit, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,18 +176,16 @@ public class UmbrellaTreeFeature extends DefaultFeature {
|
|||
return sphere;
|
||||
}
|
||||
|
||||
private void makeFruits(StructureWorldAccess world, double px, double py, double pz, Random random, BlockState fruit, float scale) {
|
||||
Mutable mut = new Mutable();
|
||||
int length = MHelper.floor(MHelper.randRange(1F, 5F, random) * scale + 0.5F);
|
||||
for (int i = 0; i < length; i++) {
|
||||
mut.setY(MHelper.floor(py - i));
|
||||
double radius = (1 - (double) i / length) * 0.5;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
mut.setX(MHelper.floor(random.nextGaussian() * radius + px + 0.5));
|
||||
mut.setZ(MHelper.floor(random.nextGaussian() * radius + pz + 0.5));
|
||||
if (world.isAir(mut)) {
|
||||
private void makeFruits(StructureWorldAccess world, double px, double py, double pz, BlockState fruit, float scale) {
|
||||
Mutable mut = new Mutable().set(px, py, pz);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mut.move(Direction.DOWN);
|
||||
if (world.isAir(mut)) {
|
||||
BlockState state = world.getBlockState(mut.up());
|
||||
if (state.isOf(EndBlocks.UMBRELLA_TREE_MEMBRANE) && state.get(BlockUmbrellaTreeMembrane.COLOR) < 2) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, fruit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue