Fixes fallout selection (#4429)

This commit is contained in:
yueh
2020-06-22 23:09:15 +02:00
committed by GitHub
parent cb62d3a706
commit 3e56311f2f
5 changed files with 31 additions and 9 deletions
@@ -16,7 +16,6 @@ import net.minecraft.world.storage.WorldSavedData;
import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraftforge.fml.server.ServerLifecycleHooks;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
/** /**
* This is per-world data to track where Meteorites have been spawned. * This is per-world data to track where Meteorites have been spawned.
@@ -22,7 +22,6 @@ import javax.annotation.Nullable;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@@ -47,15 +46,16 @@ public class MeteoriteSpawner {
"meteorite/invalid_spawn"); "meteorite/invalid_spawn");
private final Tag<Block> validSpawnTag; private final Tag<Block> validSpawnTag;
private final Tag<Block> invalidSpawnTag; private final Tag<Block> invalidSpawnTag;
private final Tag<Block> sandTag; private final Tag<Block> sandTag;
private final Tag<Block> terracottaTag;
public MeteoriteSpawner() { public MeteoriteSpawner() {
this.validSpawnTag = BlockTags.getCollection().getOrCreate(TAG_VALID_SPAWN); this.validSpawnTag = BlockTags.getCollection().getOrCreate(TAG_VALID_SPAWN);
this.invalidSpawnTag = BlockTags.getCollection().getOrCreate(TAG_INVALID_SPAWN); this.invalidSpawnTag = BlockTags.getCollection().getOrCreate(TAG_INVALID_SPAWN);
this.sandTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("minecraft:sand")); this.sandTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("minecraft:sand"));
this.terracottaTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("forge:terracotta"));
} }
public PlacedMeteoriteSettings trySpawnMeteoriteAtSuitableHeight(IWorldReader world, BlockPos startPos, public PlacedMeteoriteSettings trySpawnMeteoriteAtSuitableHeight(IWorldReader world, BlockPos startPos,
@@ -184,12 +184,14 @@ public class MeteoriteSpawner {
} }
private FalloutMode getFalloutFromBaseBlock(BlockState blockState) { private FalloutMode getFalloutFromBaseBlock(BlockState blockState) {
if (blockState.getBlock().isIn(sandTag)) { final Block block = blockState.getBlock();
if (block.isIn(sandTag)) {
return FalloutMode.SAND; return FalloutMode.SAND;
} else if (blockState.getBlock() == Blocks.TERRACOTTA) { } else if (block.isIn(terracottaTag)) {
return FalloutMode.TERRACOTTA; return FalloutMode.TERRACOTTA;
} else if (blockState.getMaterial() == Material.SNOW || blockState.getMaterial() == Material.SNOW_BLOCK } else if (block == Blocks.SNOW || block == Blocks.SNOW || block == Blocks.SNOW_BLOCK || block == Blocks.ICE
|| blockState.getMaterial() == Material.ICE || blockState.getMaterial() == Material.PACKED_ICE) { || block == Blocks.PACKED_ICE) {
return FalloutMode.ICE_SNOW; return FalloutMode.ICE_SNOW;
} else { } else {
return FalloutMode.DEFAULT; return FalloutMode.DEFAULT;
@@ -23,7 +23,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import appeng.util.Platform;
import appeng.worldgen.meteorite.MeteoriteBlockPutter; import appeng.worldgen.meteorite.MeteoriteBlockPutter;
public class Fallout { public class Fallout {
@@ -36,7 +36,7 @@ public class FalloutCopy extends Fallout {
public FalloutCopy(final IWorld w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) { public FalloutCopy(final IWorld w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) {
super(putter, skyStone); super(putter, skyStone);
this.putter = putter; this.putter = putter;
this.block = w.getBlockState(pos); this.block = w.getBiome(pos).getSurfaceBuilderConfig().getTop();
} }
@Override @Override
@@ -0,0 +1,22 @@
{
"replace": false,
"values": [
"minecraft:terracotta",
"minecraft:white_terracotta",
"minecraft:orange_terracotta",
"minecraft:magenta_terracotta",
"minecraft:light_blue_terracotta",
"minecraft:yellow_terracotta",
"minecraft:lime_terracotta",
"minecraft:pink_terracotta",
"minecraft:gray_terracotta",
"minecraft:light_gray_terracotta",
"minecraft:cyan_terracotta",
"minecraft:purple_terracotta",
"minecraft:blue_terracotta",
"minecraft:brown_terracotta",
"minecraft:green_terracotta",
"minecraft:red_terracotta",
"minecraft:black_terracotta"
]
}