Some fixes, Nightshade Redwood biome additions

This commit is contained in:
paulevsGitch 2021-01-12 21:13:17 +03:00
parent 34318e283b
commit 18548f0ea4
12 changed files with 460 additions and 3 deletions

View file

@ -7,6 +7,8 @@ import ru.betterend.registry.EndBlocks;
public class BYGBlocks {
public static final Block IVIS_MOSS = EndBlocks.registerBlock("ivis_moss", new EndWallPlantBlock());
public static final Block NIGHTSHADE_MOSS = EndBlocks.registerBlock("nightshade_moss", new EndWallPlantBlock());
public static final Block IVIS_VINE = EndBlocks.registerBlock("ivis_vine", new VineBlock());
public static void register() {}

View file

@ -8,6 +8,7 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import net.minecraft.world.gen.GenerationStep.Feature;
import ru.betterend.BetterEnd;
import ru.betterend.integration.Integrations;
import ru.betterend.integration.byg.features.BYGFeatures;
@ -34,7 +35,9 @@ public class NightshadeRedwoods extends EndBiome {
.setGrassColor(48, 13, 89)
.setPlantsColor(200, 125, 9)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE);
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS);
if (BetterEnd.isClient()) {
SoundEvent loop = effects.getLoopSound().get();
@ -43,6 +46,11 @@ public class NightshadeRedwoods extends EndBiome {
SoundEvent mood = effects.getMoodSound().get().getSound();
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
}
biome.getGenerationSettings().getFeatures().forEach((list) -> {
list.forEach((feature) -> {
def.addFeature(Feature.VEGETAL_DECORATION, feature.get());
});
});
for (SpawnGroup group: SpawnGroup.values()) {
List<SpawnEntry> list = biome.getSpawnSettings().getSpawnEntry(group);

View file

@ -17,6 +17,8 @@ public class BYGFeatures {
public static final EndFeature IVIS_MOSS_WOOD = new EndFeature("ivis_moss_wood", new WallPlantOnLogFeature(BYGBlocks.IVIS_MOSS, 6), 15);
public static final EndFeature BULBIS_ODDITY = new EndFeature("bulbis_oddity", new SinglePlantFeature(Integrations.BYG.getBlock("bulbis_oddity"), 4, 4), 5);
public static final EndFeature PURPLE_BULBIS_ODDITY = new EndFeature("purple_bulbis_oddity", new SinglePlantFeature(Integrations.BYG.getBlock("purple_bulbis_oddity"), 4, 4), 5);
public static final EndFeature NIGHTSHADE_MOSS = new EndFeature("nightshade_moss", new WallPlantFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 2);
public static final EndFeature NIGHTSHADE_MOSS_WOOD = new EndFeature("nightshade_moss_wood", new WallPlantOnLogFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 8);
public static final EndFeature NIGHTSHADE_REDWOOD_TREE = new EndFeature("nightshade_redwood_tree", new NightshadeRedwoodTreeFeature(), 1);
public static final EndFeature BIG_ETHER_TREE = new EndFeature("big_ether_tree", new BigEtherTreeFeature(), 1);

View file

@ -0,0 +1,184 @@
package ru.betterend.integration.byg.features;
import java.util.List;
import java.util.Random;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
import ru.betterend.util.sdf.PosInfo;
import ru.betterend.util.sdf.SDF;
import ru.betterend.util.sdf.operator.SDFDisplacement;
import ru.betterend.util.sdf.operator.SDFFlatWave;
import ru.betterend.util.sdf.operator.SDFSmoothUnion;
import ru.betterend.util.sdf.primitive.SDFCappedCone;
import ru.betterend.util.sdf.primitive.SDFSphere;
import ru.betterend.world.features.DefaultFeature;
public class GreatNightshadeTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH;
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (!world.getBlockState(pos.down()).getBlock().isIn(EndTags.END_GROUND)) return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves");
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves");
Function<BlockPos, BlockState> splinePlacer = (bpos) -> { return log; };
Function<BlockState, Boolean> replace = (state) -> {
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
};
Function<PosInfo, BlockState> post = (info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood;
}
return info.getState();
};
Function<BlockState, Boolean> ignore = (state) -> {
return state.equals(log) || state.equals(wood);
};
int height = MHelper.randRange(40, 60, random);
List<Vector3f> trunk = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, height / 4);
SplineHelper.offsetParts(trunk, random, 0.8F, 0, 0.8F);
if (!SplineHelper.canGenerate(trunk, pos, world, replace)) {
return false;
}
int count = height >> 2;
float start = trunk.size() / 3F;
float delta = trunk.size() * 0.6F;
float max = height - 7;
for (int i = 0; i < count; i++) {
float scale = (float) (count - i) / count * 15;
Vector3f offset = SplineHelper.getPos(trunk, (float) i / count * delta + start);
if (offset.getY() > max) {
break;
}
List<Vector3f> branch = SplineHelper.copySpline(BRANCH);
SplineHelper.rotateSpline(branch, i * 1.3F);
SplineHelper.scale(branch, scale);
SplineHelper.offsetParts(branch, random, 0.3F, 0.3F, 0.3F);
SplineHelper.offset(branch, offset);
SplineHelper.fillSpline(branch, world, wood, pos, replace);
}
SplineHelper.fillSpline(trunk, world, log, pos, ignore);
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
SDF roots = new SDFSphere().setRadius(2F).setBlock(log);
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random)).setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
sdf = new SDFSmoothUnion().setRadius(2F).setSourceA(sdf).setSourceB(roots);
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.75F);
for (int y = 0; y < 8; y++) {
BlockPos p = pos.add(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
}
for (int y = 0; y < 16; y++) {
BlockPos p = pos.add(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
if (world.isAir(p)) {
BlocksHelper.setWithoutUpdate(world, p, leaves);
}
float radius = (1 - y / 16F) * 3F;
int rad = (int) (radius + 1);
radius *= radius;
for (int x = -rad; x <= rad; x++) {
int x2 = x * x;
for (int z = -rad; z <= rad; z++) {
int z2 = z * z;
if (x2 + z2 < radius - random.nextFloat() * rad) {
BlockPos lp = p.add(x, 0, z);
if (world.isAir(lp)) {
BlocksHelper.setWithoutUpdate(world, lp, leaves);
}
}
}
}
}
Mutable mut = new Mutable();
Function<PosInfo, BlockState> leavesPost1 = (info) -> {
if (info.getState().equals(log) || info.getState().equals(wood)) {
for (int x = -6; x < 7; x++) {
int ax = Math.abs(x);
mut.setX(x + info.getPos().getX());
for (int z = -6; z < 7; z++) {
int az = Math.abs(z);
mut.setZ(z + info.getPos().getZ());
for (int y = -6; y < 7; y++) {
int ay = Math.abs(y);
int d = ax + ay + az;
if (d < 7) {
mut.setY(y + info.getPos().getY());
BlockState state = info.getState(mut);
if (state.getBlock() instanceof LeavesBlock) {
int distance = state.get(LeavesBlock.DISTANCE);
if (d < distance) {
info.setState(mut, state.with(LeavesBlock.DISTANCE, d));
}
}
}
}
}
}
}
return info.getState();
};
Function<PosInfo, BlockState> leavesPost2 = (info) -> {
if (info.getState().getBlock() instanceof LeavesBlock) {
int distance = info.getState().get(LeavesBlock.DISTANCE);
if (distance > MHelper.randRange(2, 4, random)) {
return Blocks.AIR.getDefaultState();
}
for (Direction d: BlocksHelper.DIRECTIONS) {
int airCount = 0;
if (info.getState(d).isAir()) {
airCount ++;
}
if (airCount > 5) {
return Blocks.AIR.getDefaultState();
}
}
if (random.nextInt(8) == 0) {
return leaves_flower.with(LeavesBlock.DISTANCE, distance);
}
}
return info.getState();
};
SDF canopy = new SDFCappedCone().setRadius1(12F).setRadius2(1f).setHeight(height * 0.3F).setBlock(leaves);
canopy = new SDFDisplacement().setFunction((vec) -> { return MHelper.randRange(-3F, 3F, random); }).setSource(canopy);
canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world, pos.add(0, height * 0.75, 0), ignore);
return true;
}
static {
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0),
new Vector3f(0.25F, 0.1F, 0),
new Vector3f(0.40F, 0.2F, 0),
new Vector3f(0.50F, 0.4F, 0),
new Vector3f(0.55F, 0.6F, 0));
}
}

View file

@ -0,0 +1,24 @@
{
"variants": {
"facing=north": [
{ "model": "betterend:block/nightshade_moss_01", "y": 180 },
{ "model": "betterend:block/nightshade_moss_02", "y": 180 },
{ "model": "betterend:block/nightshade_moss_03", "y": 180 }
],
"facing=south": [
{ "model": "betterend:block/nightshade_moss_01" },
{ "model": "betterend:block/nightshade_moss_02" },
{ "model": "betterend:block/nightshade_moss_03" }
],
"facing=east": [
{ "model": "betterend:block/nightshade_moss_01", "y": 270 },
{ "model": "betterend:block/nightshade_moss_02", "y": 270 },
{ "model": "betterend:block/nightshade_moss_03", "y": 270 }
],
"facing=west": [
{ "model": "betterend:block/nightshade_moss_01", "y": 90 },
{ "model": "betterend:block/nightshade_moss_02", "y": 90 },
{ "model": "betterend:block/nightshade_moss_03", "y": 90 }
]
}
}

View file

@ -561,5 +561,8 @@
"block.betterend.umbrella_tree_sapling": "Umbrella Tree Sapling",
"item.betterend.umbrella_cluster_juice": "Umbrella Cluster Juice",
"block.betterend.blossom_berry_seed": "Blossom Berry Seed",
"item.betterend.blossom_berry": "Blossom Berry"
"item.betterend.blossom_berry": "Blossom Berry",
"biome.betterend.nightshade_redwoods": "Nightshade Redwoods",
"block.betterend.nightshade_moss": "Nightshade Moss"
}

View file

@ -563,5 +563,8 @@
"block.betterend.umbrella_tree_sapling": "Саженец зонтичного дерева",
"item.betterend.umbrella_cluster_juice": "Сок зонтичного кластера",
"block.betterend.blossom_berry_seed": "Семя цветущей ягоды",
"item.betterend.blossom_berry": "Цветущая ягода"
"item.betterend.blossom_berry": "Цветущая ягода",
"biome.betterend.nightshade_redwoods": "Теневой Секвойник",
"block.betterend.nightshade_moss": "Теневой мох"
}

View file

@ -0,0 +1,97 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"texture": "betterend:block/nightshade_moss",
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneY1",
"from": [ 3, 15, 0 ],
"to": [ 19, 15.001, 16 ],
"rotation": { "origin": [ 3, 15, 0 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 1, 11, 0 ],
"to": [ 17, 11.001, 16 ],
"rotation": { "origin": [ 1, 11, 0 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 1, -10, 0 ],
"to": [ 17, 6, 0.001 ],
"rotation": { "origin": [ 1, 6, 0 ], "axis": "x", "angle": -45 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -3, 13.5, 0 ],
"to": [ 13, 13.501, 16 ],
"rotation": { "origin": [ -3, 13.5, 0 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 1, 1, 0 ],
"to": [ 17, 1.001, 16 ],
"rotation": { "origin": [ 1, 1, 0 ], "axis": "x", "angle": 22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -1, -9, 0 ],
"to": [ 15, 7, 0.001 ],
"rotation": { "origin": [ -1, 7, 0 ], "axis": "x", "angle": -45 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -1.5, 16, 0 ],
"to": [ 14.5, 16.001, 16 ],
"rotation": { "origin": [ -1.5, 16, 0 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -2, 0.5, 0 ],
"to": [ 14, 0.501, 16 ],
"rotation": { "origin": [ -2, 0.5, 0 ], "axis": "x", "angle": 22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
}
]
}

View file

@ -0,0 +1,64 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"texture": "betterend:block/nightshade_moss",
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneY1",
"from": [ 3, 15, 0 ],
"to": [ 19, 15.001, 16 ],
"rotation": { "origin": [ 3, 15, 0 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, -15, 0 ],
"to": [ 16, 1, 0.001 ],
"rotation": { "origin": [ 0, 1, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -2, -12, 0 ],
"to": [ 14, 4, 0.001 ],
"rotation": { "origin": [ -2, 4, 0 ], "axis": "x", "angle": -45 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, -9, 0 ],
"to": [ 16, 7, 0.001 ],
"rotation": { "origin": [ 0, 7, 0 ], "axis": "x", "angle": -45 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, -3, 0 ],
"to": [ 16, 13, 0.001 ],
"rotation": { "origin": [ 0, 13, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
}
]
}

View file

@ -0,0 +1,64 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"texture": "betterend:block/nightshade_moss",
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneY1",
"from": [ -1, 0, 0 ],
"to": [ 15, 16, 0.001 ],
"rotation": { "origin": [ -1, 16, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 2, -3, 0 ],
"to": [ 18, 13, 0.001 ],
"rotation": { "origin": [ 2, 13, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, -8, 0 ],
"to": [ 16, 8, 0.001 ],
"rotation": { "origin": [ 0, 8, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ -3, -12, 0 ],
"to": [ 13, 4, 0.001 ],
"rotation": { "origin": [ -3, 4, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY1",
"from": [ 3, -15, 0 ],
"to": [ 19, 1, 0.001 ],
"rotation": { "origin": [ 3, 1, 0 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/nightshade_moss"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB