Structures, texture changes
This commit is contained in:
parent
bd9d71206f
commit
846b14cf7c
21 changed files with 262 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
||||||
package ru.betterend.registry;
|
package ru.betterend.registry;
|
||||||
|
|
||||||
import ru.betterend.world.features.BlueVineFeature;
|
import ru.betterend.world.features.BlueVineFeature;
|
||||||
|
import ru.betterend.world.features.ChorusTreeFeature;
|
||||||
import ru.betterend.world.features.DoublePlantFeature;
|
import ru.betterend.world.features.DoublePlantFeature;
|
||||||
import ru.betterend.world.features.EndFeature;
|
import ru.betterend.world.features.EndFeature;
|
||||||
import ru.betterend.world.features.EndLakeFeature;
|
import ru.betterend.world.features.EndLakeFeature;
|
||||||
|
@ -11,6 +12,7 @@ import ru.betterend.world.features.VineFeature;
|
||||||
public class FeatureRegistry {
|
public class FeatureRegistry {
|
||||||
// Trees //
|
// Trees //
|
||||||
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
|
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
|
||||||
|
public static final EndFeature CHORUS_TREE = new EndFeature("chorus_tree", new ChorusTreeFeature(), 1);
|
||||||
|
|
||||||
// Plants //
|
// Plants //
|
||||||
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(BlockRegistry.UMBRELLA_MOSS, BlockRegistry.UMBRELLA_MOSS_TALL, 5), 5);
|
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(BlockRegistry.UMBRELLA_MOSS, BlockRegistry.UMBRELLA_MOSS_TALL, 5), 5);
|
||||||
|
|
|
@ -41,6 +41,16 @@ public class SplineHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void parableOffset(List<Vector3f> spline, float distance) {
|
||||||
|
int count = spline.size();
|
||||||
|
for (int i = 1; i < count; i++) {
|
||||||
|
Vector3f pos = spline.get(i);
|
||||||
|
float x = (float) i / (float) (count + 1);
|
||||||
|
float y = pos.getY() + x * x * distance;
|
||||||
|
pos.set(pos.getX(), y, pos.getZ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static SDF buildSDF(List<Vector3f> spline, float radius1, float radius2, Function<BlockPos, BlockState> placerFunction) {
|
public static SDF buildSDF(List<Vector3f> spline, float radius1, float radius2, Function<BlockPos, BlockState> placerFunction) {
|
||||||
int count = spline.size();
|
int count = spline.size();
|
||||||
float max = count - 2;
|
float max = count - 2;
|
||||||
|
|
|
@ -7,6 +7,10 @@ public class SDFRotation extends SDFUnary {
|
||||||
private static final Vector3f POS = new Vector3f();
|
private static final Vector3f POS = new Vector3f();
|
||||||
private Quaternion rotation;
|
private Quaternion rotation;
|
||||||
|
|
||||||
|
public SDFRotation setRotation() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getDistance(float x, float y, float z) {
|
public float getDistance(float x, float y, float z) {
|
||||||
POS.set(x, y, z);
|
POS.set(x, y, z);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.entity.EntityType;
|
||||||
import ru.betterend.registry.BlockRegistry;
|
import ru.betterend.registry.BlockRegistry;
|
||||||
import ru.betterend.registry.EntityRegistry;
|
import ru.betterend.registry.EntityRegistry;
|
||||||
import ru.betterend.registry.FeatureRegistry;
|
import ru.betterend.registry.FeatureRegistry;
|
||||||
import ru.betterend.registry.StructureRegistry;
|
|
||||||
|
|
||||||
public class BiomeChorusForest extends EndBiome {
|
public class BiomeChorusForest extends EndBiome {
|
||||||
public BiomeChorusForest() {
|
public BiomeChorusForest() {
|
||||||
|
@ -15,9 +14,9 @@ public class BiomeChorusForest extends EndBiome {
|
||||||
//.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
|
//.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
|
||||||
//.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
|
//.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
|
||||||
//.setMusic(SoundRegistry.MUSIC_FOGGY_MUSHROOMLAND)
|
//.setMusic(SoundRegistry.MUSIC_FOGGY_MUSHROOMLAND)
|
||||||
.addStructureFeature(StructureRegistry.GIANT_MOSSY_GLOWSHROOM)
|
|
||||||
.addFeature(FeatureRegistry.ENDER_ORE)
|
.addFeature(FeatureRegistry.ENDER_ORE)
|
||||||
.addFeature(FeatureRegistry.RARE_END_LAKE)
|
.addFeature(FeatureRegistry.RARE_END_LAKE)
|
||||||
|
.addFeature(FeatureRegistry.CHORUS_TREE)
|
||||||
.addFeature(FeatureRegistry.CHORUS_GRASS)
|
.addFeature(FeatureRegistry.CHORUS_GRASS)
|
||||||
.addMobSpawn(EntityRegistry.END_SLIME, 5, 1, 2)
|
.addMobSpawn(EntityRegistry.END_SLIME, 5, 1, 2)
|
||||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
|
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package ru.betterend.world.features;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
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.world.StructureWorldAccess;
|
||||||
|
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||||
|
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||||
|
import ru.betterend.registry.BlockRegistry;
|
||||||
|
import ru.betterend.registry.BlockTagRegistry;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
import ru.betterend.util.SplineHelper;
|
||||||
|
import ru.betterend.util.sdf.SDF;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFScale;
|
||||||
|
import ru.betterend.util.sdf.operator.SDFUnion;
|
||||||
|
|
||||||
|
public class ChorusTreeFeature extends DefaultFeature {
|
||||||
|
private static final Function<BlockState, Boolean> REPLACE;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||||
|
if (world.getBlockState(pos.down()).getBlock() != BlockRegistry.CHORUS_NYLIUM) return false;
|
||||||
|
|
||||||
|
float size = MHelper.randRange(10, 20, random);
|
||||||
|
List<List<Vector3f>> splines = Lists.newArrayList();
|
||||||
|
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 4);
|
||||||
|
SplineHelper.offsetParts(spline, random, 0.7F, 0, 0.7F);
|
||||||
|
Vector3f last = spline.get(spline.size() - 1);
|
||||||
|
branch(splines, last.getX(), last.getY(), last.getZ(), size * 0.6F, MHelper.randRange(0, MHelper.PI2, random), random, MHelper.floor(Math.log(size) * 1.5F));
|
||||||
|
|
||||||
|
SDF function = SplineHelper.buildSDF(spline, 1.4F, 0.8F, (bpos) -> {
|
||||||
|
return BlockRegistry.CHORUS.bark.getDefaultState();
|
||||||
|
});
|
||||||
|
|
||||||
|
for (List<Vector3f> sp: splines) {
|
||||||
|
float width = 0.8F - (sp.get(0).getY() - size) / 40;
|
||||||
|
if (size > 0F) {
|
||||||
|
SDF funcSp = SplineHelper.buildSDF(sp, width, width, (bpos) -> {
|
||||||
|
return BlockRegistry.CHORUS.bark.getDefaultState();
|
||||||
|
});
|
||||||
|
function = new SDFUnion().setSourceA(function).setSourceB(funcSp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function = new SDFScale().setScale(MHelper.randRange(1F, 2F, random)).setSource(function);
|
||||||
|
function.setReplaceFunction(REPLACE);
|
||||||
|
function.fillRecursive(world, pos);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void branch(List<List<Vector3f>> splines, float x, float y, float z, float size, float angle, Random random, int depth) {
|
||||||
|
if (depth == 0) return;
|
||||||
|
|
||||||
|
float dx = (float) Math.cos(angle) * size * 0.3F;
|
||||||
|
float dz = (float) Math.sin(angle) * size * 0.3F;
|
||||||
|
|
||||||
|
float x1 = x + dx;
|
||||||
|
float z1 = z + dz;
|
||||||
|
float x2 = x - dx;
|
||||||
|
float z2 = z - dz;
|
||||||
|
|
||||||
|
List<Vector3f> spline = SplineHelper.makeSpline(x, y, z, x1, y, z1, 5);
|
||||||
|
SplineHelper.parableOffset(spline, size);
|
||||||
|
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
|
||||||
|
splines.add(spline);
|
||||||
|
Vector3f pos1 = spline.get(spline.size() - 1);
|
||||||
|
|
||||||
|
spline = SplineHelper.makeSpline(x, y, z, x2, y, z2, 5);
|
||||||
|
SplineHelper.parableOffset(spline, size);
|
||||||
|
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
|
||||||
|
splines.add(spline);
|
||||||
|
Vector3f pos2 = spline.get(spline.size() - 1);
|
||||||
|
|
||||||
|
branch(splines, pos1.getX(), pos1.getY(), pos1.getZ(), size * 0.8F, angle + (float) Math.PI * 0.5F, random, depth - 1);
|
||||||
|
branch(splines, pos2.getX(), pos2.getY(), pos2.getZ(), size * 0.8F, angle + (float) Math.PI * 0.5F, random, depth - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
REPLACE = (state) -> {
|
||||||
|
if (state.isIn(BlockTagRegistry.END_GROUND)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (state.getMaterial().equals(Material.PLANT)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return state.getMaterial().isReplaceable();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"axis=x": {
|
"axis=x": [
|
||||||
"model": "betterend:block/chorus_log",
|
{ "model": "betterend:block/chorus_log", "x": 90, "y": 90 },
|
||||||
"x": 90,
|
{ "model": "betterend:block/chorus_log_2", "x": 90, "y": 90 }
|
||||||
"y": 90
|
],
|
||||||
},
|
"axis=y": [
|
||||||
"axis=y": {
|
{ "model": "betterend:block/chorus_log" },
|
||||||
"model": "betterend:block/chorus_log"
|
{ "model": "betterend:block/chorus_log_2" }
|
||||||
},
|
],
|
||||||
"axis=z": {
|
"axis=z": [
|
||||||
"model": "betterend:block/chorus_log",
|
{ "model": "betterend:block/chorus_log", "x": 90 },
|
||||||
"x": 90
|
{ "model": "betterend:block/chorus_log_2", "x": 90 }
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"defaultMaterial": "betterend:glow_20_half"
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"defaultMap": {
|
||||||
|
"spriteMap": [
|
||||||
|
{
|
||||||
|
"sprite": "betterend:block/chorus_log_side_glow_1",
|
||||||
|
"material": "betterend:glow_all_half"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sprite": "betterend:block/chorus_log_side_glow_2",
|
||||||
|
"material": "betterend:glow_all_half"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"vertexSource": "canvas:shaders/material/default.vert",
|
||||||
|
"fragmentSource": "betterend:shaders/material/glow_20_half.frag",
|
||||||
|
"disableAo": true,
|
||||||
|
"disableDiffuse": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,12 +1,34 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube",
|
"parent": "block/cube",
|
||||||
"textures": {
|
"textures": {
|
||||||
"down": "betterend:block/chorus_log_top",
|
"top": "betterend:block/chorus_log_top",
|
||||||
"east": "betterend:block/chorus_log_side",
|
"side": "betterend:block/chorus_log_side_1",
|
||||||
"north": "betterend:block/chorus_log_side",
|
"glow": "betterend:block/chorus_log_side_glow_1",
|
||||||
"particle": "betterend:block/chorus_log_side",
|
"particle": "#side"
|
||||||
"south": "betterend:block/chorus_log_side",
|
},
|
||||||
"up": "betterend:block/chorus_log_top",
|
"elements": [
|
||||||
"west": "betterend:block/chorus_log_side"
|
{
|
||||||
}
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 16, 16, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" },
|
||||||
|
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 16, 16, 16 ],
|
||||||
|
"shade": false,
|
||||||
|
"faces": {
|
||||||
|
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "west" },
|
||||||
|
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "east" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
|
"textures": {
|
||||||
|
"top": "betterend:block/chorus_log_top",
|
||||||
|
"side": "betterend:block/chorus_log_side_2",
|
||||||
|
"glow": "betterend:block/chorus_log_side_glow_2",
|
||||||
|
"particle": "#side"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 16, 16, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" },
|
||||||
|
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 16, 16, 16 ],
|
||||||
|
"shade": false,
|
||||||
|
"faces": {
|
||||||
|
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "west" },
|
||||||
|
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#glow", "cullface": "east" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include frex:shaders/api/fragment.glsl
|
||||||
|
#include frex:shaders/lib/math.glsl
|
||||||
|
|
||||||
|
void frx_startFragment(inout frx_FragmentData fragData) {
|
||||||
|
float glow = frx_luminance(fragData.spriteColor.rgb) - 0.2;
|
||||||
|
glow = clamp(glow * 3, 0, 0.5);
|
||||||
|
fragData.emissivity = glow;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 591 B |
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"interpolate": false,
|
||||||
|
"frametime": 2,
|
||||||
|
"frames": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"interpolate": true,
|
||||||
|
"frametime": 25,
|
||||||
|
"frames": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"interpolate": true,
|
||||||
|
"frametime": 25,
|
||||||
|
"frames": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue