Removed Color Extractor, fixed eternal block destruction

This commit is contained in:
paulevsGitch 2021-05-26 15:48:57 +03:00
parent cd6b385ae2
commit 0486d7d89c
12 changed files with 36 additions and 585 deletions

View file

@ -1,37 +0,0 @@
package ru.betterend.blocks;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
public class EternalRunedFlavolite extends RunedFlavolite {
@Override
public float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) {
return 0.0F;
}
@Override
public float getExplosionResistance() {
return Blocks.BEDROCK.getExplosionResistance();
}
@Override
public boolean dropFromExplosion(Explosion explosion) {
return false;
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList();
}
}

View file

@ -1,19 +1,31 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.List;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import ru.bclib.util.BlocksHelper;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
public class RunedFlavolite extends BlockBase { public class RunedFlavolite extends BlockBase {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public RunedFlavolite() { public RunedFlavolite(boolean unbreakable) {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getExplosionResistance()).luminance(state -> { super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished)
.strength(
unbreakable ? -1 : 1,
unbreakable ? Blocks.BEDROCK.getExplosionResistance() : Blocks.OBSIDIAN.getExplosionResistance()
).luminance(state -> {
return state.getValue(ACTIVATED) ? 8 : 0; return state.getValue(ACTIVATED) ? 8 : 0;
})); }));
this.registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false)); this.registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false));
@ -23,4 +35,17 @@ public class RunedFlavolite extends BlockBase {
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) { protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
stateManager.add(ACTIVATED); stateManager.add(ACTIVATED);
} }
@Override
public boolean dropFromExplosion(Explosion explosion) {
return !BlocksHelper.isInvulnerableUnsafe(this.defaultBlockState());
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
if (BlocksHelper.isInvulnerableUnsafe(this.defaultBlockState())) {
return Lists.newArrayList();
}
return super.getDrops(state, builder);
}
} }

View file

@ -20,8 +20,8 @@ import net.minecraft.world.level.levelgen.feature.EndPodiumFeature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.StructureHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.util.StructureHelper;
import ru.betterend.util.WorldDataUtil; import ru.betterend.util.WorldDataUtil;
import ru.betterend.world.generator.GeneratorOptions; import ru.betterend.world.generator.GeneratorOptions;

View file

@ -25,9 +25,9 @@ import net.minecraft.world.level.levelgen.feature.SpikeFeature;
import net.minecraft.world.level.levelgen.feature.configurations.SpikeConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.SpikeConfiguration;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.StructureHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
import ru.betterend.util.StructureHelper;
import ru.betterend.util.WorldDataUtil; import ru.betterend.util.WorldDataUtil;
import ru.betterend.world.generator.GeneratorOptions; import ru.betterend.world.generator.GeneratorOptions;

View file

@ -86,8 +86,8 @@ public class EndBlocks {
public static final Block SULPHUR_CRYSTAL = registerBlock("sulphur_crystal", new SulphurCrystalBlock()); public static final Block SULPHUR_CRYSTAL = registerBlock("sulphur_crystal", new SulphurCrystalBlock());
public static final Block MISSING_TILE = registerBlock("missing_tile", new MissingTileBlock()); public static final Block MISSING_TILE = registerBlock("missing_tile", new MissingTileBlock());
public static final Block FLAVOLITE_RUNED = registerBlock("flavolite_runed", new RunedFlavolite()); public static final Block FLAVOLITE_RUNED = registerBlock("flavolite_runed", new RunedFlavolite(false));
public static final Block FLAVOLITE_RUNED_ETERNAL = registerBlock("flavolite_runed_eternal", new EternalRunedFlavolite()); public static final Block FLAVOLITE_RUNED_ETERNAL = registerBlock("flavolite_runed_eternal", new RunedFlavolite(true));
public static final Block ANDESITE_PEDESTAL = registerBlock("andesite_pedestal", new PedestalVanilla(Blocks.ANDESITE)); public static final Block ANDESITE_PEDESTAL = registerBlock("andesite_pedestal", new PedestalVanilla(Blocks.ANDESITE));
public static final Block DIORITE_PEDESTAL = registerBlock("diorite_pedestal", new PedestalVanilla(Blocks.DIORITE)); public static final Block DIORITE_PEDESTAL = registerBlock("diorite_pedestal", new PedestalVanilla(Blocks.DIORITE));

View file

@ -1,153 +0,0 @@
package ru.betterend.util;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import ru.bclib.util.ColorUtil;
public class ColorExtractor {
private List<Center> centers = new ArrayList<>();
private List<Integer> colors;
private Integer result;
public ColorExtractor(List<Integer> colors) {
this.colors = colors;
Random rnd = new Random();
int size = colors.size();
for (int i = 0; i < 4; i++) {
int color = colors.get(rnd.nextInt(size));
this.centers.add(new Center(color));
}
}
public int analize() {
boolean moved = true;
while (moved) {
this.remap();
moved = false;
for (Center center : centers) {
if (center.move()) {
moved = true;
}
}
}
List<Center> toClear = new ArrayList<>();
this.centers.forEach(center -> {
if (center.colors.isEmpty()) {
toClear.add(center);
}
});
if (toClear.size() > 0) {
toClear.forEach(clear ->
centers.remove(clear));
}
this.centers.sort(Center.COMPARATOR);
return this.getResult();
}
public int getResult() {
if (result == null) {
double weights = 0;
double alpha = 0;
double red = 0;
double green = 0;
double blue = 0;
for (Center center : centers) {
double weight = (double) center.colors.size() / colors.size();
weights += weight;
alpha += center.a * weight;
red += center.r * weight;
green += center.g * weight;
blue += center.b * weight;
};
int a = (int) Math.round(alpha / weights);
int r = (int) Math.round(red / weights);
int g = (int) Math.round(green / weights);
int b = (int) Math.round(blue / weights);
this.result = a << 24 | r << 16 | g << 8 | b;
}
return this.result;
}
private void remap() {
this.centers.forEach(entry -> entry.colors.clear());
this.colors.forEach(color -> {
int id = 0;
int base = centers.get(0).getColor();
int dst = ColorUtil.colorDistance(color, base);
for (Center center : centers) {
base = center.getColor();
int dst1 = ColorUtil.colorDistance(color, base);
if (dst1 < dst) {
dst = dst1;
id = centers.indexOf(center);
}
}
this.centers.get(id).colors.add(color);
});
}
private static class Center {
static final Comparator<Center> COMPARATOR = new Comparator<Center>() {
@Override
public int compare(Center c1, Center c2) {
return Integer.compare(c1.getColor(), c2.getColor());
}
};
List<Integer> colors = new ArrayList<>();
double a, r, g, b;
Center(int color) {
this.a = (color >> 24) & 255;
this.r = (color >> 16) & 255;
this.g = (color >> 8) & 255;
this.b = color & 255;
}
private void update(double a, double r, double g, double b) {
this.a = a;
this.r = r;
this.g = g;
this.b = b;
}
public int getColor() {
int a = (int) Math.round(this.a);
int r = (int) Math.round(this.r);
int g = (int) Math.round(this.g);
int b = (int) Math.round(this.b);
return a << 24 | r << 16 | g << 8 | b;
}
public boolean move() {
double or = r;
double og = g;
double ob = b;
double a = 0, r = 0, g = 0, b = 0;
int size = this.colors.size();
for (int col : colors) {
a += (col >> 24) & 255;
r += (col >> 16) & 255;
g += (col >> 8) & 255;
b += col & 255;
}
a /= size;
r /= size;
g /= size;
b /= size;
this.update(a, r, g, b);
return Math.abs(r - or) > 0.1 ||
Math.abs(g - og) > 0.1 ||
Math.abs(b - ob) > 0.1;
}
}
}

View file

@ -1,384 +0,0 @@
package ru.betterend.util;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Random;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.level.material.Material;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
public class StructureHelper {
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
public static StructureTemplate readStructure(ResourceLocation resource) {
String ns = resource.getNamespace();
String nm = resource.getPath();
return readStructure("/data/" + ns + "/structures/" + nm + ".nbt");
}
public static StructureTemplate readStructure(File datapack, String path) {
if (datapack.isDirectory()) {
return readStructure(datapack.toString() + "/" + path);
}
else if (datapack.isFile() && datapack.getName().endsWith(".zip")) {
try {
ZipFile zipFile = new ZipFile(datapack);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
String name = entry.getName();
long compressedSize = entry.getCompressedSize();
long normalSize = entry.getSize();
String type = entry.isDirectory() ? "DIR" : "FILE";
System.out.println(name);
System.out.format("\t %s - %d - %d\n", type, compressedSize, normalSize);
}
zipFile.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
public static StructureTemplate readStructure(String path) {
try {
InputStream inputstream = StructureHelper.class.getResourceAsStream(path);
return readStructureFromStream(inputstream);
}
catch (IOException e) {
e.printStackTrace();
}
return null;
}
private static StructureTemplate readStructureFromStream(InputStream stream) throws IOException {
CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
StructureTemplate template = new StructureTemplate();
template.load(nbttagcompound);
return template;
}
public static BlockPos offsetPos(BlockPos pos, StructureTemplate structure, Rotation rotation, Mirror mirror) {
BlockPos offset = StructureTemplate.transform(structure.getSize(), mirror, rotation, BlockPos.ZERO);
return pos.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
}
public static void placeCenteredBottom(WorldGenLevel world, BlockPos pos, StructureTemplate structure, Rotation rotation, Mirror mirror, Random random) {
placeCenteredBottom(world, pos, structure, rotation, mirror, makeBox(pos), random);
}
public static void placeCenteredBottom(WorldGenLevel world, BlockPos pos, StructureTemplate structure, Rotation rotation, Mirror mirror, BoundingBox bounds, Random random) {
BlockPos offset = offsetPos(pos, structure, rotation, mirror);
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror).setBoundingBox(bounds);
structure.placeInWorldChunk(world, offset, placementData, random);
}
private static BoundingBox makeBox(BlockPos pos) {
int sx = ((pos.getX() >> 4) << 4) - 16;
int sz = ((pos.getZ() >> 4) << 4) - 16;
int ex = sx + 47;
int ez = sz + 47;
return BoundingBox.createProper(sx, 0, sz, ex, 255, ez);
}
public static BoundingBox getStructureBounds(BlockPos pos, StructureTemplate structure, Rotation rotation, Mirror mirror) {
BlockPos max = structure.getSize();
BlockPos min = StructureTemplate.transform(structure.getSize(), mirror, rotation, BlockPos.ZERO);
max = max.subtract(min);
return new BoundingBox(min.offset(pos), max.offset(pos));
}
public static BoundingBox intersectBoxes(BoundingBox box1, BoundingBox box2) {
int x1 = MHelper.max(box1.x0, box2.x0);
int y1 = MHelper.max(box1.y0, box2.y0);
int z1 = MHelper.max(box1.z0, box2.z0);
int x2 = MHelper.min(box1.x1, box2.x1);
int y2 = MHelper.min(box1.y1, box2.y1);
int z2 = MHelper.min(box1.z1, box2.z1);
return BoundingBox.createProper(x1, y1, z1, x2, y2, z2);
}
public static void erode(WorldGenLevel world, BoundingBox bounds, int iterations, Random random) {
MutableBlockPos mut = new MutableBlockPos();
boolean canDestruct = true;
for (int i = 0; i < iterations; i++) {
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
for (int y = bounds.y1; y >= bounds.y0; y--) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (canDestruct && state.is(EndBlocks.FLAVOLITE_RUNED_ETERNAL) && random.nextInt(8) == 0 && world.isEmptyBlock(mut.below(2))) {
int r = MHelper.randRange(1, 4, random);
int cx = mut.getX();
int cy = mut.getY();
int cz = mut.getZ();
int x1 = cx - r;
int y1 = cy - r;
int z1 = cz - r;
int x2 = cx + r;
int y2 = cy + r;
int z2 = cz + r;
for (int px = x1; px <= x2; px++) {
int dx = px - cx;
dx *= dx;
mut.setX(px);
for (int py = y1; py <= y2; py++) {
int dy = py - cy;
dy *= dy;
mut.setY(py);
for (int pz = z1; pz <= z2; pz++) {
int dz = pz - cz;
dz *= dz;
mut.setZ(pz);
if (dx + dy + dz <= r && world.getBlockState(mut).is(EndBlocks.FLAVOLITE_RUNED_ETERNAL)) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
}
}
}
}
mut.setX(cx);
mut.setY(cy);
mut.setZ(cz);
canDestruct = false;
continue;
}
else if (ignore(state)) {
continue;
}
if (!state.isAir() && random.nextBoolean()) {
shuffle(random);
for (Direction dir: DIR) {
if (world.isEmptyBlock(mut.relative(dir)) && world.isEmptyBlock(mut.below().relative(dir))) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
mut.move(dir).move(Direction.DOWN);
for (int py = mut.getY(); y >= bounds.y0 - 10; y--) {
mut.setY(py - 1);
if (!world.isEmptyBlock(mut)) {
mut.setY(py);
BlocksHelper.setWithoutUpdate(world, mut, state);
break;
}
}
}
}
break;
}
else if (random.nextInt(8) == 0 && !world.getBlockState(mut.above()).is(EndBlocks.ETERNAL_PEDESTAL)) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
}
}
}
}
}
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
for (int y = bounds.y1; y >= bounds.y0; y--) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (!ignore(state) && world.isEmptyBlock(mut.below())) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
for (int py = mut.getY(); py >= bounds.y0 - 10; py--) {
mut.setY(py - 1);
if (!world.isEmptyBlock(mut)) {
mut.setY(py);
BlocksHelper.setWithoutUpdate(world, mut, state);
break;
}
}
}
}
}
}
}
public static void erodeIntense(WorldGenLevel world, BoundingBox bounds, Random random) {
MutableBlockPos mut = new MutableBlockPos();
MutableBlockPos mut2 = new MutableBlockPos();
int minY = bounds.y0 - 10;
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
for (int y = bounds.y1; y >= bounds.y0; y--) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (!ignore(state)) {
if (random.nextInt(6) == 0) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
if (random.nextBoolean()) {
int px = MHelper.floor(random.nextGaussian() * 2 + x + 0.5);
int pz = MHelper.floor(random.nextGaussian() * 2 + z + 0.5);
mut2.set(px, y, pz);
while (world.getBlockState(mut2).getMaterial().isReplaceable() && mut2.getY() > minY) {
mut2.setY(mut2.getY() - 1);
}
if (!world.getBlockState(mut2).isAir() && state.canSurvive(world, mut2)) {
mut2.setY(mut2.getY() + 1);
BlocksHelper.setWithoutUpdate(world, mut2, state);
}
}
}
else if (random.nextInt(8) == 0) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
}
}
}
}
}
drop(world, bounds);
}
private static boolean isTerrainNear(WorldGenLevel world, BlockPos pos) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
if (world.getBlockState(pos.relative(dir)).is(EndTags.GEN_TERRAIN)) {
return true;
}
}
return false;
}
private static void drop(WorldGenLevel world, BoundingBox bounds) {
MutableBlockPos mut = new MutableBlockPos();
Set<BlockPos> blocks = Sets.newHashSet();
Set<BlockPos> edge = Sets.newHashSet();
Set<BlockPos> add = Sets.newHashSet();
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
for (int y = bounds.y0; y <= bounds.y1; y++) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (!ignore(state) && isTerrainNear(world, mut)) {
edge.add(mut.immutable());
}
}
}
}
if (edge.isEmpty()) {
return;
}
while (!edge.isEmpty()) {
for (BlockPos center: edge) {
for (Direction dir: BlocksHelper.DIRECTIONS) {
BlockState state = world.getBlockState(center);
if (state.isCollisionShapeFullBlock(world, center)) {
mut.set(center).move(dir);
if (bounds.isInside(mut)) {
state = world.getBlockState(mut);
if (!ignore(state) && !blocks.contains(mut)) {
add.add(mut.immutable());
}
}
}
}
}
blocks.addAll(edge);
edge.clear();
edge.addAll(add);
add.clear();
}
int minY = bounds.y0 - 10;
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
for (int y = bounds.y0; y <= bounds.y1; y++) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (!ignore(state) && !blocks.contains(mut)) {
BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR);
while (world.getBlockState(mut).getMaterial().isReplaceable() && mut.getY() > minY) {
mut.setY(mut.getY() - 1);
}
if (mut.getY() > minY) {
mut.setY(mut.getY() + 1);
BlocksHelper.setWithoutUpdate(world, mut, state);
}
}
}
}
}
}
private static boolean ignore(BlockState state) {
return state.getMaterial().isReplaceable()
|| !state.getFluidState().isEmpty()
|| state.is(EndTags.END_GROUND)
|| state.is(EndBlocks.ETERNAL_PEDESTAL)
|| state.is(EndBlocks.FLAVOLITE_RUNED_ETERNAL)
|| state.is(BlockTags.LOGS)
|| state.is(BlockTags.LEAVES)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);
}
private static void shuffle(Random random) {
for (int i = 0; i < 4; i++) {
int j = random.nextInt(4);
Direction d = DIR[i];
DIR[i] = DIR[j];
DIR[j] = d;
}
}
public static void cover(WorldGenLevel world, BoundingBox bounds, Random random) {
MutableBlockPos mut = new MutableBlockPos();
for (int x = bounds.x0; x <= bounds.x1; x++) {
mut.setX(x);
for (int z = bounds.z0; z <= bounds.z1; z++) {
mut.setZ(z);
BlockState top = world.getBiome(mut).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
for (int y = bounds.y1; y >= bounds.y0; y--) {
mut.setY(y);
BlockState state = world.getBlockState(mut);
if (state.is(EndTags.END_GROUND) && !world.getBlockState(mut.above()).getMaterial().isSolidBlocking()) {
BlocksHelper.setWithoutUpdate(world, mut, top);
}
}
}
}
}
}

View file

@ -12,8 +12,8 @@ import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import ru.bclib.util.JsonFactory; import ru.bclib.util.JsonFactory;
import ru.bclib.util.StructureHelper;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.util.StructureHelper;
import ru.betterend.world.features.EndFeature; import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.ListFeature; import ru.betterend.world.features.ListFeature;
import ru.betterend.world.features.ListFeature.StructureInfo; import ru.betterend.world.features.ListFeature.StructureInfo;

View file

@ -21,9 +21,9 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.bclib.util.StructureHelper;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
import ru.betterend.util.StructureHelper;
public class CrashedShipFeature extends NBTStructureFeature { public class CrashedShipFeature extends NBTStructureFeature {
private static final StructureProcessor REPLACER; private static final StructureProcessor REPLACER;

View file

@ -9,8 +9,8 @@ import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.StructureHelper;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.StructureHelper;
public class ListFeature extends NBTStructureFeature { public class ListFeature extends NBTStructureFeature {
private final List<StructureInfo> list; private final List<StructureInfo> list;

View file

@ -17,8 +17,8 @@ import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.bclib.util.StructureHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.util.StructureHelper;
import ru.betterend.world.structures.piece.NBTPiece; import ru.betterend.world.structures.piece.NBTPiece;
public class EternalPortalStructure extends FeatureBaseStructure { public class EternalPortalStructure extends FeatureBaseStructure {

View file

@ -17,8 +17,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.bclib.util.StructureHelper;
import ru.betterend.registry.EndStructures; import ru.betterend.registry.EndStructures;
import ru.betterend.util.StructureHelper;
public class NBTPiece extends BasePiece { public class NBTPiece extends BasePiece {
private ResourceLocation structureID; private ResourceLocation structureID;