This commit is contained in:
Aleksey 2020-10-07 17:56:32 +03:00
commit ea2a2778cb
10 changed files with 110 additions and 14 deletions

View file

@ -1,9 +1,7 @@
package ru.betterend; package ru.betterend;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.config.MainConfig; import ru.betterend.config.MainConfig;
import ru.betterend.effects.EndEnchantments; import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndPotions; import ru.betterend.effects.EndPotions;

View file

@ -2,10 +2,8 @@ package ru.betterend.client;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import ru.betterend.registry.BlockEntityRenderRegistry; import ru.betterend.registry.BlockEntityRenderRegistry;
import ru.betterend.registry.EntityRenderRegistry; import ru.betterend.registry.EntityRenderRegistry;
import ru.betterend.registry.ParticleRegistry; import ru.betterend.registry.ParticleRegistry;

View file

@ -21,7 +21,6 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.sound.MusicSound; import net.minecraft.sound.MusicSound;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.util.IColorProvider; import ru.betterend.util.IColorProvider;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;

View file

@ -9,7 +9,6 @@ import net.minecraft.world.biome.DefaultBiomeCreator;
import net.minecraft.world.biome.GenerationSettings; import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeatures; import net.minecraft.world.gen.feature.ConfiguredFeatures;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilders; import net.minecraft.world.gen.surfacebuilder.ConfiguredSurfaceBuilders;
import ru.betterend.registry.DefaultBiomeFeatureRegistry; import ru.betterend.registry.DefaultBiomeFeatureRegistry;
@ -23,9 +22,10 @@ public class DefaultBiomeCreatorMixin {
@Overwrite @Overwrite
public static Biome createEndHighlands() { public static Biome createEndHighlands() {
GenerationSettings.Builder builder = (new GenerationSettings.Builder()) GenerationSettings.Builder builder = (new GenerationSettings.Builder())
.surfaceBuilder(ConfiguredSurfaceBuilders.END).structureFeature(ConfiguredStructureFeatures.END_CITY) .surfaceBuilder(ConfiguredSurfaceBuilders.END)
//.structureFeature(ConfiguredStructureFeatures.END_CITY)
.feature(GenerationStep.Feature.SURFACE_STRUCTURES, ConfiguredFeatures.END_GATEWAY) .feature(GenerationStep.Feature.SURFACE_STRUCTURES, ConfiguredFeatures.END_GATEWAY)
.feature(GenerationStep.Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT) //.feature(GenerationStep.Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
.structureFeature(DefaultBiomeFeatureRegistry.MOUNTAINS.getFeatureConfigured()); .structureFeature(DefaultBiomeFeatureRegistry.MOUNTAINS.getFeatureConfigured());
return composeEndSpawnSettings(builder); return composeEndSpawnSettings(builder);
} }

View file

@ -4,7 +4,6 @@ import com.google.gson.JsonObject;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -22,7 +21,6 @@ import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.registry.ItemTagRegistry; import ru.betterend.registry.ItemTagRegistry;

View file

@ -3,7 +3,6 @@ package ru.betterend.recipe;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import ru.betterend.registry.BlockRegistry; import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.ItemRegistry; import ru.betterend.registry.ItemRegistry;

View file

@ -11,6 +11,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable; import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.Heightmap;
import net.minecraft.world.Heightmap.Type; import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@ -18,6 +19,7 @@ import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BiomeRegistry; import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.StructureRegistry; import ru.betterend.registry.StructureRegistry;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
@ -65,6 +67,7 @@ public class MountainPiece extends BasePiece {
int sz = chunkPos.getStartZ(); int sz = chunkPos.getStartZ();
Mutable pos = new Mutable(); Mutable pos = new Mutable();
Chunk chunk = world.getChunk(chunkPos.x, chunkPos.z); Chunk chunk = world.getChunk(chunkPos.x, chunkPos.z);
Heightmap map = chunk.getHeightmap(Type.WORLD_SURFACE_WG);
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
int px = x + sx; int px = x + sx;
int px2 = px - center.getX(); int px2 = px - center.getX();
@ -78,22 +81,69 @@ public class MountainPiece extends BasePiece {
if (dist < r2) { if (dist < r2) {
pos.setZ(z); pos.setZ(z);
dist = 1 - (float) Math.pow(dist / r2, 0.3); dist = 1 - (float) Math.pow(dist / r2, 0.3);
int minY = world.getTopY(Type.WORLD_SURFACE_WG, px, pz); int minY = map.get(x, z);
if (minY > 56) { if (minY > 56) {
float maxY = dist * height * getHeightClamp(world, 8, px, pz); float maxY = dist * height * getHeightClamp(world, 8, px, pz);
if (maxY > 0) { if (maxY > 0) {
maxY *= (float) noise.eval(px * 0.05, pz * 0.05) * 0.3F + 0.7F; maxY *= (float) noise.eval(px * 0.05, pz * 0.05) * 0.3F + 0.7F;
maxY *= (float) noise.eval(px * 0.1, pz * 0.1) * 0.1F + 0.8F; maxY *= (float) noise.eval(px * 0.1, pz * 0.1) * 0.1F + 0.8F;
//float rigid = Math.abs(1F - (float) noise.eval(px * 0.1, pz * 0.1)) * maxY / 20F - 0.5F;
maxY += minY; maxY += minY;
//float surf = maxY - 3;
for (int y = minY; y < maxY; y++) { for (int y = minY; y < maxY; y++) {
pos.setY(y); pos.setY(y);
chunk.setBlockState(pos, Blocks.END_STONE.getDefaultState(), false); chunk.setBlockState(pos, Blocks.END_STONE.getDefaultState(), false);
/*if (y > surf && rigid > 0.5) {
chunk.setBlockState(pos, BlockRegistry.AURORA_CRYSTAL.getDefaultState(), false);
}
else {
chunk.setBlockState(pos, Blocks.END_STONE.getDefaultState(), false);
}*/
} }
} }
} }
} }
} }
} }
map = chunk.getHeightmap(Type.WORLD_SURFACE);
// Big crystals
int count = (map.get(8, 8) - 80) / 7;
count = MathHelper.clamp(count, 0, 8);
for (int i = 0; i < count; i++) {
int radius = MHelper.randRange(2, 3, random);
float fill = MHelper.randRange(0F, 1F, random);
int x = MHelper.randRange(radius, 15 - radius, random);
int z = MHelper.randRange(radius, 15 - radius, random);
int y = map.get(x, z);
if (y > 80) {
pos.set(x, y, z);
if (chunk.getBlockState(pos.down()).getBlock() == Blocks.END_STONE) {
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
crystal(chunk, pos, radius, height, fill, random);
}
}
}
// Small crystals
count = (map.get(8, 8) - 80) / 2;
count = MathHelper.clamp(count, 4, 8);
for (int i = 0; i < count; i++) {
int radius = MHelper.randRange(1, 2, random);
float fill = random.nextBoolean() ? 0 : 1;
int x = MHelper.randRange(radius, 15 - radius, random);
int z = MHelper.randRange(radius, 15 - radius, random);
int y = map.get(x, z);
if (y > 80) {
pos.set(x, y, z);
if (chunk.getBlockState(pos.down()).getBlock() == Blocks.END_STONE) {
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
crystal(chunk, pos, radius, height, fill, random);
}
}
}
return true; return true;
} }
@ -137,4 +187,33 @@ public class MountainPiece extends BasePiece {
int maxZ = MHelper.floor(center.getZ() + radius + 1); int maxZ = MHelper.floor(center.getZ() + radius + 1);
this.boundingBox = new BlockBox(minX, minZ, maxX, maxZ); this.boundingBox = new BlockBox(minX, minZ, maxX, maxZ);
} }
private void crystal(Chunk chunk, BlockPos pos, int radius, int height, float fill, Random random) {
Mutable mut = new Mutable();
int max = MHelper.floor(fill * radius + radius + 0.5F);
height += pos.getY();
Heightmap map = chunk.getHeightmap(Type.WORLD_SURFACE);
int coefX = MHelper.randRange(-1, 1, random);
int coefZ = MHelper.randRange(-1, 1, random);
for (int x = -radius; x <= radius; x++) {
mut.setX(x + pos.getX());
if (mut.getX() >= 0 && mut.getX() < 16) {
int ax = Math.abs(x);
for (int z = -radius; z <= radius; z++) {
mut.setZ(z + pos.getZ());
if (mut.getZ() >= 0 && mut.getZ() < 16) {
int az = Math.abs(z);
if (ax + az < max) {
int minY = map.get(mut.getX(), mut.getZ()) - MHelper.randRange(3, 7, random);
int h = coefX * x + coefZ * z + height;
for (int y = minY; y < h; y++) {
mut.setY(y);
chunk.setBlockState(mut, BlockRegistry.AURORA_CRYSTAL.getDefaultState(), false);
}
}
}
}
}
}
}
} }

View file

@ -0,0 +1,3 @@
{
"defaultMaterial": "betterend:glow_all"
}

View file

@ -1,5 +1,5 @@
{ {
"parent": "betterend:block/tint_cube", "parent": "betterend:block/tint_cube_noshade",
"textures": { "textures": {
"texture": "betterend:block/aurora_crystal" "texture": "betterend:block/aurora_crystal"
} }

View file

@ -0,0 +1,22 @@
{
"parent": "block/block",
"textures": {
"particle": "#texture"
},
"elements": [
{
"__comment": "Box1",
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"shade": false,
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down", "tintindex": 0 },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "up", "tintindex": 0 },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "north", "tintindex": 0 },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "south", "tintindex": 0 },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "west", "tintindex": 0 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "east", "tintindex": 0 }
}
}
]
}