Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/ru/betterend/item/ArmoredElytra.java
#	src/main/java/ru/betterend/registry/EndItems.java
#	src/main/resources/fabric.mod.json
This commit is contained in:
Aleksey 2021-05-04 10:40:19 +03:00
commit f7076457d2
23 changed files with 171 additions and 36 deletions

View file

@ -17,9 +17,36 @@ public class NourishIntegration extends ModIntegration {
Tag.Named<Item> protein = getItemTag("protein");
Tag.Named<Item> sweets = getItemTag("sweets");
TagHelper.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagHelper.addTag(fruit, EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED, EndItems.BLOSSOM_BERRY, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY);
TagHelper.addTag(protein, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagHelper.addTag(sweets, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY);
TagHelper.addTag(
fats,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED
);
TagHelper.addTag(
fruit,
EndItems.SHADOW_BERRY_RAW,
EndItems.SHADOW_BERRY_COOKED,
EndItems.BLOSSOM_BERRY,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.AMBER_ROOT_RAW,
EndItems.CHORUS_MUSHROOM_RAW,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED
);
TagHelper.addTag(
protein,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED,
EndItems.CAVE_PUMPKIN_PIE
);
TagHelper.addTag(
sweets,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.CAVE_PUMPKIN_PIE
);
}
}

View file

@ -52,25 +52,25 @@ public class EndDragonFightMixin {
@Inject(method = "tryRespawn", at = @At("HEAD"), cancellable = true)
private void be_tryRespawnDragon(CallbackInfo info) {
if (GeneratorOptions.replacePortal() && GeneratorOptions.hasDragonFights() && this.dragonKilled && this.respawnStage == null) {
BlockPos blockPos = this.portalLocation;
BlockPos blockPos = portalLocation;
if (blockPos == null) {
LOGGER.debug("Tried to respawn, but need to find the portal first.");
BlockPattern.BlockPatternMatch blockPatternMatch = this.findExitPortal();
if (blockPatternMatch == null) {
LOGGER.debug("Couldn't find a portal, so we made one.");
this.spawnExitPortal(true);
spawnExitPortal(true);
}
else {
LOGGER.debug("Found the exit portal & temporarily using it.");
}
blockPos = this.portalLocation;
blockPos = portalLocation;
}
List<EndCrystal> crystals = Lists.newArrayList();
BlockPos center = blockPos.above(2);
BlockPos center = GeneratorOptions.getPortalPos().above(5);
for (Direction dir : BlocksHelper.HORIZONTAL) {
List<EndCrystal> crystalList = this.level.getEntitiesOfClass(EndCrystal.class, new AABB(center.relative(dir, 3)));
List<EndCrystal> crystalList = level.getEntitiesOfClass(EndCrystal.class, new AABB(center.relative(dir, 4)));
if (crystalList.isEmpty()) {
info.cancel();
return;
@ -80,7 +80,7 @@ public class EndDragonFightMixin {
}
LOGGER.debug("Found all crystals, respawning dragon.");
this.respawnDragon(crystals);
respawnDragon(crystals);
info.cancel();
}
}

View file

@ -0,0 +1,43 @@
package ru.betterend.mixin.common;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.levelgen.feature.SpikeFeature.EndSpike;
import ru.betterend.util.WorldDataUtil;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(EndSpike.class)
public class EndSpikeMixin {
@Final
@Shadow
private int height;
@Inject(method = "getHeight", at = @At("HEAD"), cancellable = true)
private void be_getSpikeHeight(CallbackInfoReturnable<Integer> info) {
if (!GeneratorOptions.isDirectSpikeHeight()) {
int x = getCenterX();
int z = getCenterZ();
String pillarID = String.format("%d_%d", x, z);
CompoundTag pillar = WorldDataUtil.getCompoundTag("pillars");
int minY = pillar.contains(pillarID) ? pillar.getInt(pillarID) : 65;
int maxY = minY + height - 54;
info.setReturnValue(maxY);
}
}
@Shadow
public int getCenterX() {
return 0;
}
@Shadow
public int getCenterZ() {
return 0;
}
}

View file

@ -63,6 +63,7 @@ public class SpikeFeatureMixin {
minY = world.getChunk(x >> 4, z >> 4).getHeight(Types.WORLD_SURFACE, x & 15, z);
}
GeneratorOptions.setDirectSpikeHeight();
int maxY = minY + spike.getHeight() - 64;
if (GeneratorOptions.replacePillars() && be_radiusInRange(radius)) {

View file

@ -10,6 +10,7 @@ public class EndSounds {
public static final SoundEvent MUSIC_WATER = register("music", "water");
public static final SoundEvent MUSIC_DARK = register("music", "dark");
public static final SoundEvent MUSIC_OPENSPACE = register("music", "openspace");
public static final SoundEvent MUSIC_CAVES = register("music", "caves");
// Ambient
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
@ -21,6 +22,7 @@ public class EndSounds {
public static final SoundEvent AMBIENT_SULPHUR_SPRINGS = register("ambient", "sulphur_springs");
public static final SoundEvent AMBIENT_UMBRELLA_JUNGLE = register("ambient", "umbrella_jungle");
public static final SoundEvent AMBIENT_GLOWING_GRASSLANDS = register("ambient", "glowing_grasslands");
public static final SoundEvent AMBIENT_CAVES = register("ambient", "caves");
// Entity
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");

View file

@ -2,7 +2,6 @@ package ru.betterend.world.biome.cave;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class EmptyAuroraCaveBiome extends EndCaveBiome {
@ -12,7 +11,6 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome {
.setFogDensity(2.0F)
.setPlantsColor(108, 25, 46)
.setWaterAndFogColor(186, 77, 237)
.setMusic(EndSounds.MUSIC_FOREST)
.setParticles(EndParticles.GLOWING_SPHERE, 0.001F));
this.addFloorFeature(EndFeatures.BIG_AURORA_CRYSTAL, 1);

View file

@ -1,15 +1,11 @@
package ru.betterend.world.biome.cave;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class EmptyEndCaveBiome extends EndCaveBiome {
public EmptyEndCaveBiome() {
super(new BiomeDefinition("empty_end_cave")
.setFogDensity(2.0F)
.setMusic(EndSounds.MUSIC_FOREST));
super(new BiomeDefinition("empty_end_cave").setFogDensity(2.0F));
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE, 1);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE, 1);
}

View file

@ -2,7 +2,6 @@ package ru.betterend.world.biome.cave;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class EmptySmaragdantCaveBiome extends EndCaveBiome {
@ -12,7 +11,6 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome {
.setFogDensity(2.0F)
.setPlantsColor(0, 131, 145)
.setWaterAndFogColor(31, 167, 212)
.setMusic(EndSounds.MUSIC_FOREST)
.setParticles(EndParticles.SMARAGDANT, 0.001F));
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL, 1);

View file

@ -7,6 +7,7 @@ import net.minecraft.world.entity.ai.behavior.WeightedList;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.features.EndFeature;
@ -26,6 +27,8 @@ public class EndCaveBiome extends EndBiome {
new CaveChunkPopulatorFeature(() -> (EndCaveBiome) EndBiomes.getBiome(definition.getID()))
);
definition.addFeature(feature).setCaveBiome();
definition.setMusic(EndSounds.MUSIC_CAVES);
definition.setLoop(EndSounds.AMBIENT_CAVES);
return definition;
}

View file

@ -5,7 +5,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class JadeCaveBiome extends EndCaveBiome {
@ -18,7 +17,6 @@ public class JadeCaveBiome extends EndCaveBiome {
.setFogColor(118, 150, 112)
.setFogDensity(2.0F)
.setWaterAndFogColor(95, 223, 255)
.setMusic(EndSounds.MUSIC_FOREST)
);
JADE[0] = EndBlocks.VIRID_JADESTONE.stone.defaultBlockState();
JADE[1] = EndBlocks.AZURE_JADESTONE.stone.defaultBlockState();

View file

@ -7,7 +7,6 @@ import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class LushAuroraCaveBiome extends EndCaveBiome {
@ -17,7 +16,6 @@ public class LushAuroraCaveBiome extends EndCaveBiome {
.setFogDensity(2.0F)
.setPlantsColor(108, 25, 46)
.setWaterAndFogColor(186, 77, 237)
.setMusic(EndSounds.MUSIC_FOREST)
.setParticles(EndParticles.GLOWING_SPHERE, 0.001F)
.setSurface(EndBlocks.CAVE_MOSS));

View file

@ -3,7 +3,6 @@ package ru.betterend.world.biome.cave;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
import ru.betterend.world.biome.BiomeDefinition;
public class LushSmaragdantCaveBiome extends EndCaveBiome {
@ -13,7 +12,6 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome {
.setFogDensity(2.0F)
.setPlantsColor(0, 131, 145)
.setWaterAndFogColor(31, 167, 212)
.setMusic(EndSounds.MUSIC_FOREST)
.setParticles(EndParticles.SMARAGDANT, 0.001F)
.setSurface(EndBlocks.CAVE_MOSS));

View file

@ -11,6 +11,7 @@ import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.noise.OpenSimplexNoise;
@ -24,8 +25,13 @@ public class TunelCaveFeature extends EndCaveFeature {
private static final OpenSimplexNoise BIOME_NOISE_Z = new OpenSimplexNoise("biome_noise_z".hashCode());
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
int x1 = (center.getX() >> 4) << 4;
int z1 = (center.getZ() >> 4) << 4;
int cx = center.getX() >> 4;
int cz = center.getZ() >> 4;
if ((long) cx * (long) cx + (long) cz + (long) cz < 256) {
return Sets.newHashSet();
}
int x1 = cx << 4;
int z1 = cz << 4;
int x2 = x1 + 16;
int z2 = z1 + 16;
int y2 = world.getHeight();
@ -43,12 +49,19 @@ public class TunelCaveFeature extends EndCaveFeature {
for (int y = 0; y < y2; y++) {
pos.setY(y);
float val = Mth.abs((float) noiseH.eval(x * 0.02, y * 0.01, z * 0.02));
float vert = Mth.sin((y + (float) noiseV.eval(x * 0.01, z * 0.01) * 20) * 0.1F) * 0.9F;//Mth.abs(y - 50 + (float) noiseV.eval(x * 0.01, z * 0.01) * 20) * 0.1F;
float vert = Mth.sin((y + (float) noiseV.eval(x * 0.01, z * 0.01) * 20) * 0.1F) * 0.9F;
float dist = (float) noiseD.eval(x * 0.1, y * 0.1, z * 0.1) * 0.12F;
vert *= vert;
if (val + vert + dist < 0.15 && world.getBlockState(pos).is(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, pos, AIR);
positions.add(pos.immutable());
int height = world.getHeight(Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
if (height < pos.getY() + 4) {
while (pos.getY() < height) {
pos.setY(pos.getY() + 1);
BlocksHelper.setWithoutUpdate(world, pos, AIR);
}
}
}
}
}
@ -75,9 +88,14 @@ public class TunelCaveFeature extends EndCaveFeature {
Set<BlockPos> floorPositions = Sets.newHashSet();
Set<BlockPos> ceilPositions = Sets.newHashSet();
MutableBlockPos mut = new MutableBlockPos();
Set<BlockPos> remove = Sets.newHashSet();
caveBlocks.forEach((bpos) -> {
mut.set(bpos);
if (world.getBlockState(mut).getMaterial().isReplaceable()) {
int height = world.getHeight(Types.WORLD_SURFACE, bpos.getX(), bpos.getZ());
if (mut.getY() >= height) {
remove.add(bpos);
}
else if (world.getBlockState(mut).getMaterial().isReplaceable()) {
mut.setY(bpos.getY() - 1);
if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) {
floorPositions.add(mut.immutable());
@ -91,6 +109,7 @@ public class TunelCaveFeature extends EndCaveFeature {
BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
placeFloor(world, biome, floorPositions, random, surfaceBlock);
placeCeil(world, biome, ceilPositions, random);
caveBlocks.removeAll(remove);
placeWalls(world, biome, caveBlocks, random);
}
fixBlocks(world, preCaveBlocks);
@ -102,10 +121,16 @@ public class TunelCaveFeature extends EndCaveFeature {
private Set<BlockPos> mutateBlocks(Set<BlockPos> caveBlocks) {
Set<BlockPos> result = Sets.newHashSet();
caveBlocks.forEach(pos -> {
int dx = pos.getX() + (int) (BIOME_NOISE_X.eval(pos.getX() * 0.2, pos.getZ() * 0.2) * 5);
int dz = pos.getZ() + (int) (BIOME_NOISE_Z.eval(pos.getX() * 0.2, pos.getZ() * 0.2) * 5);
if ((dx >> 4) == (pos.getX() >> 4) && (dz >> 4) == (pos.getZ() >> 4)) {
result.add(pos);
int dx = pos.getX() + Mth.floor(BIOME_NOISE_X.eval(pos.getX() * 0.1, pos.getZ() * 0.1) * 3);
int dz = pos.getZ() + Mth.floor(BIOME_NOISE_Z.eval(pos.getX() * 0.1, pos.getZ() * 0.1) * 3);
if (dx >> 4 == pos.getX() >> 4 && dz >> 4 == pos.getZ() >> 4) {
int cx = ((pos.getX() >> 4) << 4) | 8;
int cz = ((pos.getZ() >> 4) << 4) | 8;
dx = pos.getX() - cx;
dz = pos.getZ() - cz;
if (dx * dx + dz * dz < 64) {
result.add(pos);
}
}
});
return result;

View file

@ -28,6 +28,7 @@ public class GeneratorOptions {
private static boolean replacePillars;
private static long islandDistBlock;
private static int islandDistChunk;
private static boolean directSpikeHeight;
public static void init() {
biomeSizeLand = Configs.GENERATOR_CONFIG.getInt("biomeMap", "biomeSizeLand", 256);
@ -142,4 +143,14 @@ public class GeneratorOptions {
public static int getIslandDistChunk() {
return islandDistChunk;
}
public static void setDirectSpikeHeight() {
directSpikeHeight = true;
}
public static boolean isDirectSpikeHeight() {
boolean height = directSpikeHeight;
directSpikeHeight = false;
return height;
}
}

View file

@ -26,7 +26,7 @@ public class EternalPortalStructure extends FeatureBaseStructure {
private static final StructureTemplate STRUCTURE = StructureHelper.readStructure(STRUCTURE_ID);
@Override
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, WorldgenRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration featureConfig) {
protected boolean isFeatureChunk(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, WorldgenRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration featureConfig) {
long x = (long) chunkPos.x * (long) chunkPos.x;
long z = (long) chunkPos.z * (long) chunkPos.z;
if (x + z < 1024L) {
@ -35,7 +35,7 @@ public class EternalPortalStructure extends FeatureBaseStructure {
if (chunkGenerator.getBaseHeight((chunkX << 4) | 8, (chunkZ << 4) | 8, Heightmap.Types.WORLD_SURFACE_WG) < 10) {
return false;
}
return super.shouldStartAt(chunkGenerator, biomeSource, worldSeed, chunkRandom, chunkX, chunkZ, biome, chunkPos, featureConfig);
return super.isFeatureChunk(chunkGenerator, biomeSource, worldSeed, chunkRandom, chunkX, chunkZ, biome, chunkPos, featureConfig);
}
@Override

View file

@ -21,7 +21,8 @@ public abstract class FeatureBaseStructure extends StructureFeature<NoneFeatureC
super(NoneFeatureConfiguration.CODEC);
}
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, WorldgenRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration featureConfig) {
@Override
protected boolean isFeatureChunk(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, WorldgenRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration featureConfig) {
return getGenerationHeight(chunkX, chunkZ, chunkGenerator) >= 20;
}