Fixed all remaining compile errors (mind the TODOs, a lot of things are disabled)
This commit is contained in:
parent
108d2bd710
commit
6c89c76c26
34 changed files with 241 additions and 430 deletions
|
@ -1,24 +1,24 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CavePiece extends BasePiece {
|
||||
private OpenSimplexNoise noise;
|
||||
private BlockPos center;
|
||||
|
@ -32,12 +32,13 @@ public class CavePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public CavePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
public CavePiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.CAVE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
|
||||
@Override
|
||||
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());
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -17,34 +19,32 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
|||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
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;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CrystalMountainPiece extends MountainPiece {
|
||||
private BlockState top;
|
||||
|
||||
public CrystalMountainPiece(BlockPos center, float radius, float height, Random random, Biome biome) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
||||
top = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
//TODO: 1.18 this needs to change to a dynamic block
|
||||
top = Blocks.END_STONE.defaultBlockState(); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
public CrystalMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, serverLevel, tag);
|
||||
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fromNbt(CompoundTag tag) {
|
||||
super.fromNbt(tag);
|
||||
top = BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
super.fromNbt(tag);//TODO: 1.18 this needs to change to a dynamic block
|
||||
top = Blocks.END_STONE.defaultBlockState(); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
@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 sx = chunkPos.getMinBlockX();
|
||||
int sz = chunkPos.getMinBlockZ();
|
||||
MutableBlockPos pos = new MutableBlockPos();
|
||||
|
@ -139,8 +139,6 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void crystal(ChunkAccess chunk, BlockPos pos, int radius, int height, float fill, Random random) {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -8,7 +12,6 @@ import net.minecraft.core.SectionPos;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
|
@ -20,18 +23,16 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
|||
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.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class LakePiece extends BasePiece {
|
||||
private static final BlockState ENDSTONE = Blocks.END_STONE.defaultBlockState();
|
||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
@ -57,7 +58,7 @@ public class LakePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public LakePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
public LakePiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.LAKE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
@ -131,10 +132,12 @@ public class LakePiece extends BasePiece {
|
|||
)) {
|
||||
state = chunk.getBlockState(mut.above());
|
||||
if (state.isAir()) {
|
||||
state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
|
||||
.getGenerationSettings()
|
||||
.getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
//TODO: 1.18 this needs to change to a dynamic block
|
||||
state = ENDSTONE;
|
||||
// state = random.nextBoolean() ? ENDSTONE : world.getBiome(worldPos)
|
||||
// .getGenerationSettings()
|
||||
// .getSurfaceBuilderConfig()
|
||||
// .getTopMaterial();
|
||||
}
|
||||
else {
|
||||
state = state.getFluidState()
|
||||
|
@ -147,7 +150,6 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
}
|
||||
fixWater(world, chunk, mut, random, sx, sz);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void fixWater(WorldGenLevel world, ChunkAccess chunk, MutableBlockPos mut, Random random, int sx, int sz) {
|
||||
|
@ -167,10 +169,12 @@ public class LakePiece extends BasePiece {
|
|||
|
||||
BlockState bState = chunk.getBlockState(mut);
|
||||
if (bState.isAir()) {
|
||||
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||
.getGenerationSettings()
|
||||
.getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
//TODO: 1.18 this needs to change to a dynamic block
|
||||
bState = ENDSTONE;
|
||||
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||
// .getGenerationSettings()
|
||||
// .getSurfaceBuilderConfig()
|
||||
// .getTopMaterial();
|
||||
}
|
||||
else {
|
||||
bState = bState.getFluidState()
|
||||
|
@ -189,10 +193,12 @@ public class LakePiece extends BasePiece {
|
|||
mut.setY(y + 1);
|
||||
BlockState bState = chunk.getBlockState(mut);
|
||||
if (bState.isAir()) {
|
||||
bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||
.getGenerationSettings()
|
||||
.getSurfaceBuilderConfig()
|
||||
.getTopMaterial();
|
||||
//TODO: 1.18 this needs to change to a dynamic block
|
||||
bState = ENDSTONE;
|
||||
// bState = random.nextBoolean() ? ENDSTONE : world.getBiome(mut.offset(sx, 0, sz))
|
||||
// .getGenerationSettings()
|
||||
// .getSurfaceBuilderConfig()
|
||||
// .getTopMaterial();
|
||||
}
|
||||
else {
|
||||
bState = bState.getFluidState()
|
||||
|
@ -205,7 +211,8 @@ public class LakePiece extends BasePiece {
|
|||
}
|
||||
}
|
||||
else if (chunk.getBlockState(mut.move(Direction.UP)).isAir()) {
|
||||
chunk.getLiquidTicks().scheduleTick(mut.move(Direction.DOWN), state.getType(), 0);
|
||||
//TODO: 1.18 test if this is thr right tick
|
||||
/*chunk.getLiquidTicks()*/world.scheduleTick(mut.move(Direction.DOWN), state.getType(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
@ -17,9 +20,6 @@ import ru.bclib.api.biomes.BiomeAPI;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class MountainPiece extends BasePiece {
|
||||
protected Map<Integer, Integer> heightmap = Maps.newHashMap();
|
||||
protected OpenSimplexNoise noise1;
|
||||
|
@ -46,7 +46,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public MountainPiece(StructurePieceType type, ServerLevel serverLevel, CompoundTag tag) {
|
||||
public MountainPiece(StructurePieceType type, CompoundTag tag) {
|
||||
super(type, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -13,14 +14,13 @@ import net.minecraft.world.level.block.Mirror;
|
|||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.util.StructureHelper;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class NBTPiece extends BasePiece {
|
||||
private ResourceLocation structureID;
|
||||
private Rotation rotation;
|
||||
|
@ -42,13 +42,14 @@ public class NBTPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public NBTPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
public NBTPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.NBT_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
tag.putString("structureID", structureID.toString());
|
||||
tag.putInt("rotation", rotation.ordinal());
|
||||
tag.putInt("mirror", mirror.ordinal());
|
||||
|
@ -69,7 +70,7 @@ public class NBTPiece 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) {
|
||||
BoundingBox bounds = BoundingBox.fromCorners(new Vec3i(
|
||||
blockBox.minX(),
|
||||
this.boundingBox.minY(),
|
||||
|
@ -90,7 +91,6 @@ public class NBTPiece extends BasePiece {
|
|||
if (cover) {
|
||||
StructureHelper.cover(world, bounds, random);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void makeBoundingBox() {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -16,11 +17,10 @@ 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 net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PaintedMountainPiece extends MountainPiece {
|
||||
private BlockState[] slises;
|
||||
|
||||
|
@ -29,13 +29,13 @@ public class PaintedMountainPiece extends MountainPiece {
|
|||
this.slises = slises;
|
||||
}
|
||||
|
||||
public PaintedMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, serverLevel, tag);
|
||||
public PaintedMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super.addAdditionalSaveData(serverLevel, tag);
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
ListTag slise = new ListTag();
|
||||
for (BlockState state : slises) {
|
||||
slise.add(NbtUtils.writeBlockState(state));
|
||||
|
@ -54,7 +54,7 @@ public class PaintedMountainPiece extends MountainPiece {
|
|||
}
|
||||
|
||||
@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 sx = chunkPos.getMinBlockX();
|
||||
int sz = chunkPos.getMinBlockZ();
|
||||
MutableBlockPos pos = new MutableBlockPos();
|
||||
|
@ -101,7 +101,5 @@ public class PaintedMountainPiece extends MountainPiece {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package ru.betterend.world.structures.piece;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import ru.bclib.world.structures.StructureWorld;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class VoxelPiece extends BasePiece {
|
||||
private StructureWorld world;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class VoxelPiece extends BasePiece {
|
|||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
||||
public VoxelPiece(ServerLevel level, CompoundTag tag) {
|
||||
public VoxelPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||
super(EndStructures.VOXEL_PIECE, tag);
|
||||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue