diff --git a/src/main/java/ganymedes01/etfuturum/EtFuturum.java b/src/main/java/ganymedes01/etfuturum/EtFuturum.java index d4769248f..9e4730091 100644 --- a/src/main/java/ganymedes01/etfuturum/EtFuturum.java +++ b/src/main/java/ganymedes01/etfuturum/EtFuturum.java @@ -307,6 +307,10 @@ else if(block == Blocks.quartz_ore || (namespace.contains("nether") && (block in return ModSounds.soundNetherOre; } + else if(namespace.contains("deepslate")) { + return namespace.contains("brick") ? ModSounds.soundDeepslateBricks : ModSounds.soundDeepslate; + } + else if(block instanceof BlockNetherWart || (namespace.contains("nether") && namespace.contains("wart"))) { return ModSounds.soundCropWarts; } diff --git a/src/main/java/ganymedes01/etfuturum/blocks/BlockDeepslate.java b/src/main/java/ganymedes01/etfuturum/blocks/BlockDeepslate.java index 132ea727c..0b575a27b 100644 --- a/src/main/java/ganymedes01/etfuturum/blocks/BlockDeepslate.java +++ b/src/main/java/ganymedes01/etfuturum/blocks/BlockDeepslate.java @@ -1,6 +1,5 @@ package ganymedes01.etfuturum.blocks; -import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -13,7 +12,7 @@ import ganymedes01.etfuturum.configuration.configs.ConfigWorld; import ganymedes01.etfuturum.core.utils.Utils; import ganymedes01.etfuturum.entities.ai.BlockPos; -import ganymedes01.etfuturum.world.EtFuturumChunkPopulateGenerator; +import ganymedes01.etfuturum.world.EtFuturumLateWorldGenerator; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; @@ -75,12 +74,10 @@ public boolean isReplaceableOreGen(World world, int x, int y, int z, Block targe return flag; } - private static List tempcache = new ArrayList(); - public static void doDeepslateRedoCheck(World world, int x, int y, int z) { - if(!EtFuturumChunkPopulateGenerator.INSTANCE.stopRecording && world.checkChunksExist(x, 0, z, x, 0, z) && world.getChunkFromBlockCoords(x, z).lastSaveTime == 0) { + if(!EtFuturumLateWorldGenerator.stopRecording && world.checkChunksExist(x, 0, z, x, 0, z) && world.getChunkFromBlockCoords(x, z).lastSaveTime == 0) { BlockPos pos = new BlockPos(x, y, z); - List redo = EtFuturumChunkPopulateGenerator.INSTANCE.getRedoList(world.provider.dimensionId); + List redo = EtFuturumLateWorldGenerator.getRedoList(world.provider.dimensionId); if(!redo.contains(pos)) { redo.add(pos); } diff --git a/src/main/java/ganymedes01/etfuturum/core/handlers/ServerEventHandler.java b/src/main/java/ganymedes01/etfuturum/core/handlers/ServerEventHandler.java index 56da21752..b47b3feae 100644 --- a/src/main/java/ganymedes01/etfuturum/core/handlers/ServerEventHandler.java +++ b/src/main/java/ganymedes01/etfuturum/core/handlers/ServerEventHandler.java @@ -47,7 +47,7 @@ import ganymedes01.etfuturum.network.BlackHeartParticlesMessage; import ganymedes01.etfuturum.recipes.ModRecipes; import ganymedes01.etfuturum.tileentities.TileEntityGateway; -import ganymedes01.etfuturum.world.EtFuturumChunkPopulateGenerator; +import ganymedes01.etfuturum.world.EtFuturumLateWorldGenerator; import ganymedes01.etfuturum.world.generate.BlockAndMetadataMapping; import ganymedes01.etfuturum.world.generate.RawOreDropMapping; import net.minecraft.block.Block; @@ -1123,11 +1123,6 @@ public void onDrops(BlockEvent.HarvestDropsEvent event) { } } - @SubscribeEvent - public void onUnload(WorldEvent.Unload event) { - EtFuturumChunkPopulateGenerator.INSTANCE.clearRedos(); - } - // UNUSED FUNCTIONS //private boolean playerHasItem(final EntityPlayer player, final ItemStack ist, final boolean checkEnabled) { // for (int slot = 0; slot < player.inventory.mainInventory.length; ++slot) { diff --git a/src/main/java/ganymedes01/etfuturum/core/proxy/CommonProxy.java b/src/main/java/ganymedes01/etfuturum/core/proxy/CommonProxy.java index b424b1118..903bfad0c 100644 --- a/src/main/java/ganymedes01/etfuturum/core/proxy/CommonProxy.java +++ b/src/main/java/ganymedes01/etfuturum/core/proxy/CommonProxy.java @@ -8,7 +8,6 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import ganymedes01.etfuturum.EtFuturum; -import ganymedes01.etfuturum.EtFuturumMixinPlugin; import ganymedes01.etfuturum.client.gui.inventory.GuiAnvil; import ganymedes01.etfuturum.client.gui.inventory.GuiBlastFurnace; import ganymedes01.etfuturum.client.gui.inventory.GuiEnchantment; @@ -18,7 +17,6 @@ import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems; import ganymedes01.etfuturum.configuration.configs.ConfigEntities; import ganymedes01.etfuturum.configuration.configs.ConfigTweaks; -import ganymedes01.etfuturum.core.handlers.ClientEventHandler; import ganymedes01.etfuturum.core.handlers.ServerEventHandler; import ganymedes01.etfuturum.core.handlers.WorldEventHandler; import ganymedes01.etfuturum.core.utils.Utils; @@ -57,7 +55,6 @@ import ganymedes01.etfuturum.tileentities.TileEntityShulkerBox; import ganymedes01.etfuturum.tileentities.TileEntitySmoker; import ganymedes01.etfuturum.tileentities.TileEntityWoodSign; -import ganymedes01.etfuturum.world.EtFuturumChunkPopulateGenerator; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.monster.EntityEnderman; @@ -82,9 +79,6 @@ public void registerEvents() { MinecraftForge.EVENT_BUS.register(ServerEventHandler.INSTANCE); FMLCommonHandler.instance().bus().register(WorldEventHandler.INSTANCE); - - MinecraftForge.ORE_GEN_BUS.register(EtFuturumChunkPopulateGenerator.INSTANCE); - MinecraftForge.EVENT_BUS.register(EtFuturumChunkPopulateGenerator.INSTANCE); } public void registerEntities() { diff --git a/src/main/java/ganymedes01/etfuturum/world/EtFuturumChunkPopulateGenerator.java b/src/main/java/ganymedes01/etfuturum/world/EtFuturumChunkPopulateGenerator.java deleted file mode 100644 index 4904bffe5..000000000 --- a/src/main/java/ganymedes01/etfuturum/world/EtFuturumChunkPopulateGenerator.java +++ /dev/null @@ -1,128 +0,0 @@ -package ganymedes01.etfuturum.world; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.ArrayUtils; - -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import ganymedes01.etfuturum.ModBlocks; -import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems; -import ganymedes01.etfuturum.configuration.configs.ConfigTweaks; -import ganymedes01.etfuturum.configuration.configs.ConfigWorld; -import ganymedes01.etfuturum.core.utils.DeepslateOreRegistry; -import ganymedes01.etfuturum.entities.ai.BlockPos; -import ganymedes01.etfuturum.world.generate.BlockAndMetadataMapping; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.world.WorldType; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent; - -public class EtFuturumChunkPopulateGenerator { - - public static final EtFuturumChunkPopulateGenerator INSTANCE = new EtFuturumChunkPopulateGenerator(); - - private void doDeepslateGen(Chunk chunk) { - - Block block; - - int worldX; - int worldZ; - final int chunkMultiplier = chunk.xPosition * 16; - - for (int y = 0; y <= ConfigWorld.deepslateMaxY; y++) { - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - if(y < ConfigWorld.deepslateMaxY - 4 || y <= ConfigWorld.deepslateMaxY - chunk.worldObj.rand.nextInt(4)) { - - block = chunk.getBlock(x, y, z); - - worldX = x + chunkMultiplier; - worldZ = z + chunkMultiplier; - - this.replaceBlockInChunk(chunk, block, x, z, worldX, y, worldZ); - } - } - } - } - } - - private void replaceBlockInChunk(Chunk chunk, int x, int z, int worldX, int worldY, int worldZ) { - this.replaceBlockInChunk(chunk, chunk.getBlock(x, worldY, z), x, z, worldX, worldY, worldZ); - } - - private void replaceBlockInChunk(Chunk chunk, Block block, int x, int z, int worldX, int worldY, int worldZ) { - if(block.getMaterial() != Material.air || block != ModBlocks.deepslate || block != ModBlocks.tuff || block != ModBlocks.cobbled_deepslate) { - if((!ConfigWorld.deepslateReplacesStones && block != ModBlocks.stone) || - block.isReplaceableOreGen(chunk.worldObj, worldX, worldY, worldZ, Blocks.stone) - || (ConfigWorld.deepslateReplacesDirt && block == Blocks.dirt)) { - chunk.func_150807_a(x, worldY, z, ModBlocks.deepslate, 0); - } else if(ConfigTweaks.deepslateReplacesCobblestone && block.isReplaceableOreGen(chunk.worldObj, worldX, worldY, worldZ, Blocks.cobblestone)) { - chunk.func_150807_a(x, worldY, z, ModBlocks.cobbled_deepslate, 0); - } else if(!DeepslateOreRegistry.getOreMap().isEmpty()) { - BlockAndMetadataMapping mapping; - if((mapping = DeepslateOreRegistry.getOre(block, chunk.getBlockMetadata(x, worldY, z))) != null) { - chunk.func_150807_a(x, worldY, z, mapping.getBlock(), mapping.getMeta()); - } - } - } - } - - private final Map> redos = new HashMap>(); - public boolean stopRecording; - - public void clearRedos() { - redos.clear(); - } - - public List getRedoList(int dim) { - if(redos.get(dim) == null) { - redos.put(dim, new ArrayList()); - } - return redos.get(dim); - } - - private boolean doesChunkSupportDeepslate(WorldType terrain, int dimId) { - if(ConfigBlocksItems.enableDeepslate) { - if (ConfigWorld.deepslateGenerationMode == 0 && ConfigWorld.deepslateMaxY > 0) { - if(terrain != WorldType.FLAT && !ArrayUtils.contains(ConfigWorld.deepslateLayerDimensionBlacklist, dimId)) { - return true; - } - } - } - return false; - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void populatedChunk(DecorateBiomeEvent.Post event) { - //Because the variables are misnamed and these are world coords, not chunk coords... - if(doesChunkSupportDeepslate(event.world.getWorldInfo().getTerrainType(), event.world.provider.dimensionId)) { - Chunk chunk = event.world.getChunkFromBlockCoords(event.chunkX, event.chunkZ); - doDeepslateGen(chunk); - final List redo = getRedoList(event.world.provider.dimensionId); - if(!redo.isEmpty()) { - //Turn off recording here so the world gen isn't an infinite recursion loop of constantly checking the same blocks - stopRecording = true; - Chunk newChunk = null; - //Iterate this way to avoid ConcurrentModificationException - for(int i = 0; i < redo.size(); i++) { - BlockPos pos = redo.get(i); - int chunkX = pos.getX() >> 4; - int chunkZ = pos.getZ() >> 4; - if(newChunk == null || newChunk.xPosition != chunkX || newChunk.zPosition != chunkZ) { - newChunk = event.world.getChunkFromChunkCoords(chunkX, chunkZ); - } - this.replaceBlockInChunk(newChunk, pos.getX() & 15, pos.getZ() & 15, pos.getX(), pos.getY(), pos.getZ()); - } - redo.clear(); - } - stopRecording = false; - } - } -} diff --git a/src/main/java/ganymedes01/etfuturum/world/EtFuturumLateWorldGenerator.java b/src/main/java/ganymedes01/etfuturum/world/EtFuturumLateWorldGenerator.java index bd9b2dd49..f7aee3df9 100644 --- a/src/main/java/ganymedes01/etfuturum/world/EtFuturumLateWorldGenerator.java +++ b/src/main/java/ganymedes01/etfuturum/world/EtFuturumLateWorldGenerator.java @@ -1,19 +1,35 @@ package ganymedes01.etfuturum.world; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Random; +import org.apache.commons.lang3.ArrayUtils; + import ganymedes01.etfuturum.ModBlocks; import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems; +import ganymedes01.etfuturum.configuration.configs.ConfigTweaks; import ganymedes01.etfuturum.configuration.configs.ConfigWorld; +import ganymedes01.etfuturum.core.utils.DeepslateOreRegistry; +import ganymedes01.etfuturum.entities.ai.BlockPos; +import ganymedes01.etfuturum.world.generate.BlockAndMetadataMapping; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; public class EtFuturumLateWorldGenerator extends EtFuturumWorldGenerator { @Override public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + int worldX = chunkX * 16; + int worldZ = chunkZ * 16; if (world.getWorldInfo().getTerrainType() != WorldType.FLAT && ConfigBlocksItems.enableCoarseDirt && world.provider.dimensionId != -1 && world.provider.dimensionId != 1) { //TODO Add checks so it doesn't run this code in biomes that don't generate coarse dirt for (int x = chunkX * 16; x < (chunkX * 16) + 16; x++) { @@ -35,5 +51,102 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkPro generateOre(tuffGen, world, rand, chunkX, chunkZ, 1, 6, ConfigWorld.deepslateMaxY); } } + + //Because the variables are misnamed and these are world coords, not chunk coords... + if(doesChunkSupportLayerDeepslate(world.getWorldInfo().getTerrainType(), world.provider.dimensionId)) { + stopRecording = true; + final List redo = getRedoList(world.provider.dimensionId); + if(!redo.isEmpty()) { + //Turn off recording here so the world gen isn't an infinite recursion loop of constantly checking the same blocks + Chunk newChunk = null; + //Iterate this way to avoid ConcurrentModificationException + for(int i = redo.size() - 1; i >= 0; i--) { + BlockPos pos = redo.get(i); + int chunkPosX = pos.getX() >> 4; + int chunkPosZ = pos.getZ() >> 4; + if(newChunk == null || newChunk.xPosition != chunkPosX || newChunk.zPosition != chunkPosZ) { + newChunk = world.getChunkFromChunkCoords(chunkPosX, chunkPosZ); + } + this.replaceBlockInChunk(newChunk, pos.getX() & 15, pos.getZ() & 15, pos.getX(), pos.getY(), pos.getZ()); + } + redo.clear(); + } + + Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ); + doDeepslateGen(chunk); + stopRecording = false; + } + } + + + private void doDeepslateGen(Chunk chunk) { + + Block block; + + int worldX; + int worldZ; + final int chunkMultiplier = chunk.xPosition * 16; + + for (int y = 0; y <= ConfigWorld.deepslateMaxY; y++) { + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { + if(y < ConfigWorld.deepslateMaxY - 4 || y <= ConfigWorld.deepslateMaxY - chunk.worldObj.rand.nextInt(4)) { + + block = chunk.getBlock(x, y, z); + + worldX = x + chunkMultiplier; + worldZ = z + chunkMultiplier; + + this.replaceBlockInChunk(chunk, block, x, z, worldX, y, worldZ); + } + } + } + } + } + + private void replaceBlockInChunk(Chunk chunk, int x, int z, int worldX, int worldY, int worldZ) { + this.replaceBlockInChunk(chunk, chunk.getBlock(x, worldY, z), x, z, worldX, worldY, worldZ); } + + private void replaceBlockInChunk(Chunk chunk, Block block, int x, int z, int worldX, int worldY, int worldZ) { + if(block.getMaterial() != Material.air && block != ModBlocks.deepslate && block != ModBlocks.tuff && block != ModBlocks.cobbled_deepslate) { + if((block.isReplaceableOreGen(chunk.worldObj, worldX , worldY, worldZ, Blocks.stone) && (ConfigWorld.deepslateReplacesStones || block != ModBlocks.stone)) + || (ConfigWorld.deepslateReplacesDirt && block == Blocks.dirt)) { + chunk.func_150807_a(x, worldY, z, ModBlocks.deepslate, 0); + } else if(ConfigTweaks.deepslateReplacesCobblestone && block.isReplaceableOreGen(chunk.worldObj, worldX, worldY, worldZ, Blocks.cobblestone)) { + chunk.func_150807_a(x, worldY, z, ModBlocks.cobbled_deepslate, 0); + } else if(!DeepslateOreRegistry.getOreMap().isEmpty()) { + BlockAndMetadataMapping mapping; + if((mapping = DeepslateOreRegistry.getOre(block, chunk.getBlockMetadata(x, worldY, z))) != null) { + chunk.func_150807_a(x, worldY, z, mapping.getBlock(), mapping.getMeta()); + } + } + } + } + + private static final Map> redos = new HashMap>(); + public static boolean stopRecording; + + public static void clearRedos() { + redos.clear(); + } + + public static List getRedoList(int dim) { + if(redos.get(dim) == null) { + redos.put(dim, new ArrayList()); + } + return redos.get(dim); + } + + private boolean doesChunkSupportLayerDeepslate(WorldType terrain, int dimId) { + if(ConfigBlocksItems.enableDeepslate) { + if (ConfigWorld.deepslateGenerationMode == 0 && ConfigWorld.deepslateMaxY > 0) { + if(terrain != WorldType.FLAT && !ArrayUtils.contains(ConfigWorld.deepslateLayerDimensionBlacklist, dimId)) { + return true; + } + } + } + return false; + } + } diff --git a/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java b/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java index 5e31c9847..d185d6c34 100644 --- a/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java +++ b/src/main/java/ganymedes01/etfuturum/world/EtFuturumWorldGenerator.java @@ -37,16 +37,16 @@ public class EtFuturumWorldGenerator implements IWorldGenerator { protected final WorldGenMinable magmaGen = new WorldGenMinable(ModBlocks.magma_block, ConfigWorld.maxMagmaPerCluster, Blocks.netherrack); protected final WorldGenMinable netherGoldGen = new WorldGenMinable(ModBlocks.nether_gold_ore, ConfigWorld.maxNetherGoldPerCluster, Blocks.netherrack); - protected final WorldGenMinable debrisGen = new WorldGenMinableCustom(ConfigWorld.debrisMax); - protected final WorldGenMinable smallDebrisGen = new WorldGenMinableCustom(ConfigWorld.smallDebrisMax); + protected final WorldGenMinable debrisGen = new WorldGenMinableCustom(ModBlocks.ancient_debris, ConfigWorld.debrisMax, Blocks.netherrack); + protected final WorldGenMinable smallDebrisGen = new WorldGenMinableCustom(ModBlocks.ancient_debris, ConfigWorld.smallDebrisMax, Blocks.netherrack); protected final WorldGenMinable deepslateBlobGen = new WorldGenDeepslateLayerBlob(ConfigWorld.maxDeepslatePerCluster, false); protected final WorldGenMinable tuffGen = new WorldGenDeepslateLayerBlob(ConfigWorld.maxDeepslatePerCluster, true); public EtFuturumWorldGenerator() { - stoneGen.add(new WorldGenMinable(ModBlocks.stone, 1, ConfigWorld.maxStonesPerCluster, Blocks.stone)); - stoneGen.add(new WorldGenMinable(ModBlocks.stone, 3, ConfigWorld.maxStonesPerCluster, Blocks.stone)); - stoneGen.add(new WorldGenMinable(ModBlocks.stone, 5, ConfigWorld.maxStonesPerCluster, Blocks.stone)); + stoneGen.add(new WorldGenMinableCustom(ModBlocks.stone, 1, ConfigWorld.maxStonesPerCluster, Blocks.stone)); + stoneGen.add(new WorldGenMinableCustom(ModBlocks.stone, 3, ConfigWorld.maxStonesPerCluster, Blocks.stone)); + stoneGen.add(new WorldGenMinableCustom(ModBlocks.stone, 5, ConfigWorld.maxStonesPerCluster, Blocks.stone)); flowers.add(new WorldGenFlowers(ModBlocks.lily_of_the_valley)); flowers.add(new WorldGenFlowers(ModBlocks.cornflower)); flowers.add(new WorldGenFlowers(ModBlocks.sweet_berry_bush)); diff --git a/src/main/java/ganymedes01/etfuturum/world/generate/WorldGenMinableCustom.java b/src/main/java/ganymedes01/etfuturum/world/generate/WorldGenMinableCustom.java index d576f0b76..d634d34a4 100644 --- a/src/main/java/ganymedes01/etfuturum/world/generate/WorldGenMinableCustom.java +++ b/src/main/java/ganymedes01/etfuturum/world/generate/WorldGenMinableCustom.java @@ -4,6 +4,7 @@ import ganymedes01.etfuturum.ModBlocks; import ganymedes01.etfuturum.configuration.configs.ConfigWorld; +import ganymedes01.etfuturum.world.EtFuturumLateWorldGenerator; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -14,12 +15,25 @@ public class WorldGenMinableCustom extends WorldGenMinable { private final boolean shouldAirGen; + private final int meta; - public WorldGenMinableCustom(int p_i45459_2_) - { - super(ModBlocks.ancient_debris, p_i45459_2_, Blocks.netherrack); - shouldAirGen = ConfigWorld.enableAirDebris; - } + public WorldGenMinableCustom(Block p_i45459_1_, int p_i45459_2_) + { + this(p_i45459_1_, p_i45459_2_, Blocks.stone); + } + + public WorldGenMinableCustom(Block p_i45460_1_, int p_i45460_2_, Block p_i45460_3_) + { + this(p_i45460_1_, 0, p_i45460_2_, p_i45460_3_); + } + + public WorldGenMinableCustom(Block block, int meta, int number, Block target) + { + super(block, meta, number, target); + this.meta = meta; + + shouldAirGen = block == ModBlocks.ancient_debris && ConfigWorld.enableAirDebris; + } @Override public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) @@ -63,7 +77,7 @@ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int { if (canGenerate(p_76484_1_, k2, l2, i3)) { - setBlock(p_76484_1_, k2, l2, i3, ModBlocks.ancient_debris, 0, 2); + setBlock(p_76484_1_, k2, l2, i3, field_150519_a, meta, 2); } } } @@ -76,7 +90,9 @@ public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int } private boolean canGenerate(World world, int x, int y, int z) { - if(!world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, field_150518_c)) return false; + Block block = world.getBlock(x, y, z); + + if(!block.isReplaceableOreGen(world, x, y, z, field_150518_c)) return false; if(!shouldAirGen) { for(EnumFacing facing : EnumFacing.values()) {