1.16 port

This commit is contained in:
yueh
2020-07-22 16:44:42 +02:00
parent 662dbca3e1
commit 56ecda5173
225 changed files with 1214 additions and 969 deletions
@@ -1,8 +1,8 @@
package appeng.worldgen;
import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.Dynamic;
import com.mojang.datafixers.types.DynamicOps;
import com.mojang.serialization.Dynamic;
import com.mojang.serialization.DynamicOps;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@@ -1,19 +1,18 @@
package appeng.worldgen;
import java.util.Random;
import java.util.function.Function;
import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.ISeedReader;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.GenerationSettings;
import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.ReplaceBlockFeature;
import net.minecraft.world.gen.feature.structure.StructureManager;
import appeng.core.AppEng;
@@ -30,12 +29,12 @@ public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
INSTANCE.setRegistryName(AppEng.MOD_ID, "charged_quartz_ore");
}
public ChargedQuartzOreFeature(Function<Dynamic<?>, ? extends ChargedQuartzOreConfig> p_i51444_1_) {
public ChargedQuartzOreFeature(Codec<ChargedQuartzOreConfig> p_i51444_1_) {
super(p_i51444_1_);
}
@Override
public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random rand,
public boolean func_230362_a_(ISeedReader worldIn, StructureManager sm, ChunkGenerator generator, Random rand,
BlockPos pos, ChargedQuartzOreConfig config) {
ChunkPos chunkPos = new ChunkPos(pos);
@@ -1,38 +1,34 @@
package appeng.worldgen.meteorite;
import java.util.Random;
import java.util.function.Function;
import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeManager;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.EndChunkGenerator;
import net.minecraft.world.gen.NetherChunkGenerator;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.structure.ScatteredStructure;
import net.minecraft.world.gen.feature.structure.Structure;
import appeng.core.AELog;
import appeng.core.AppEng;
public class MeteoriteStructure extends ScatteredStructure<NoFeatureConfig> {
public class MeteoriteStructure extends Structure<NoFeatureConfig> {
public static final Structure<NoFeatureConfig> INSTANCE = new MeteoriteStructure(NoFeatureConfig::deserialize);
public static final Structure<NoFeatureConfig> INSTANCE = new MeteoriteStructure(NoFeatureConfig.field_236558_a_);
static {
INSTANCE.setRegistryName(AppEng.MOD_ID, "meteorite");
}
public MeteoriteStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn) {
super(configFactoryIn);
public MeteoriteStructure(Codec<NoFeatureConfig> p_i231997_1_) {
super(p_i231997_1_);
}
@Override
public boolean canBeGenerated(BiomeManager biomeManagerIn, ChunkGenerator<?> generator, Random randIn, int chunkX,
public boolean func_230363_a_(BiomeManager biomeManagerIn, ChunkGenerator generator, Random randIn, int chunkX,
int chunkZ, Biome biomeIn) {
if (super.canBeGenerated(biomeManagerIn, generator, randIn, chunkX, chunkZ, biomeIn)) {
if (super.func_230363_a_(biomeManagerIn, generator, randIn, chunkX, chunkZ, biomeIn)) {
// In case the biome blacklist fails, we still double-check here that we're not
// generating chunks for
// the nether or end.
@@ -8,7 +8,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.ITag;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MutableBoundingBox;
@@ -26,8 +26,8 @@ import appeng.worldgen.meteorite.fallout.FalloutMode;
public class MeteoriteStructureStart extends StructureStart {
private final Tag<Block> sandTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("minecraft:sand"));
private final Tag<Block> terracottaTag = BlockTags.getCollection()
private final ITag<Block> sandTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("minecraft:sand"));
private final ITag<Block> terracottaTag = BlockTags.getCollection()
.getOrCreate(new ResourceLocation("forge:terracotta"));
public MeteoriteStructureStart(Structure<?> p_i225815_1_, int p_i225815_2_, int p_i225815_3_,
@@ -87,7 +87,7 @@ public class MeteoriteStructureStart extends StructureStart {
*
* @return true, if it found a single block of water
*/
private boolean locateWaterAroundTheCrater(ChunkGenerator<?> generator, BlockPos pos, float radius) {
private boolean locateWaterAroundTheCrater(ChunkGenerator generator, BlockPos pos, float radius) {
final int seaLevel = generator.getSeaLevel();
final int maxY = seaLevel - 1;
BlockPos.Mutable blockPos = new BlockPos.Mutable();
@@ -39,7 +39,7 @@ public class MeteoriteSpawner {
float coreRadius, CraterType craterType, boolean pureCrater, boolean worldGen) {
int stepSize = Math.min(5, (int) Math.ceil(coreRadius) + 1);
int minY = 10 + stepSize;
BlockPos.Mutable mutablePos = new BlockPos.Mutable(startPos);
BlockPos.Mutable mutablePos = new BlockPos.Mutable(startPos.getX(), startPos.getY(), startPos.getZ());
mutablePos.move(Direction.DOWN, stepSize);
@@ -80,7 +80,7 @@ public class MeteoriteSpawner {
}
private static boolean isAirBelowSpawnPoint(IWorldReader w, BlockPos pos) {
BlockPos.Mutable testPos = new BlockPos.Mutable(pos);
BlockPos.Mutable testPos = new BlockPos.Mutable(pos.getX(), pos.getY(), pos.getZ());
for (int j = pos.getY() - 15; j < pos.getY() - 1; j++) {
testPos.setY(j);
if (w.isAirBlock(testPos)) {