Updated Tag API and tag constants
This commit is contained in:
parent
7ab5377a03
commit
db082ef1be
35 changed files with 308 additions and 385 deletions
|
@ -15,7 +15,6 @@ import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.config.Configs;
|
||||
import ru.bclib.util.WeightedList;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.bclib.world.biomes;
|
|||
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import ru.bclib.config.Configs;
|
||||
import ru.bclib.world.biomes.VanillaBiomeSettings.Builder;
|
||||
|
||||
public class BCLBiomeSettings {
|
||||
public static Builder createBCL(){
|
||||
|
|
|
@ -106,9 +106,10 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
center = center.offset(0, getYOffset(structure, world, center, random) + 0.5, 0);
|
||||
|
||||
BoundingBox bounds = makeBox(center);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation)
|
||||
.setMirror(mirror)
|
||||
.setBoundingBox(bounds);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings()
|
||||
.setRotation(rotation)
|
||||
.setMirror(mirror)
|
||||
.setBoundingBox(bounds);
|
||||
addStructureData(placementData);
|
||||
center = center.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
|
||||
structure.placeInWorld(world, center, center, placementData, random, 4);
|
||||
|
@ -140,11 +141,11 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
mut.setZ(z);
|
||||
mut.setY(surfMax);
|
||||
BlockState state = world.getBlockState(mut);
|
||||
if (!state.is(TagAPI.BLOCK_GEN_TERRAIN) && state.isFaceSturdy(world, mut, Direction.DOWN)) {
|
||||
if (!isTerrain(state) && state.isFaceSturdy(world, mut, Direction.DOWN)) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
BlockState stateSt = world.getBlockState(mut);
|
||||
if (!stateSt.is(TagAPI.BLOCK_GEN_TERRAIN)) {
|
||||
if (!isTerrain(stateSt)) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
boolean isTop = mut.getY() == surfMax && state.getMaterial().isSolidBlocking();
|
||||
Biome b = world.getBiome(mut);
|
||||
|
@ -156,7 +157,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (stateSt.is(TagAPI.BLOCK_END_GROUND) && state.getMaterial().isSolidBlocking()) {
|
||||
if (isTerrain(state) && state.getMaterial().isSolidBlocking()) {
|
||||
if (merge == TerrainMerge.SURFACE) {
|
||||
Biome b = world.getBiome(mut);
|
||||
BlockState bottom = BiomeAPI.findUnderMaterial(b).orElse(defaultBlock);
|
||||
|
@ -178,6 +179,10 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean isTerrain(BlockState state) {
|
||||
return state.is(TagAPI.COMMON_BLOCK_END_STONES) || state.is(TagAPI.COMMON_BLOCK_NETHER_STONES);
|
||||
}
|
||||
|
||||
protected BoundingBox makeBox(BlockPos pos) {
|
||||
int sx = ((pos.getX() >> 4) << 4) - 16;
|
||||
int sz = ((pos.getZ() >> 4) << 4) - 16;
|
||||
|
@ -210,7 +215,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
|||
return template;
|
||||
}
|
||||
|
||||
public static enum TerrainMerge {
|
||||
public enum TerrainMerge {
|
||||
NONE, SURFACE, OBJECT;
|
||||
|
||||
public static TerrainMerge getFromString(String type) {
|
||||
|
|
|
@ -4,8 +4,6 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.bclib.world.biomes.BCLBiomeSettings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue