NBT Structure fix & Surface Builder fix
This commit is contained in:
parent
02068df82d
commit
947b790138
2 changed files with 9 additions and 8 deletions
|
@ -7,6 +7,7 @@ import java.util.Random;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.Vec3i;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -101,7 +102,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
||||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror).setBoundingBox(bounds);
|
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror).setBoundingBox(bounds);
|
||||||
addStructureData(placementData);
|
addStructureData(placementData);
|
||||||
center = center.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
|
center = center.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
|
||||||
structure.placeInWorld(world, center, placementData, random);
|
structure.placeInWorld(world, center, center, placementData, random, 4);
|
||||||
|
|
||||||
TerrainMerge merge = getTerrainMerge(world, center, random);
|
TerrainMerge merge = getTerrainMerge(world, center, random);
|
||||||
int x1 = center.getX();
|
int x1 = center.getX();
|
||||||
|
@ -173,7 +174,7 @@ public abstract class NBTStructureFeature extends DefaultFeature {
|
||||||
int sz = ((pos.getZ() >> 4) << 4) - 16;
|
int sz = ((pos.getZ() >> 4) << 4) - 16;
|
||||||
int ex = sx + 47;
|
int ex = sx + 47;
|
||||||
int ez = sz + 47;
|
int ez = sz + 47;
|
||||||
return BoundingBox.createProper(sx, 0, sz, ex, 255, ez);
|
return BoundingBox.fromCorners(new Vec3i(sx, 0, sz), new Vec3i(ex, 255, ez));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static StructureTemplate readStructure(ResourceLocation resource) {
|
protected static StructureTemplate readStructure(ResourceLocation resource) {
|
||||||
|
|
|
@ -35,12 +35,6 @@ public class DoubleBlockSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBase
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(Random random, ChunkAccess chunk, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int seaLevel, long seed, SurfaceBuilderBaseConfiguration surfaceBlocks) {
|
|
||||||
noise = NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4, 0.4, random);
|
|
||||||
SurfaceBuilder.DEFAULT.apply(random, chunk, biome, x, z, height, noise, defaultBlock, defaultFluid, seaLevel, seed, noise > 0 ? config1 : config2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DoubleBlockSurfaceBuilder register(String name) {
|
public static DoubleBlockSurfaceBuilder register(String name) {
|
||||||
return Registry.register(Registry.SURFACE_BUILDER, name, new DoubleBlockSurfaceBuilder());
|
return Registry.register(Registry.SURFACE_BUILDER, name, new DoubleBlockSurfaceBuilder());
|
||||||
}
|
}
|
||||||
|
@ -49,4 +43,10 @@ public class DoubleBlockSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBase
|
||||||
BlockState stone = Blocks.END_STONE.defaultBlockState();
|
BlockState stone = Blocks.END_STONE.defaultBlockState();
|
||||||
return this.configured(new SurfaceBuilderBaseConfiguration(config1.getTopMaterial(), stone, stone));
|
return this.configured(new SurfaceBuilderBaseConfiguration(config1.getTopMaterial(), stone, stone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(Random random, ChunkAccess chunkAccess, Biome biome, int x, int z, int height, double noise, BlockState defaultBlock, BlockState defaultFluid, int l, int m, long seed, SurfaceBuilderBaseConfiguration surfaceBuilderConfiguration) {
|
||||||
|
noise = NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4, 0.4, random);
|
||||||
|
SurfaceBuilder.DEFAULT.apply(random, chunkAccess, biome, x, z, height, noise, defaultBlock, defaultFluid, l, m, seed, noise > 0 ? config1 : config2);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue