Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -8,9 +8,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() {
|
||||
}
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@ package ru.betterend.integration.byg;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.collection.WeightedList;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.ai.behavior.WeightedList;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.ModIntegration;
|
||||
|
@ -32,31 +31,31 @@ public class BYGIntegration extends ModIntegration {
|
|||
@Override
|
||||
public void addBiomes() {
|
||||
BYGBiomes.addBiomes();
|
||||
|
||||
|
||||
Class<?> biomeClass = this.getClass("corgiaoc.byg.common.world.biome.BYGEndBiome");
|
||||
List<Object> biomes = this.getStaticFieldValue(biomeClass, "BYG_END_BIOMES");
|
||||
|
||||
|
||||
if (biomes != null && biomeClass != null) {
|
||||
biomes.forEach((obj) -> {
|
||||
Biome biome = this.getAndExecuteRuntime(biomeClass, obj, "getBiome");
|
||||
if (biome != null) {
|
||||
ResourceLocation biomeID = BuiltinRegistries.BIOME.getId(biome);
|
||||
ResourceLocation biomeID = BuiltinRegistries.BIOME.getKey(biome);
|
||||
EndBiome endBiome = EndBiomes.getBiome(biomeID);
|
||||
Biome edge = this.getAndExecuteRuntime(biomeClass, obj, "getEdge");
|
||||
if (edge != null) {
|
||||
ResourceLocation edgeID = BuiltinRegistries.BIOME.getId(edge);
|
||||
ResourceLocation edgeID = BuiltinRegistries.BIOME.getKey(edge);
|
||||
EndBiomes.LAND_BIOMES.removeMutableBiome(edgeID);
|
||||
EndBiomes.VOID_BIOMES.removeMutableBiome(edgeID);
|
||||
EndBiome edgeBiome = EndBiomes.getBiome(edgeID);
|
||||
endBiome.setEdge(edgeBiome);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Boolean isVoid = this.getAndExecuteRuntime(biomeClass, obj, "isVoid");
|
||||
if (isVoid != null && isVoid.booleanValue()) {
|
||||
EndBiomes.LAND_BIOMES.removeMutableBiome(biomeID);
|
||||
EndBiomes.VOID_BIOMES.addBiomeMutable(endBiome);
|
||||
}
|
||||
WeightedList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(biomeClass, obj,
|
||||
"getHills");
|
||||
WeightedList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(biomeClass, obj, "getHills");
|
||||
if (subBiomes != null) {
|
||||
subBiomes.stream().collect(Collectors.toList()).forEach((id) -> {
|
||||
EndBiome subBiome = EndBiomes.getBiome(id);
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package ru.betterend.integration.byg.biomes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.entity.SpawnGroup;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
|
@ -17,30 +16,30 @@ public class EterialGrove extends EndBiome {
|
|||
public EterialGrove() {
|
||||
super(makeDef());
|
||||
}
|
||||
|
||||
|
||||
private static BiomeDefinition makeDef() {
|
||||
Biome biome = Integrations.BYG.getBiome("ethereal_islands");
|
||||
BiomeEffects effects = biome.getEffects();
|
||||
|
||||
BiomeSpecialEffects effects = biome.getSpecialEffects();
|
||||
|
||||
BiomeDefinition def = new BiomeDefinition("eterial_grove")
|
||||
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
|
||||
.addFeature(BYGFeatures.BIG_ETHER_TREE);
|
||||
|
||||
|
||||
if (BetterEnd.isClient()) {
|
||||
SoundEvent loop = effects.getLoopSound().get();
|
||||
SoundEvent music = effects.getMusic().get().getSound();
|
||||
SoundEvent additions = effects.getAdditionsSound().get().getSound();
|
||||
SoundEvent mood = effects.getMoodSound().get().getSound();
|
||||
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
|
||||
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
|
||||
SoundEvent additions = effects.getAmbientAdditionsSettings().get().getSoundEvent();
|
||||
SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent();
|
||||
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
|
||||
}
|
||||
|
||||
for (SpawnGroup group : SpawnGroup.values()) {
|
||||
List<SpawnEntry> list = biome.getSpawnSettings().getSpawnEntry(group);
|
||||
|
||||
for (MobCategory group: MobCategory.values()) {
|
||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group);
|
||||
list.forEach((entry) -> {
|
||||
def.addMobSpawn(entry);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package ru.betterend.integration.byg.biomes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.entity.SpawnGroup;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
import net.minecraft.world.gen.GenerationStep.Feature;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
|
@ -20,39 +19,45 @@ public class NightshadeRedwoods extends EndBiome {
|
|||
public NightshadeRedwoods() {
|
||||
super(makeDef());
|
||||
}
|
||||
|
||||
|
||||
private static BiomeDefinition makeDef() {
|
||||
Biome biome = Integrations.BYG.getBiome("nightshade_forest");
|
||||
BiomeEffects effects = biome.getEffects();
|
||||
|
||||
BiomeDefinition def = new BiomeDefinition("nightshade_redwoods").setFogColor(140, 108, 47).setFogDensity(1.5F)
|
||||
.setWaterAndFogColor(55, 70, 186).setFoliageColor(122, 17, 155)
|
||||
BiomeSpecialEffects effects = biome.getSpecialEffects();
|
||||
|
||||
BiomeDefinition def = new BiomeDefinition("nightshade_redwoods")
|
||||
.setFogColor(140, 108, 47)
|
||||
.setFogDensity(1.5F)
|
||||
.setWaterAndFogColor(55, 70, 186)
|
||||
.setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
|
||||
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get()).setGrassColor(48, 13, 89)
|
||||
.setPlantsColor(200, 125, 9).addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE).addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
|
||||
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
|
||||
.setGrassColor(48, 13, 89)
|
||||
.setPlantsColor(200, 125, 9)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.NIGHTSHADE_MOSS);
|
||||
|
||||
|
||||
if (BetterEnd.isClient()) {
|
||||
SoundEvent loop = effects.getLoopSound().get();
|
||||
SoundEvent music = effects.getMusic().get().getSound();
|
||||
SoundEvent additions = effects.getAdditionsSound().get().getSound();
|
||||
SoundEvent mood = effects.getMoodSound().get().getSound();
|
||||
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
|
||||
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
|
||||
SoundEvent additions = effects.getAmbientAdditionsSettings().get().getSoundEvent();
|
||||
SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent();
|
||||
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
|
||||
}
|
||||
biome.getGenerationSettings().getFeatures().forEach((list) -> {
|
||||
biome.getGenerationSettings().features().forEach((list) -> {
|
||||
list.forEach((feature) -> {
|
||||
def.addFeature(Feature.VEGETAL_DECORATION, feature.get());
|
||||
def.addFeature(Decoration.VEGETAL_DECORATION, feature.get());
|
||||
});
|
||||
});
|
||||
|
||||
for (SpawnGroup group : SpawnGroup.values()) {
|
||||
List<SpawnEntry> list = biome.getSpawnSettings().getSpawnEntry(group);
|
||||
|
||||
for (MobCategory group: MobCategory.values()) {
|
||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group);
|
||||
list.forEach((entry) -> {
|
||||
def.addMobSpawn(entry);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,20 +2,19 @@ package ru.betterend.integration.byg.biomes;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.entity.SpawnGroup;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.data.worldgen.Features;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||
import net.minecraft.world.gen.GenerationStep.Feature;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeatures;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
|
@ -27,60 +26,65 @@ public class OldBulbisGardens extends EndBiome {
|
|||
public OldBulbisGardens() {
|
||||
super(makeDef());
|
||||
}
|
||||
|
||||
|
||||
private static BiomeDefinition makeDef() {
|
||||
Biome biome = Integrations.BYG.getBiome("bulbis_gardens");
|
||||
BiomeEffects effects = biome.getEffects();
|
||||
|
||||
BiomeSpecialEffects effects = biome.getSpecialEffects();
|
||||
|
||||
Block ivis = Integrations.BYG.getBlock("ivis_phylium");
|
||||
Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
|
||||
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens").setFogColor(215, 132, 207).setFogDensity(1.8F)
|
||||
.setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.OLD_BULBIS_TREE);
|
||||
|
||||
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens")
|
||||
.setFogColor(215, 132, 207)
|
||||
.setFogDensity(1.8F)
|
||||
.setWaterAndFogColor(40, 0, 56)
|
||||
.setFoliageColor(122, 17, 155)
|
||||
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
|
||||
.setSurface(ivis, origin)
|
||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(BYGFeatures.OLD_BULBIS_TREE);
|
||||
|
||||
if (BetterEnd.isClient()) {
|
||||
SoundEvent loop = effects.getLoopSound().get();
|
||||
SoundEvent music = effects.getMusic().get().getSound();
|
||||
SoundEvent additions = effects.getAdditionsSound().get().getSound();
|
||||
SoundEvent mood = effects.getMoodSound().get().getSound();
|
||||
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
|
||||
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
|
||||
SoundEvent additions = effects.getAmbientAdditionsSettings().get().getSoundEvent();
|
||||
SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent();
|
||||
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
|
||||
}
|
||||
|
||||
for (SpawnGroup group : SpawnGroup.values()) {
|
||||
List<SpawnEntry> list = biome.getSpawnSettings().getSpawnEntry(group);
|
||||
|
||||
for (MobCategory group: MobCategory.values()) {
|
||||
List<SpawnerData> list = biome.getMobSettings().getMobs(group);
|
||||
list.forEach((entry) -> {
|
||||
def.addMobSpawn(entry);
|
||||
});
|
||||
}
|
||||
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = biome.getGenerationSettings().getFeatures();
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> vegetal = features.get(Feature.VEGETAL_DECORATION.ordinal());
|
||||
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = biome.getGenerationSettings().features();
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal());
|
||||
if (vegetal.size() > 2) {
|
||||
Supplier<ConfiguredFeature<?, ?>> getter;
|
||||
// Trees (first two features)
|
||||
// I couldn't process them with conditions, so that's why they are hardcoded
|
||||
// (paulevs)
|
||||
// I couldn't process them with conditions, so that's why they are hardcoded (paulevs)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
getter = vegetal.get(i);
|
||||
ConfiguredFeature<?, ?> feature = getter.get();
|
||||
ResourceLocation id = BetterEnd.makeID("obg_feature_" + i);
|
||||
feature = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id,
|
||||
feature.decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(1));
|
||||
def.addFeature(Feature.VEGETAL_DECORATION, feature);
|
||||
feature = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.decorated(Features.Decorators.HEIGHTMAP_SQUARE).countRandom(1));
|
||||
def.addFeature(Decoration.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
// Grasses and other features
|
||||
for (int i = 2; i < vegetal.size(); i++) {
|
||||
getter = vegetal.get(i);
|
||||
ConfiguredFeature<?, ?> feature = getter.get();
|
||||
def.addFeature(Feature.VEGETAL_DECORATION, feature);
|
||||
def.addFeature(Decoration.VEGETAL_DECORATION, feature);
|
||||
}
|
||||
}
|
||||
|
||||
def.addFeature(EndFeatures.PURPLE_POLYPORE).addFeature(BYGFeatures.IVIS_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS).addFeature(BYGFeatures.IVIS_VINE)
|
||||
.addFeature(BYGFeatures.IVIS_SPROUT);
|
||||
|
||||
|
||||
def.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
|
||||
.addFeature(BYGFeatures.IVIS_MOSS)
|
||||
.addFeature(BYGFeatures.IVIS_VINE)
|
||||
.addFeature(BYGFeatures.IVIS_SPROUT);
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,14 @@ package ru.betterend.integration.byg.features;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -23,7 +21,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("ether_log");
|
||||
|
@ -33,7 +31,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
|
||||
|
@ -51,7 +49,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> branch = SplineHelper.makeSpline(0, 0, 0, length, 0, 0, points < 2 ? 2 : points);
|
||||
SplineHelper.powerOffset(branch, length, 2F);
|
||||
int rotCount = MHelper.randRange(5, 7, random);
|
||||
// float startRad = Mth.lerp(splinePos, 2.3F, 0.8F) * 0.8F;
|
||||
// float startRad = MathHelper.lerp(splinePos, 2.3F, 0.8F) * 0.8F;
|
||||
Vector3f start = SplineHelper.getPos(trunk, splinePos * (trunk.size() - 1));
|
||||
for (int j = 0; j < rotCount; j++) {
|
||||
float angle = startAngle + (float) j / rotCount * MHelper.PI2;
|
||||
|
@ -65,7 +63,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
sdf.setReplaceFunction((state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
}).addPostProcess((info) -> {
|
||||
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
|
||||
|
@ -77,7 +75,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
// private void makeLeavesSphere(WorldGenLevel world, BlockPos pos,
|
||||
// private void makeLeavesSphere(StructureWorldAccess world, BlockPos pos,
|
||||
// BlockState leaves, Function<BlockState, Boolean> ignore) {
|
||||
//
|
||||
// }
|
||||
|
|
|
@ -2,21 +2,19 @@ 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.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -37,20 +35,20 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(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").with(LeavesBlock.DISTANCE, 1);
|
||||
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves").setValue(LeavesBlock.DISTANCE, 1);
|
||||
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves")
|
||||
.with(LeavesBlock.DISTANCE, 1);
|
||||
.setValue(LeavesBlock.DISTANCE, 1);
|
||||
|
||||
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
|
||||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
Function<PosInfo, BlockState> post = (info) -> {
|
||||
|
@ -78,7 +76,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
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) {
|
||||
if (offset.y() > max) {
|
||||
break;
|
||||
}
|
||||
List<Vector3f> branch = SplineHelper.copySpline(BRANCH);
|
||||
|
@ -98,13 +96,13 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
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.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
|
||||
}
|
||||
|
||||
for (int y = 0; y < 16; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
if (world.isAir(p)) {
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
if (world.isEmptyBlock(p)) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves);
|
||||
}
|
||||
float radius = (1 - y / 16F) * 3F;
|
||||
|
@ -115,8 +113,8 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
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)) {
|
||||
BlockPos lp = p.offset(x, 0, z);
|
||||
if (world.isEmptyBlock(lp)) {
|
||||
BlocksHelper.setWithoutUpdate(world, lp, leaves);
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +140,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
if (state.getBlock() instanceof LeavesBlock) {
|
||||
int distance = state.getValue(LeavesBlock.DISTANCE);
|
||||
if (d < distance) {
|
||||
info.setState(mut, state.with(LeavesBlock.DISTANCE, d));
|
||||
info.setState(mut, state.setValue(LeavesBlock.DISTANCE, d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +152,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
};
|
||||
Function<PosInfo, BlockState> leavesPost2 = (info) -> {
|
||||
if (info.getState().getBlock() instanceof LeavesBlock) {
|
||||
int distance = info.getState().get(LeavesBlock.DISTANCE);
|
||||
int distance = info.getState().getValue(LeavesBlock.DISTANCE);
|
||||
if (distance > MHelper.randRange(2, 4, random)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
}
|
||||
|
@ -168,7 +166,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
if (random.nextInt(8) == 0) {
|
||||
return leaves_flower.with(LeavesBlock.DISTANCE, distance);
|
||||
return leaves_flower.setValue(LeavesBlock.DISTANCE, distance);
|
||||
}
|
||||
}
|
||||
return info.getState();
|
||||
|
|
|
@ -2,21 +2,19 @@ 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.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -37,7 +35,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
|
||||
|
@ -49,7 +47,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
Function<PosInfo, BlockState> post = (info) -> {
|
||||
|
@ -78,7 +76,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
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) {
|
||||
if (offset.y() > max) {
|
||||
break;
|
||||
}
|
||||
List<Vector3f> branch = SplineHelper.copySpline(BRANCH);
|
||||
|
@ -97,13 +95,13 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
|
||||
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
|
||||
for (int y = 0; y < 8; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
|
||||
}
|
||||
|
||||
for (int y = 0; y < 16; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
if (world.isAir(p)) {
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
if (world.isEmptyBlock(p)) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves);
|
||||
}
|
||||
float radius = (1 - y / 16F) * 3F;
|
||||
|
@ -114,8 +112,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
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)) {
|
||||
BlockPos lp = p.offset(x, 0, z);
|
||||
if (world.isEmptyBlock(lp)) {
|
||||
BlocksHelper.setWithoutUpdate(world, lp, leaves);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +139,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
if (state.getBlock() instanceof LeavesBlock) {
|
||||
int distance = state.getValue(LeavesBlock.DISTANCE);
|
||||
if (d < distance) {
|
||||
info.setState(mut, state.with(LeavesBlock.DISTANCE, d));
|
||||
info.setState(mut, state.setValue(LeavesBlock.DISTANCE, d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +151,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
};
|
||||
Function<PosInfo, BlockState> leavesPost2 = (info) -> {
|
||||
if (info.getState().getBlock() instanceof LeavesBlock) {
|
||||
int distance = info.getState().get(LeavesBlock.DISTANCE);
|
||||
int distance = info.getState().getValue(LeavesBlock.DISTANCE);
|
||||
if (distance > MHelper.randRange(2, 4, random)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
}
|
||||
|
@ -167,7 +165,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
if (random.nextInt(8) == 0) {
|
||||
return leaves_flower.with(LeavesBlock.DISTANCE, distance);
|
||||
return leaves_flower.setValue(LeavesBlock.DISTANCE, distance);
|
||||
}
|
||||
}
|
||||
return info.getState();
|
||||
|
|
|
@ -3,19 +3,17 @@ package ru.betterend.integration.byg.features;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -38,9 +36,9 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
if (!world.getBlockState(pos.down(4)).getBlock().isIn(EndTags.GEN_TERRAIN))
|
||||
if (!world.getBlockState(pos.below(4)).getBlock().is(EndTags.GEN_TERRAIN))
|
||||
return false;
|
||||
|
||||
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
|
||||
|
@ -50,7 +48,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
|
||||
|
||||
Function<BlockState, Boolean> replacement = (state) -> {
|
||||
if (state.equals(stem) || state.equals(wood) || state.isIn(EndTags.END_GROUND)
|
||||
if (state.equals(stem) || state.equals(wood) || state.is(EndTags.END_GROUND)
|
||||
|| state.getMaterial().equals(Material.PLANT)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -67,7 +65,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SDF sdf = null;
|
||||
int x1 = ((pos.getX() >> 4) << 4) - 16;
|
||||
int z1 = ((pos.getZ() >> 4) << 4) - 16;
|
||||
Box limits = new Box(x1, pos.getY() - 5, z1, x1 + 47, pos.getY() + size * 2, z1 + 47);
|
||||
AABB limits = new AABB(x1, pos.getY() - 5, z1, x1 + 47, pos.getY() + size * 2, z1 + 47);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2 + MHelper.randRange(0, var, random) + start;
|
||||
List<Vector3f> spline = SplineHelper.copySpline(SPLINE);
|
||||
|
@ -140,12 +138,12 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> side = SplineHelper.copySpline(SIDE);
|
||||
SplineHelper.rotateSpline(side, angle);
|
||||
SplineHelper.scale(side, scale * radius);
|
||||
BlockPos p = pos.offset(point.getX() + 0.5F, point.getY() + 0.5F, point.getZ() + 0.5F);
|
||||
BlockPos p = pos.offset(point.x() + 0.5F, point.y() + 0.5F, point.z() + 0.5F);
|
||||
SplineHelper.fillSplineForce(side, world, wood, p, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
sphere.fillArea(world, pos, new Box(pos.up((int) offsetY)).expand(radius * 1.3F));
|
||||
sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F));
|
||||
}
|
||||
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood,
|
||||
|
@ -159,7 +157,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SplineHelper.rotateSpline(branch, angle);
|
||||
SplineHelper.scale(branch, scale);
|
||||
Vector3f last = branch.get(branch.size() - 1);
|
||||
if (world.getBlockState(pos.offset(last.getX(), last.getY(), last.getZ())).isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) {
|
||||
SplineHelper.fillSpline(branch, world, wood, pos, replacement);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue