@SuppressWarnings("unchecked") public boolean isBiomeEqual(BiomeGenBase biome, Random rand) { if (biome != null) { switch (type) { default: break; case 0: String name = biome.biomeName; return name.hashCode() == hash && name.equals(data); case 1: return biome.getTempCategory() == data == whitelist; case 2: return BiomeDictionary.isBiomeOfType(biome, (Type) data) == whitelist; case 4: return ((Collection<String>) data).contains(biome.biomeName); case 5: return ((Collection<TempCategory>) data).contains(biome.getTempCategory()) == whitelist; case 6: Type[] d = (Type[]) data; int c = 0, e = d.length; for (int i = 0; i < e; ++i) { if (BiomeDictionary.isBiomeOfType(biome, d[i])) { ++c; } } return c == e == whitelist; } } return !whitelist; }
@Override @SideOnly(Side.CLIENT) public boolean hasEffect(ItemStack stack) { EntityPlayerSP thePlayer = FMLClientHandler.instance().getClientPlayerEntity(); WorldClient theWorld = FMLClientHandler.instance().getWorldClient(); BlockPos pos = new BlockPos(thePlayer.posX, thePlayer.posY, thePlayer.posZ); BiomeGenBase biome = theWorld.getBiomeGenForCoords(pos); return BiomeDictionary.isBiomeOfType(biome, Type.MAGICAL); }
public void generate( Random random, int i, int k, World world, IChunkProvider provider, IChunkProvider provider2) { i *= 16; k *= 16; i += random.nextInt(16); k += random.nextInt(16); BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, k); if (BiomeDictionary.isBiomeOfType(biome, Type.SWAMP) || BiomeDictionary.isBiomeOfType(biome, Type.FOREST) || BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE) || BiomeDictionary.isBiomeOfType(biome, Type.PLAINS)) { if (!BiomeDictionary.isBiomeOfType(biome, Type.COLD)) { if (emasher.blocks.Blocks.hemp().canBlockStay(world, i, world.getHeightValue(i, k), k) && random.nextInt(100) == 0) { world.setBlock(i, world.getHeightValue(i, k), k, emasher.blocks.Blocks.hemp(), 0, 2); } } } }
public static boolean testBiomeTypeTags(BiomeGenBase biome, TagParser.Tag[] tags) { if (tags.length == 0) { return false; } boolean hasMatching = false; for (TagParser.Tag tag : tags) { try { final boolean res = BiomeDictionary.isBiomeOfType(biome, fetchBiomeType(tag.value)); if (tag.exclude && res) return false; if (tag.must && !res) return false; if (res) hasMatching = true; } catch (BiomeTypeNotFound ex) { ex.printStackTrace(); return false; } } return hasMatching; }
@Override public boolean addComponentParts( World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { ModLog.debug(startPiece); if (startPiece != null) { if (BiomeDictionary.isBiomeOfType(startPiece.biome, TofuCraftCore.BIOME_TYPE_TOFU)) return false; } if (this.field_143015_k < 0) // averageGroundLevel { this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); if (this.field_143015_k < 0) { return true; } this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); } int width = 8; int height = 4; int length = 6; // Floor this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, 0, 0, width, 0, length, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); // Ceiling this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, 4, 0, width, height, length, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); // Wall this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, 1, 0, 0, height - 1, length, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, width, 1, 0, width, height - 1, length, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, 1, length, width, height - 1, length, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, 1, 0, width, height - 1, 0, TcBlocks.tofuIshi, TcBlocks.tofuIshi, false); // Window this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, 0, 2, length / 2 - 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, 0, 2, length / 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, 0, 2, length / 2 + 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width / 2 - 1, 2, length, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width / 2, 2, length, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width / 2 + 1, 2, length, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width, 2, length / 2 - 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width, 2, length / 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.glass_pane, 0, width, 2, length / 2 + 1, par3StructureBoundingBox); // Door this.placeDoorAtCurrentPosition( par1World, par3StructureBoundingBox, par2Random, width / 2, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1)); if (this.getBlockAtCurrentPosition(par1World, 2, 0, -1, par3StructureBoundingBox) == Blocks.air && this.getBlockAtCurrentPosition(par1World, 2, -1, -1, par3StructureBoundingBox) != Blocks.air) { this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuStairsIshi, this.getMetadataWithOffset(Blocks.stone_stairs, 3), width / 2, 0, -1, par3StructureBoundingBox); } // Cleaning this.fillWithBlocks( par1World, par3StructureBoundingBox, 1, 1, 1, width - 1, height - 1, length - 1, Blocks.air, Blocks.air, false); /* * Basement */ // Room this.fillWithBlocks( par1World, par3StructureBoundingBox, 1, -3, 1, width - 1, -1, length - 1, Blocks.air, Blocks.air, false); // Floor this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, -4, 0, width, -4, length, Blocks.planks, Blocks.planks, false); // Wall this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, -3, 0, 0, -1, length, Blocks.planks, Blocks.planks, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, width, -3, 0, width, -1, length, Blocks.planks, Blocks.planks, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, -3, length, width, -1, length, Blocks.planks, Blocks.planks, false); this.fillWithBlocks( par1World, par3StructureBoundingBox, 0, -3, 0, width, -1, 0, Blocks.planks, Blocks.planks, false); // Stairs this.placeBlockAtCurrentPosition( par1World, Blocks.air, 0, width - 1, 0, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.air, 0, width - 1, 0, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.air, 0, width - 1, 0, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.air, 0, width - 1, 0, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), width - 1, 0, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), width - 1, -1, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), width - 1, -2, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -1, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -2, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -3, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -1, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -3, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -3, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.planks, 0, width - 1, -3, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 0), width - 2, -3, 5, par3StructureBoundingBox); /* * Interior */ int i, j, k; // Carpet for (i = 1; i <= length - 1; ++i) { for (j = 1; j <= width - 2; ++j) { this.placeBlockAtCurrentPosition( par1World, Blocks.carpet, 0, j, 1, i, par3StructureBoundingBox); } } this.placeBlockAtCurrentPosition( par1World, Blocks.carpet, 0, width - 1, 1, 1, par3StructureBoundingBox); // Torch this.placeBlockAtCurrentPosition( par1World, Blocks.torch, 0, width / 2, 3, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.torch, 0, width - 2, -2, length / 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.torch, 0, 1, -2, length / 2, par3StructureBoundingBox); // Workbench this.placeBlockAtCurrentPosition( par1World, Blocks.crafting_table, 0, 2, 1, 5, par3StructureBoundingBox); // Salt Furnace this.placeBlockAtCurrentPosition( par1World, TcBlocks.saltFurnaceIdle, 0, 1, 1, 5, par3StructureBoundingBox); // Cauldron this.placeBlockAtCurrentPosition( par1World, Blocks.cauldron, 3, 1, 2, 5, par3StructureBoundingBox); // Book shelf this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 1, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 1, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 2, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.bookshelf, 0, 6, 2, 5, par3StructureBoundingBox); // Item frame k = 0; for (j = 3; j >= 2; j--) { for (i = 1; i <= 3; i++) { this.hangItemFrame( par1World, par3StructureBoundingBox, i, j, 0, new ItemStack(displayedItemList[k++])); } } // Tofu this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 2, -3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 3, -3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 4, -3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 5, -3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 2, -3, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 3, -3, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, TcBlocks.tofuMomen, 0, 4, -3, 4, par3StructureBoundingBox); // Weight this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 2, -2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 3, -2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 4, -2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 5, -2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 2, -2, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 3, -2, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition( par1World, Blocks.cobblestone, 0, 4, -2, 4, par3StructureBoundingBox); // Leek for (i = 0; i < 20; i++) { j = par2Random.nextInt(width - 1) + 1; k = par2Random.nextInt(length - 1) + 1; this.placeBlockAtCurrentPosition( par1World, TcBlocks.leek, BlockLeek.META_NATURAL, j, height + 1, k, par3StructureBoundingBox); } for (i = 0; i <= length; ++i) { for (j = 0; j <= width; ++j) { this.clearCurrentPositionBlocksUpwards( par1World, j, height + 2, i, par3StructureBoundingBox); this.func_151554_b( par1World, Blocks.cobblestone, 0, j, -5, i, par3StructureBoundingBox); // fillCurrentPositionBlocksDownwards } } this.spawnVillagers(par1World, par3StructureBoundingBox, 1, 1, 2, 1); return true; }
@Override public void populate(int chunkX, int chunkZ) { BlockFalling.fallInstantly = true; int worldX = chunkX * 16; int worldZ = chunkZ * 16; BlockPos blockPos = new BlockPos(worldX, 0, worldZ); Biome biome = worldObj.getBiomeGenForCoords(blockPos.add(16, 0, 16)); BiomeDecorator decorator = biome.theBiomeDecorator; int worldHeight = worldObj.provider.getActualHeight(); ForgeEventFactory.onChunkPopulate(true, this, worldObj, rand, chunkX, chunkZ, false); int x, y, z; if (CavelandConfig.generateLakes) { if (TerrainGen.populate(this, worldObj, rand, chunkX, chunkZ, false, EventType.LAKE)) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 16); z = rand.nextInt(16) + 8; lakeWaterGen.generate(worldObj, rand, blockPos.add(x, y, z)); } if (rand.nextInt(30) == 0 && TerrainGen.populate(this, worldObj, rand, chunkX, chunkZ, false, EventType.LAVA)) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight / 2); z = rand.nextInt(16) + 8; lakeLavaGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, rand, blockPos)); MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(worldObj, rand, blockPos)); for (CaveVein vein : CavelandConfig.veinManager.getCaveVeins()) { vein.generateVeins(worldObj, rand, blockPos); } MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(worldObj, rand, blockPos)); for (int i = 0; i < 10; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 10); z = rand.nextInt(16) + 8; acresiaGen.generate(worldObj, rand, blockPos.add(x, y, z)); } for (int i = 0; i < 15; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight / 2 - 10) + worldHeight / 2; z = rand.nextInt(16) + 8; acresiaGen.generate(worldObj, rand, blockPos.add(x, y, z)); } if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.SHROOM)) { for (int i = 0; i < 5; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 10); z = rand.nextInt(16) + 8; decorator.mushroomBrownGen.generate(worldObj, rand, blockPos.add(x, y, z)); } for (int i = 0; i < 5; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 10); z = rand.nextInt(16) + 8; decorator.mushroomRedGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } if (BiomeDictionary.isBiomeOfType(biome, Type.SANDY)) { if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.CACTUS)) { for (int i = 0; i < 80; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 5); z = rand.nextInt(16) + 8; decorator.cactusGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.DEAD_BUSH)) { for (int i = 0; i < 10; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 5); z = rand.nextInt(16) + 8; deadBushGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } } else { if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.FLOWERS)) { for (int i = 0; i < 8; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 5); z = rand.nextInt(16) + 8; decorator.yellowFlowerGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } for (int i = 0; i < 18; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight - 5); z = rand.nextInt(16) + 8; biome.getRandomWorldGenForGrass(rand).generate(worldObj, rand, blockPos.add(x, y, z)); } if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.TREE)) { WorldGenAbstractTree treeGen = null; if (BiomeDictionary.isBiomeOfType(biome, Type.JUNGLE)) { treeGen = new WorldGenTreesPerverted( false, 4 + rand.nextInt(7), BlockPlanks.EnumType.JUNGLE, true); } else if (BiomeDictionary.isBiomeOfType(biome, Type.FOREST) || !BiomeDictionary.isBiomeOfType(biome, Type.PLAINS) || rand.nextInt(10) == 0) { if (BiomeDictionary.isBiomeOfType(biome, Type.COLD)) { treeGen = new WorldGenSpruceTreePerverted(false); } else if (rand.nextInt(3) == 0) { treeGen = new WorldGenBirchTreePerverted(false, false); } else { treeGen = new WorldGenTreesPerverted(false, 3, BlockPlanks.EnumType.OAK, true); } } if (treeGen != null) { for (int i = 0; i < 80; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight); z = rand.nextInt(16) + 8; BlockPos pos = blockPos.add(x, y, z); if (treeGen.generate(worldObj, rand, pos)) { treeGen.generateSaplings(worldObj, rand, pos); } } for (int i = 0; i < 60; ++i) { x = rand.nextInt(16) + 8; y = 8 + rand.nextInt(5); z = rand.nextInt(16) + 8; BlockPos pos = blockPos.add(x, y, z); if (treeGen.generate(worldObj, rand, pos)) { treeGen.generateSaplings(worldObj, rand, pos); } } } } if (decorator.generateLakes) { if (BiomeDictionary.isBiomeOfType(biome, Type.WATER)) { if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_WATER)) { for (int i = 0; i < 150; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10); z = rand.nextInt(16) + 8; liquidWaterGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } } else { if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_WATER)) { for (int i = 0; i < 100; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10); z = rand.nextInt(16) + 8; liquidWaterGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } if (TerrainGen.decorate(worldObj, rand, blockPos, Decorate.EventType.LAKE_LAVA)) { for (int i = 0; i < 20; ++i) { x = rand.nextInt(16) + 8; y = rand.nextInt(worldHeight / 2); z = rand.nextInt(16) + 8; liquidLavaGen.generate(worldObj, rand, blockPos.add(x, y, z)); } } } } } MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, rand, blockPos)); ForgeEventFactory.onChunkPopulate(false, this, worldObj, rand, chunkX, chunkZ, false); BlockFalling.fallInstantly = false; }
@Override public boolean displaceIfPossible(World world, BlockPos pos) { if (!world.isRemote) { if (!world.provider.isSurfaceWorld()) { if (world.getBlockState(pos).getBlock() == Blocks.WATER && AbyssalCraft.shouldSpread == false) return false; if (world.getBlockState(pos).getMaterial().isLiquid() && world.getBlockState(pos).getBlock() != this && world.getBlockState(pos).getBlock() != ACBlocks.liquid_antimatter) world.setBlockState(pos, getDefaultState()); if (AbyssalCraft.breakLogic == true && world .getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())) .getMaterial() .isLiquid() && world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock() != this && world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())).getBlock() != ACBlocks.liquid_antimatter) world.setBlockState( new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()), getDefaultState()); } else { if (BiomeDictionary.isBiomeOfType(world.getBiomeGenForCoords(pos), Type.OCEAN) && world.getBlockState(pos).getBlock() == this) if (AbyssalCraft.destroyOcean) world.setBlockState(pos, getDefaultState()); else world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState()); if (AbyssalCraft.shouldSpread) { if (world.getBlockState(pos).getMaterial().isLiquid() && world.getBlockState(pos).getBlock() != this && world.getBlockState(pos).getBlock() != ACBlocks.liquid_antimatter) world.setBlockState(pos, getDefaultState()); if (AbyssalCraft.breakLogic == true && world .getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())) .getMaterial() .isLiquid() && world .getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())) .getBlock() != this && world .getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ())) .getBlock() != ACBlocks.liquid_antimatter) world.setBlockState( new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()), getDefaultState()); } } if (dusts.contains(world.getBlockState(pos)) && world.getBlockState(pos) != ACBlocks.abyssal_nitre_ore.getDefaultState() && world.getBlockState(pos) != ACBlocks.abyssal_coralium_ore) if (oresToBlocks(OreDictionary.getOres("oreSaltpeter")).contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_nitre_ore.getDefaultState()); else world.setBlockState(pos, ACBlocks.abyssal_coralium_ore.getDefaultState()); else if (metalloids.contains(world.getBlockState(pos)) && !metals.contains(world.getBlockState(pos))) if (oresToBlocks(OreDictionary.getOres("oreIron")).contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_iron_ore.getDefaultState()); else if (oresToBlocks(OreDictionary.getOres("oreGold")).contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_gold_ore.getDefaultState()); else if (oresToBlocks(OreDictionary.getOres("oreTin")).contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_tin_ore.getDefaultState()); else if (oresToBlocks(OreDictionary.getOres("oreCopper")) .contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_copper_ore.getDefaultState()); else world.setBlockState(pos, ACBlocks.liquified_coralium_ore.getDefaultState()); else if (gems.contains(world.getBlockState(pos)) && world.getBlockState(pos) != ACBlocks.abyssal_diamond_ore.getDefaultState()) if (oresToBlocks(OreDictionary.getOres("oreDiamond")).contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_diamond_ore.getDefaultState()); else world.setBlockState(pos, ACBlocks.pearlescent_coralium_ore.getDefaultState()); else if (stones.contains(world.getBlockState(pos))) if (BiomeDictionary.isBiomeOfType(world.getBiomeGenForCoords(pos), Type.OCEAN)) { if (world.getBlockState(pos).getBlock() != Blocks.COBBLESTONE) world.setBlockState(pos, ACBlocks.abyssal_stone.getDefaultState()); } else world.setBlockState(pos, ACBlocks.abyssal_stone.getDefaultState()); else if (bricks.contains(world.getBlockState(pos))) world.setBlockState(pos, ACBlocks.abyssal_stone_brick.getDefaultState()); } return super.displaceIfPossible(world, pos); }
public void generateSurface(World world, Random random, int chunkX, int chunkZ) { if (AbyssalCraft.generateDarklandsStructures) { for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new AChouse1().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new AChouse2().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new ACplatform1().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new ACplatform2().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new ACscion1().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } for (int k = 0; k < 2; k++) { int RandPosX = chunkX + random.nextInt(5); int RandPosY = random.nextInt(75); int RandPosZ = chunkZ + random.nextInt(5); new ACscion2().generate(world, random, new BlockPos(RandPosX, RandPosY, RandPosZ)); } } if (AbyssalCraft.generateCoraliumOre) { for (int rarity = 0; rarity < 3; rarity++) { int veinSize = 2 + random.nextInt(2); int x = chunkX + random.nextInt(16); int y = random.nextInt(40); int z = chunkZ + random.nextInt(16); if (BiomeDictionary.isBiomeOfType( world.getBiomeGenForCoords(new BlockPos(x, 0, z)), Type.SWAMP)) new WorldGenMinable(ACBlocks.coralium_ore.getDefaultState(), veinSize) .generate(world, random, new BlockPos(x, y, z)); } for (int rarity = 0; rarity < 6; rarity++) { int veinSize = 4 + random.nextInt(2); int x = chunkX + random.nextInt(16); int y = random.nextInt(40); int z = chunkZ + random.nextInt(16); if (BiomeDictionary.isBiomeOfType( world.getBiomeGenForCoords(new BlockPos(x, 0, z)), Type.OCEAN) && world.getBiomeGenForCoords(new BlockPos(x, 0, z)) != Biomes.DEEP_OCEAN) new WorldGenMinable(ACBlocks.coralium_ore.getDefaultState(), veinSize) .generate(world, random, new BlockPos(x, y, z)); if (world.getBiomeGenForCoords(new BlockPos(x, 0, z)) == Biomes.DEEP_OCEAN) new WorldGenMinable(ACBlocks.coralium_ore.getDefaultState(), veinSize) .generate(world, random, new BlockPos(x, y - 20, z)); } } if (AbyssalCraft.generateNitreOre) for (int rarity = 0; rarity < 3; rarity++) { int veinSize = 4 + random.nextInt(2); int x = chunkX + random.nextInt(16); int y = random.nextInt(30); int z = chunkZ + random.nextInt(16); new WorldGenMinable(ACBlocks.nitre_ore.getDefaultState(), veinSize) .generate(world, random, new BlockPos(x, y, z)); } if (AbyssalCraft.generateShoggothLairs) for (int i = 0; i < 1; i++) { int x = chunkX + random.nextInt(16); int z = chunkZ + random.nextInt(16); if (BiomeDictionary.isBiomeOfType( world.getBiomeGenForCoords(new BlockPos(x, 0, z)), Type.SWAMP) || BiomeDictionary.isBiomeOfType( world.getBiomeGenForCoords(new BlockPos(x, 0, z)), Type.RIVER) && !BiomeDictionary.isBiomeOfType( world.getBiomeGenForCoords(new BlockPos(x, 0, z)), Type.OCEAN)) if (random.nextInt(100) == 0) new StructureShoggothPit() .generate(world, random, world.getHeight(new BlockPos(x, 0, z))); } }
@Override public void updateEntity() { if (!this.worldObj.isRemote) { boolean isLightningSpawned = false; if (this.worldObj.getWorldInfo().isThundering() && this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord, this.zCoord) && !BiomeDictionary.isBiomeOfType( this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord), Type.SANDY) && ConfigGeneral.unnaturalLightningStrikes) { Random random = this.worldObj.rand; int chance = random.nextInt(ConfigBalance.lightningRodHitChance); if (chance == 0) { EntityLightningBolt lightningBolt = new EntityLightningBolt(this.worldObj, this.xCoord, this.yCoord, this.zCoord); unnaturalLightningBolts.add(lightningBolt); this.worldObj.addWeatherEffect(lightningBolt); this.buffer.modifyEnergyStored(ConfigBalance.lightningRodEnergyProduction); isLightningSpawned = true; } } if (ConfigGeneral.naturalLightningStrikes) { AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( (double) this.xCoord - 1, (double) this.yCoord - 1, (double) this.zCoord - 1, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1); List list = this.worldObj.getEntitiesWithinAABB(EntityLightningBolt.class, axisalignedbb); if (!list.isEmpty()) isLightningSpawned = true; for (Object obj : list) { if (unnaturalLightningBolts.remove(obj)) continue; this.buffer.modifyEnergyStored(ConfigBalance.lightningRodEnergyProduction); } } if (ConfigGeneral.weather2LightningStrikes) { if (weather2Class == null) { try { weather2Class = Class.forName("weather2.entity.EntityLightningBolt"); } catch (ClassNotFoundException exception) { } } if (weather2Class != null) { AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox( (double) this.xCoord - 1, (double) this.yCoord - 1, (double) this.zCoord - 1, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1); List list = this.worldObj.getEntitiesWithinAABB(weather2Class, axisalignedbb); if (!list.isEmpty()) isLightningSpawned = true; for (Object obj : list) this.buffer.modifyEnergyStored(ConfigBalance.lightningRodEnergyProduction); } } if (isLightningSpawned && (this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == InitBlocks.blockCopperWire) && (this.worldObj.getBlock(this.xCoord, this.yCoord - 2, this.zCoord) == InitBlocks.blockFlesh) && (this.worldObj.getBlock(this.xCoord, this.yCoord - 3, this.zCoord) == InitBlocks.blockFlesh)) { EntityFleshGolem golem = new EntityFleshGolem(this.worldObj); golem.setPosition(this.xCoord, this.yCoord, this.zCoord); this.worldObj.spawnEntityInWorld(golem); this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 1, this.zCoord); this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 2, this.zCoord); this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 3, this.zCoord); } if (this.buffer.getEnergyStored() > 0) { int usedEnergy = Math.min(buffer.getEnergyStored(), RFOutPerTick); int outputEnergy = usedEnergy; for (ForgeDirection dir : EnumSet.allOf(ForgeDirection.class)) usedEnergy -= this.outputEnergy(dir, usedEnergy); this.buffer.modifyEnergyStored(usedEnergy - outputEnergy); } } }