Small fix

This commit is contained in:
paulevsGitch 2020-11-06 15:03:26 +03:00
parent 73aa475247
commit ed16c1befe
3 changed files with 17 additions and 4 deletions

View file

@ -147,7 +147,7 @@ public class EndBiome {
list.add(new StructureInfo(structure, offsetY, adjustTerrain)); list.add(new StructureInfo(structure, offsetY, adjustTerrain));
}); });
if (!list.isEmpty()) { if (!list.isEmpty()) {
structuresFeature = EndFeature.makeChansedFeature(nm + "_structures", new ListFeature(list), 50); structuresFeature = EndFeature.makeChansedFeature(nm + "_structures", new ListFeature(list), 30);
} }
} }
} }

View file

@ -6,6 +6,7 @@ import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -102,6 +103,18 @@ public abstract class NBTStructureFeature extends DefaultFeature {
int x2 = x1 + offset.getX(); int x2 = x1 + offset.getX();
int z2 = z1 + offset.getZ(); int z2 = z1 + offset.getZ();
if (x2 < x1) {
int a = x1;
x1 = x2;
x2 = a;
}
if (z2 < z1) {
int a = z1;
z1 = z2;
z2 = a;
}
int surfMax = posY - 1; int surfMax = posY - 1;
for (int x = x1; x <= x2; x++) { for (int x = x1; x <= x2; x++) {
mut.setX(x); mut.setX(x);
@ -109,11 +122,11 @@ public abstract class NBTStructureFeature extends DefaultFeature {
mut.setZ(z); mut.setZ(z);
mut.setY(posY); mut.setY(posY);
BlockState state = world.getBlockState(mut); BlockState state = world.getBlockState(mut);
if (!state.isIn(EndTags.GEN_TERRAIN) && Block.sideCoversSmallSquare(world, mut, Direction.DOWN)) { if (!state.isIn(EndTags.GEN_TERRAIN) && state.isSideSolidFullSquare(world, mut, Direction.DOWN)) {
for (int i = 0; i < 10; i--) { for (int i = 0; i < 10; i--) {
mut.setY(mut.getY() - 1); mut.setY(mut.getY() - 1);
BlockState stateSt = world.getBlockState(mut); BlockState stateSt = world.getBlockState(mut);
if (!stateSt.isIn(EndTags.GEN_TERRAIN) && stateSt.getMaterial().isReplaceable()) { if (!stateSt.isIn(EndTags.GEN_TERRAIN)) {
SurfaceConfig config = world.getBiome(mut).getGenerationSettings().getSurfaceConfig(); SurfaceConfig config = world.getBiome(mut).getGenerationSettings().getSurfaceConfig();
boolean isTop = mut.getY() == surfMax && state.getMaterial().blocksLight(); boolean isTop = mut.getY() == surfMax && state.getMaterial().blocksLight();
BlockState top = isTop ? config.getTopMaterial() : config.getUnderMaterial(); BlockState top = isTop ? config.getTopMaterial() : config.getUnderMaterial();

View file

@ -48,7 +48,7 @@ public class StructureEternalPortal extends StructureFeatureBase {
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random); int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG); int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
if (y > 50) { if (y > 50) {
this.children.add(new NBTPiece(STRUCTURE_ID, STRUCTURE, new BlockPos(x, y - 3, z), random.nextInt(5), true, random)); this.children.add(new NBTPiece(STRUCTURE_ID, STRUCTURE, new BlockPos(x, y - 4, z), random.nextInt(5), true, random));
} }
this.setBoundingBoxFromChildren(); this.setBoundingBoxFromChildren();
} }