Some feature pieces fixes, changed API calls
This commit is contained in:
parent
6a6f29bf99
commit
64de980cab
12 changed files with 37 additions and 28 deletions
|
@ -1,9 +1,11 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.levelgen.feature.StructurePieceType;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.StructurePiece;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
|
||||
public abstract class BasePiece extends StructurePiece {
|
||||
protected BasePiece(StructurePieceType type, int i, BoundingBox boundingBox) {
|
||||
|
@ -16,4 +18,11 @@ public abstract class BasePiece extends StructurePiece {
|
|||
}
|
||||
|
||||
protected abstract void fromNbt(CompoundTag tag);
|
||||
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag) {
|
||||
addAdditionalSaveData(compoundTag);
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ public class CavePiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int x1 = MHelper.max(this.boundingBox.minX(), blockBox.minX());
|
||||
int z1 = MHelper.max(this.boundingBox.minZ(), blockBox.minZ());
|
||||
int x2 = MHelper.min(this.boundingBox.maxX(), blockBox.maxX());
|
||||
|
@ -79,11 +79,11 @@ public class CavePiece extends BasePiece {
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
tag.put("center", NbtUtils.writeBlockPos(center));
|
||||
tag.putFloat("radius", radius);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -63,7 +63,7 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
tag.put("center", NbtUtils.writeBlockPos(center));
|
||||
tag.putFloat("radius", radius);
|
||||
tag.putFloat("depth", depth);
|
||||
|
@ -83,7 +83,7 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
int minY = this.boundingBox.minY();
|
||||
int maxY = this.boundingBox.maxY();
|
||||
int sx = SectionPos.sectionToBlockCoord(chunkPos.x);
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.level.biome.Biome;
|
|||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.StructurePieceType;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
tag.put("center", NbtUtils.writeBlockPos(center));
|
||||
tag.putFloat("radius", radius);
|
||||
tag.putFloat("height", height);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class VoxelPiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
tag.put("world", world.toBNT());
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,7 @@ public class VoxelPiece extends BasePiece {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public void postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
this.world.placeChunk(world, chunkPos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue