Added spotless back and reformatted
This commit is contained in:
@@ -2,6 +2,7 @@ package appeng.worldgen;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
@@ -11,10 +12,10 @@ import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
*/
|
||||
public class ChargedQuartzOreConfig implements FeatureConfig {
|
||||
|
||||
public static final Codec<ChargedQuartzOreConfig> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
|
||||
BlockState.CODEC.fieldOf("target").forGetter((config) -> config.target),
|
||||
BlockState.CODEC.fieldOf("state").forGetter((config) -> config.state),
|
||||
Codec.FLOAT.fieldOf("chance").withDefault(0f).forGetter((config) -> config.chance))
|
||||
public static final Codec<ChargedQuartzOreConfig> CODEC = RecordCodecBuilder.create((instance) -> instance
|
||||
.group(BlockState.CODEC.fieldOf("target").forGetter((config) -> config.target),
|
||||
BlockState.CODEC.fieldOf("state").forGetter((config) -> config.state),
|
||||
Codec.FLOAT.fieldOf("chance").withDefault(0f).forGetter((config) -> config.chance))
|
||||
.apply(instance, ChargedQuartzOreConfig::new));
|
||||
|
||||
public final BlockState target;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package appeng.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
@@ -10,12 +14,10 @@ import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Extends {@link net.minecraft.world.gen.feature.OreFeature} by also allowing for a replacement
|
||||
* chance. In addition, the feature will check every block in the chunk.
|
||||
* Extends {@link net.minecraft.world.gen.feature.OreFeature} by also allowing
|
||||
* for a replacement chance. In addition, the feature will check every block in
|
||||
* the chunk.
|
||||
*/
|
||||
public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
|
||||
|
||||
@@ -26,12 +28,8 @@ public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(ServerWorldAccess worldIn,
|
||||
net.minecraft.world.gen.StructureAccessor structureAccessor,
|
||||
ChunkGenerator generator,
|
||||
Random rand,
|
||||
BlockPos pos,
|
||||
ChargedQuartzOreConfig config) {
|
||||
public boolean generate(ServerWorldAccess worldIn, net.minecraft.world.gen.StructureAccessor structureAccessor,
|
||||
ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
|
||||
BlockPos.Mutable bpos = new BlockPos.Mutable();
|
||||
|
||||
@@ -21,12 +21,6 @@ package appeng.worldgen.meteorite;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
import alexiil.mc.lib.attributes.AttributeUtil;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
import appeng.tile.storage.SkyChestBlockEntity;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -35,12 +29,17 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
import alexiil.mc.lib.attributes.AttributeUtil;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
@@ -48,8 +47,10 @@ import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.tile.storage.SkyChestBlockEntity;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorFixedInv;
|
||||
import appeng.worldgen.meteorite.fallout.Fallout;
|
||||
import appeng.worldgen.meteorite.fallout.FalloutCopy;
|
||||
import appeng.worldgen.meteorite.fallout.FalloutMode;
|
||||
@@ -192,7 +193,8 @@ public final class MeteoritePlacer {
|
||||
}
|
||||
}
|
||||
|
||||
for (final Object o : world.getEntities(ItemEntity.class, new Box(minX(x - 30), y - 5, minZ(z - 30), maxX(x + 30), y + 30, maxZ(z + 30)), null)) {
|
||||
for (final Object o : world.getEntities(ItemEntity.class,
|
||||
new Box(minX(x - 30), y - 5, minZ(z - 30), maxX(x + 30), y + 30, maxZ(z + 30)), null)) {
|
||||
final Entity e = (Entity) o;
|
||||
e.remove();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package appeng.worldgen.meteorite;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -11,18 +11,22 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class MeteoriteStructure extends StructureFeature<DefaultFeatureConfig> {
|
||||
|
||||
public static final Identifier ID = AppEng.makeId("meteorite");
|
||||
|
||||
public static final StructureFeature<DefaultFeatureConfig> INSTANCE = new MeteoriteStructure(DefaultFeatureConfig.CODEC);
|
||||
public static final StructureFeature<DefaultFeatureConfig> INSTANCE = new MeteoriteStructure(
|
||||
DefaultFeatureConfig.CODEC);
|
||||
|
||||
public MeteoriteStructure(Codec<DefaultFeatureConfig> configCodec) {
|
||||
super(configCodec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStartAt(ChunkGenerator generator, BiomeSource biomeSource, long seed, ChunkRandom randIn, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos2, DefaultFeatureConfig featureConfig) {
|
||||
public boolean shouldStartAt(ChunkGenerator generator, BiomeSource biomeSource, long seed, ChunkRandom randIn,
|
||||
int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos2, DefaultFeatureConfig featureConfig) {
|
||||
return randIn.nextBoolean();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,23 +20,22 @@ package appeng.worldgen.meteorite;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.structure.StructureManager;
|
||||
import net.minecraft.structure.StructurePiece;
|
||||
import net.minecraft.structure.StructurePieceType;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.structure.StructureManager;
|
||||
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.worldgen.meteorite.fallout.FalloutMode;
|
||||
|
||||
public class MeteoriteStructurePiece extends StructurePiece {
|
||||
|
||||
public static final StructurePieceType TYPE = StructurePieceType.register(MeteoriteStructurePiece::new,
|
||||
"AE2MTRT");
|
||||
public static final StructurePieceType TYPE = StructurePieceType.register(MeteoriteStructurePiece::new, "AE2MTRT");
|
||||
|
||||
private final PlacedMeteoriteSettings settings;
|
||||
|
||||
@@ -50,8 +49,8 @@ public class MeteoriteStructurePiece extends StructurePiece {
|
||||
int range = 4 * 16;
|
||||
|
||||
ChunkPos chunkPos = new ChunkPos(center);
|
||||
this.boundingBox = new BlockBox(chunkPos.getStartX() - range, center.getY(),
|
||||
chunkPos.getStartZ() - range, chunkPos.getEndX() + range, center.getY(), chunkPos.getEndZ() + range);
|
||||
this.boundingBox = new BlockBox(chunkPos.getStartX() - range, center.getY(), chunkPos.getStartZ() - range,
|
||||
chunkPos.getEndX() + range, center.getY(), chunkPos.getEndZ() + range);
|
||||
}
|
||||
|
||||
public MeteoriteStructurePiece(StructureManager templateManager, CompoundTag tag) {
|
||||
@@ -86,11 +85,13 @@ public class MeteoriteStructurePiece extends StructurePiece {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(ServerWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox bounds, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
public boolean generate(ServerWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockBox bounds, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
MeteoritePlacer placer = new MeteoritePlacer(world, settings, bounds);
|
||||
placer.place();
|
||||
|
||||
WorldData.instance().compassData().service().tryUpdateArea(world, chunkPos); // FIXME: We know the y-range here...
|
||||
WorldData.instance().compassData().service().tryUpdateArea(world, chunkPos); // FIXME: We know the y-range
|
||||
// here...
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,20 @@ import com.google.common.math.StatsAccumulator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.structure.StructureManager;
|
||||
import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.Category;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.structure.StructureManager;
|
||||
|
||||
import appeng.worldgen.meteorite.fallout.FalloutMode;
|
||||
|
||||
@@ -30,13 +30,14 @@ public class MeteoriteStructureStart extends StructureStart<DefaultFeatureConfig
|
||||
private final Tag<Block> terracottaTag = BlockTags.getContainer()
|
||||
.getOrCreate(new Identifier("c:terracotta_blocks"));
|
||||
|
||||
public MeteoriteStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box, int references, long seed) {
|
||||
public MeteoriteStructureStart(StructureFeature<DefaultFeatureConfig> feature, int chunkX, int chunkZ, BlockBox box,
|
||||
int references, long seed) {
|
||||
super(feature, chunkX, chunkZ, box, references, seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ChunkGenerator generator, StructureManager templateManagerIn, int chunkX, int chunkZ,
|
||||
Biome biome, DefaultFeatureConfig config) {
|
||||
public void init(ChunkGenerator generator, StructureManager templateManagerIn, int chunkX, int chunkZ, Biome biome,
|
||||
DefaultFeatureConfig config) {
|
||||
final int centerX = chunkX * 16 + this.random.nextInt(16);
|
||||
final int centerZ = chunkZ * 16 + this.random.nextInt(16);
|
||||
final float meteoriteRadius = (this.random.nextFloat() * 6.0f) + 2;
|
||||
|
||||
@@ -20,8 +20,8 @@ package appeng.worldgen.meteorite.debug;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
import appeng.worldgen.meteorite.CraterType;
|
||||
|
||||
@@ -33,7 +33,8 @@ public class FalloutCopy extends Fallout {
|
||||
private final BlockState block;
|
||||
private final MeteoriteBlockPutter putter;
|
||||
|
||||
public FalloutCopy(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) {
|
||||
public FalloutCopy(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter,
|
||||
final BlockState skyStone) {
|
||||
super(putter, skyStone);
|
||||
this.putter = putter;
|
||||
this.block = w.getBiome(pos).getSurfaceConfig().getTopMaterial();
|
||||
|
||||
@@ -29,7 +29,8 @@ public class FalloutSand extends FalloutCopy {
|
||||
private static final double GLASS_THRESHOLD = 0.66;
|
||||
private final MeteoriteBlockPutter putter;
|
||||
|
||||
public FalloutSand(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) {
|
||||
public FalloutSand(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter,
|
||||
final BlockState skyStone) {
|
||||
super(w, pos, putter, skyStone);
|
||||
this.putter = putter;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ public class FalloutSnow extends FalloutCopy {
|
||||
private static final double ICE_THRESHOLD = 0.5;
|
||||
private final MeteoriteBlockPutter putter;
|
||||
|
||||
public FalloutSnow(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) {
|
||||
public FalloutSnow(final WorldAccess w, BlockPos pos, final MeteoriteBlockPutter putter,
|
||||
final BlockState skyStone) {
|
||||
super(w, pos, putter, skyStone);
|
||||
this.putter = putter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user