public BlockOre(int y, Predicate<World> dim, int a, TMResource r, int maxStates) { super(setValue(maxStates), MapColor.GRAY); this.setCreativeTab(CoreInit.tabTomsModMaterials); dropsItself = new ArrayList<>(); dropsItself.add(true); drop = new ArrayList<>(); drop.add(ItemStack.EMPTY); this.setHardness(r.getOreHardness()); this.setResistance(r.getOreResistance()); // r.setOre(this); genEntryMap = new ArrayList<>(); genEntryMap.add(new OreGenEntry(BlockMatcher.forBlock(Blocks.STONE)::apply, dim, this::getDefaultState, 0, a, y, a)); postFixes = new ArrayList<>(); postFixes.add(""); setHarvestLevel("pickaxe", r.getHarvestLevel()); }
public BlockOre(int y, Predicate<World> dim, int a, ItemStack drop, TMResource r, int maxStates) { super(setValue(maxStates), MapColor.GRAY); this.setCreativeTab(CoreInit.tabTomsModMaterials); dropsItself = new ArrayList<>(); dropsItself.add(false); this.drop = new ArrayList<>(); this.drop.add(drop); this.setHardness(8.0F); this.setResistance(30.0F); // r.setOre(this); genEntryMap = new ArrayList<>(); genEntryMap.add(new OreGenEntry(BlockMatcher.forBlock(Blocks.STONE)::apply, dim, this::getDefaultState, 0, a, y, a)); postFixes = new ArrayList<>(); postFixes.add(""); setHarvestLevel("pickaxe", r.getHarvestLevel()); }
public BlockOre(int y, Predicate<World> dim, int a, int maxStates, int harverLevel) { super(setValue(maxStates), MapColor.GRAY); this.setCreativeTab(CoreInit.tabTomsModMaterials); dropsItself = new ArrayList<>(); dropsItself.add(true); drop = new ArrayList<>(); drop.add(ItemStack.EMPTY); this.setHardness(8.0F); this.setResistance(30.0F); // r.setOre(this); genEntryMap = new ArrayList<>(); genEntryMap.add(new OreGenEntry(BlockMatcher.forBlock(Blocks.STONE)::apply, dim, this::getDefaultState, 0, a, y, a)); postFixes = new ArrayList<>(); postFixes.add(""); setHarvestLevel("pickaxe", harverLevel); }
public WorldGenEndOre() { if (Configs.blockCountGold > 0) this.genGold = new WorldGenMinable(WorldModule.end_gold_ore.getDefaultState(), Configs.blockCountGold, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountIron > 0) this.genIron = new WorldGenMinable(WorldModule.end_iron_ore.getDefaultState(), Configs.blockCountIron, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountRedstone > 0) this.genRedstone = new WorldGenMinable(WorldModule.end_redstone_ore.getDefaultState(), Configs.blockCountRedstone, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountCoal > 0) this.genCoal = new WorldGenMinable(WorldModule.end_coal_ore.getDefaultState(), Configs.blockCountCoal, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountEmerald > 0) this.genEmerald = new WorldGenMinable(WorldModule.end_emerald_ore.getDefaultState(), Configs.blockCountEmerald, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountLapis > 0) this.genLapis = new WorldGenMinable(WorldModule.end_lapis_ore.getDefaultState(), Configs.blockCountLapis, BlockMatcher.forBlock(Blocks.END_STONE)); if (Configs.blockCountDiamond > 0) this.genDiamond = new WorldGenMinable(WorldModule.end_diamond_ore.getDefaultState(), Configs.blockCountDiamond, BlockMatcher.forBlock(Blocks.END_STONE)); }
public WorldGenNetherOre() { if (Configs.blockCountRedstone > 0) this.genRedstone = new WorldGenMinable(WorldModule.nether_redstone_ore.getDefaultState(), Configs.blockCountRedstone, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountIron > 0) this.genIron = new WorldGenMinable(WorldModule.nether_iron_ore.getDefaultState(), Configs.blockCountIron, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountGold > 0) this.genGold = new WorldGenMinable(WorldModule.nether_gold_ore.getDefaultState(), Configs.blockCountGold, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountCoal > 0) this.genCoal = new WorldGenMinable(WorldModule.nether_coal_ore.getDefaultState(), Configs.blockCountCoal, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountEmerald > 0) this.genEmerald = new WorldGenMinable(WorldModule.nether_emerald_ore.getDefaultState(), Configs.blockCountEmerald, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountLapis > 0) this.genLapis = new WorldGenMinable(WorldModule.nether_lapis_ore.getDefaultState(), Configs.blockCountLapis, BlockMatcher.forBlock(Blocks.NETHERRACK)); if (Configs.blockCountDiamond > 0) this.genDiamond = new WorldGenMinable(WorldModule.nether_diamond_ore.getDefaultState(), Configs.blockCountDiamond, BlockMatcher.forBlock(Blocks.NETHERRACK)); }
WorldGenOre(Function<Block, IBlockState> function, Block block, int minVeinSize, int maxVeinSize, int minHeight, int maxHeight, int generationChance, Block surrounding, BiomeDictionary.Type... biomes) { super(block.getDefaultState(), minVeinSize); this.oreToGen = function.apply(block); this.minOreVeinSize = minVeinSize; this.maxOreVeinSize = maxVeinSize; this.maxHeight = maxHeight; this.minHeight = minHeight; this.genChance = generationChance; this.predicate = BlockMatcher.forBlock(surrounding); if (biomes != null) Collections.addAll(this.biomes, biomes); }
public void generate(Random random, int chunkX, int chunkZ, World world, OreConfig config) { Block block = GameData.getBlockRegistry().getObject(config.getBlock()); Block block2 = GameData.getBlockRegistry().getObject(config.getReplacementBlock()); if (block2 == null) { block2 = Blocks.STONE; } WorldGenMinable worldGenMinable = new WorldGenMinable(block.getDefaultState(), config.veinSize, BlockMatcher.forBlock(block2)); int xPos, yPos, zPos; for (int i = 0; i < config.veinsPerChunk; i++) { xPos = chunkX * 16 + random.nextInt(16); yPos = 10 + random.nextInt(config.maxYHeight - config.minYHeight); zPos = chunkZ * 16 + random.nextInt(16); worldGenMinable.generate(world, random, new BlockPos(xPos, yPos, zPos)); } }
public OreGen(String name, IBlockState state, int maxVeinSize, Block replaceTarget, int minY, int maxY, int chunkOccurence, int weight) { this.name = name; this.ore = new WorldGenMinable(state, maxVeinSize, BlockMatcher.forBlock(replaceTarget)); this.minY = minY; this.maxY = maxY; this.chunkOccurence = chunkOccurence; this. weight = weight; }
public static void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn) { int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize); int heightRange = maxY - minY; WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), veinSize, BlockMatcher.forBlock(generateIn)); for(int i = 0; i < chance; i++) { int xRand = chunkX * 16 + random.nextInt(16); int yRand = random.nextInt(heightRange) + minY; int zRand = chunkZ * 16 + random.nextInt(16); gen.generate(world, random, new BlockPos(xRand, yRand, zRand)); } }
public static void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int minVeinSize, int maxVeinSize, int chancesToSpawn, int minY, int maxY, Block blockgen) { WorldGenMinable minable = new WorldGenMinable(block.getDefaultState(), (minVeinSize + random.nextInt(maxVeinSize - minVeinSize)), BlockMatcher.forBlock(blockgen)); for(int i = 0; i < chancesToSpawn; i++) { int posX = blockXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); int posZ = blockZPos + random.nextInt(16); minable.generate(world, random, new BlockPos(posX, posY, posZ)); } }
public WorldGen() { Bauxite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(0), 9); Ilmenite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(1), 5); Chromite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(2), 5); Pyrite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(6), 9); Cobaltite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(7), 5); Garnierite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(8), 9); Copper=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(9), 9); Malachite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(10), 9); Sphalerite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(11), 9); ArsenoPyrite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(12), 5); Silver=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(14), 9); Cassiterite=new WorldGenMinable(BlockRegistry.OreBlock0.getStateFromMeta(15), 9); Wolframite=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(0), 5); Platinum=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(1), 5); Galena=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(4), 9); Cinnabar=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(3), 9); Bismuthinite=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(5), 9); Orichalcum=new WorldGenMinable(BlockRegistry.OreBlock1.getStateFromMeta(6), 8); Thorite=new WorldGenMinable(BlockRegistry.ThoriumOre.getDefaultState(), 5); Pitchblende=new WorldGenMinable(BlockRegistry.UraniumOre.getDefaultState(), 5); //nether N_Pyrite=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(0), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_arsenoPyrite=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(1), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Silver=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(2), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Gold=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(3), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Cinnabar=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(4), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Prometheum=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(5), 9, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Mithril=new WorldGenMinable(BlockRegistry.NetherOreBlock0.getStateFromMeta(6), 5, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Sulfur=new WorldGenMinable(BlockRegistry.NetherOreBlock1.getStateFromMeta(1), 17, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Diamond=new WorldGenMinable(BlockRegistry.NetherOreBlock1.getStateFromMeta(2), 7, BlockMatcher.forBlock(Blocks.NETHERRACK)); N_Blazonium=new WorldGenMinable(BlockRegistry.BlazoniumOre.getDefaultState(), 5, BlockMatcher.forBlock(Blocks.NETHERRACK)); //end E_Terminium=new WorldGenMinable(BlockRegistry.TerminiumOre.getDefaultState(), 7, BlockMatcher.forBlock(Blocks.END_STONE)); }
private void generateNether (World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < 50; k++) { int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockZCoord = chunkZ + rand.nextInt(16); int OreY = rand.nextInt(100); BlockPos OrePos = new BlockPos(firstBlockXCoord, OreY, firstBlockZCoord); new WorldGenMinable(ModBlocks.BlazingOreN.getDefaultState(), 4, BlockMatcher.forBlock(Blocks.NETHERRACK)).generate(world, rand, OrePos); new WorldGenMinable(ModBlocks.DarkOreN.getDefaultState(), 2, BlockMatcher.forBlock(Blocks.NETHERRACK)).generate(world, rand, OrePos); new WorldGenMinable(ModBlocks.EnergyOreN.getDefaultState(), 5, BlockMatcher.forBlock(Blocks.NETHERRACK)).generate(world, rand, OrePos); new WorldGenMinable(ModBlocks.TwilightOreN.getDefaultState(), 3, BlockMatcher.forBlock(Blocks.NETHERRACK)).generate(world, rand, OrePos); } }
public WorldGenOreSingleton(Block ore, int mh) { //http://minecraft.gamepedia.com/Ore#Availability // http://minecraft.gamepedia.com/Customized#Ore_settings blockOre = ore; minHeight = mh; gen = new WorldGenMinable(blockOre.getDefaultState(), 1, BlockMatcher.forBlock(Blocks.STONE)); }
public DragonFightManager(WorldServer worldIn, NBTTagCompound compound) { this.world = worldIn; if (compound.hasKey("DragonKilled", 99)) { if (compound.hasUniqueId("DragonUUID")) { this.dragonUniqueId = compound.getUniqueId("DragonUUID"); } this.dragonKilled = compound.getBoolean("DragonKilled"); this.previouslyKilled = compound.getBoolean("PreviouslyKilled"); if (compound.getBoolean("IsRespawning")) { this.respawnState = DragonSpawnManager.START; } if (compound.hasKey("ExitPortalLocation", 10)) { this.exitPortalLocation = NBTUtil.getPosFromTag(compound.getCompoundTag("ExitPortalLocation")); } } else { this.dragonKilled = true; this.previouslyKilled = true; } if (compound.hasKey("Gateways", 9)) { NBTTagList nbttaglist = compound.getTagList("Gateways", 3); for (int i = 0; i < nbttaglist.tagCount(); ++i) { this.gateways.add(Integer.valueOf(nbttaglist.getIntAt(i))); } } else { this.gateways.addAll(ContiguousSet.<Integer>create(Range.<Integer>closedOpen(Integer.valueOf(0), Integer.valueOf(20)), DiscreteDomain.integers())); Collections.shuffle(this.gateways, new Random(worldIn.getSeed())); } this.portalPattern = FactoryBlockPattern.start().aisle(new String[] {" ", " ", " ", " # ", " ", " ", " "}).aisle(new String[] {" ", " ", " ", " # ", " ", " ", " "}).aisle(new String[] {" ", " ", " ", " # ", " ", " ", " "}).aisle(new String[] {" ### ", " # # ", "# #", "# # #", "# #", " # # ", " ### "}).aisle(new String[] {" ", " ### ", " ##### ", " ##### ", " ##### ", " ### ", " "}).where('#', BlockWorldState.hasState(BlockMatcher.forBlock(Blocks.BEDROCK))).build(); }
public WorldGenMinable(IBlockState state, int blockCount) { this(state, blockCount, BlockMatcher.forBlock(Blocks.STONE)); }
public WorldGenMinableRandom(IBlockState[] states, int blockCount) { this(states, blockCount, BlockMatcher.forBlock(Blocks.STONE)); }
public WorldGenOres() { oreGenNiter = new WorldGenMinable(ModBlocks.BLOCK_ORE_NITER.getDefaultState(), 8, BlockMatcher.forBlock(Blocks.STONE)); oreGenSalt = new WorldGenMinable(ModBlocks.BLOCK_ORE_SALT.getDefaultState(), 8, BlockMatcher.forBlock(Blocks.STONE)); oreGenSulfur = new WorldGenMinable(ModBlocks.BLOCK_ORE_SULFUR.getDefaultState(), 8, BlockMatcher.forBlock(Blocks.STONE)); }
public OreGenEntry(Predicate<World> world, Supplier<IBlockState> ore, int yStart, int maxAmount, int yEnd, int veinSize) { this(BlockMatcher.forBlock(Blocks.STONE)::apply, world, ore, yStart, maxAmount, yEnd, veinSize); }
@EventHandler public static void PreLoad(FMLPreInitializationEvent PreEvent) { log.info("Start Pre Initialization"); long tM = System.currentTimeMillis(); oreMonazit = new BlockOre(5, WorldGen.OVERWORLD, 2, 2, 2).addExtraState(WorldGen.END, 55, 12, BlockMatcher.forBlock(Blocks.END_STONE)::apply, "end").setUnlocalizedName("oreMonazit"); crushedMonazit = new ItemCrushedMonazit().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.crushedMonazit").setHasSubtypes(true); if (Config.enableDefenseSystem) { /** Items */ multiTool = new ItemMultiTool(); identityCard = new IdentityCard(); rangeUpgrade = new Item().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.rangeUpgrade"); rangeWidthUpgrade = new Item().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.rangeWidthUpgrade"); rangeHeightUpgrade = new Item().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.rangeHeightUpgrade"); projectorLens = new Item().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.projectorLens").setMaxStackSize(1); projectorFieldType = new ItemProjectorFieldType().setCreativeTab(tabTomsModDefense).setUnlocalizedName("projectorFieldTypeController").setMaxStackSize(1).setHasSubtypes(true).setMaxDamage(0); fieldUpgrade = new ItemFieldUpgrade().setCreativeTab(tabTomsModDefense).setUnlocalizedName("projectorUpgrade").setHasSubtypes(true).setMaxDamage(0); efficiencyUpgrade = new Item().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.efficiencyUpgrade"); /** Blocks */ forceConverter = new ForceConverter().setCreativeTab(tabTomsModDefense).setUnlocalizedName("forceTransformer"); forceCapacitor = new ForceCapacitor().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.forceCapacitor"); securityStation = new SecurityStation().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tm.securityStation"); fieldProjector = new FieldProjector().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tmd.fieldProjector"); blockForce = new BlockForceField().setBlockUnbreakable().setResistance(18000000F).setHardness(-1F).setUnlocalizedName("tmd.force"); defenseStation = new DefenseStation().setCreativeTab(tabTomsModDefense).setUnlocalizedName("tmd.defenseStation"); /** Registry */ /** Items */ registerItem(multiTool, multiTool.getUnlocalizedName().substring(5)); OreDict.registerOre("tomsmodwrench", new ItemStack(DefenseInit.multiTool, 1, 0)); registerItem(identityCard, identityCard.getUnlocalizedName().substring(5)); registerItem(rangeUpgrade, rangeUpgrade.getUnlocalizedName().substring(5)); registerItem(rangeWidthUpgrade, rangeWidthUpgrade.getUnlocalizedName().substring(5)); registerItem(rangeHeightUpgrade, rangeHeightUpgrade.getUnlocalizedName().substring(5)); registerItem(projectorLens, projectorLens.getUnlocalizedName().substring(5)); registerItem(efficiencyUpgrade, efficiencyUpgrade.getUnlocalizedName().substring(5)); registerItem(projectorFieldType, projectorFieldType.getUnlocalizedName().substring(5)); registerItem(fieldUpgrade, fieldUpgrade.getUnlocalizedName().substring(5)); /** Blocks */ registerBlock(forceConverter, forceConverter.getUnlocalizedName().substring(5)); registerBlock(forceCapacitor, forceCapacitor.getUnlocalizedName().substring(5)); registerBlock(securityStation, securityStation.getUnlocalizedName().substring(5)); registerBlock(fieldProjector, fieldProjector.getUnlocalizedName().substring(5)); CoreInit.addOnlyBlockToGameRegisty(blockForce, blockForce.getUnlocalizedName().substring(5)); registerBlock(defenseStation, defenseStation.getUnlocalizedName().substring(5)); /** TileEntities */ GameRegistry.registerTileEntity(TileEntityForceConverter.class, Configs.Modid + ":forceTransformer"); GameRegistry.registerTileEntity(TileEntityForceCapacitor.class, Configs.Modid + ":forceCapacitor"); GameRegistry.registerTileEntity(TileEntitySecurityStation.class, Configs.Modid + ":securityStation"); GameRegistry.registerTileEntity(TileEntityForceFieldProjector.class, Configs.Modid + ":FFProjector"); GameRegistry.registerTileEntity(TileEntityForceField.class, Configs.Modid + ":forceField"); GameRegistry.registerTileEntity(TileEntityDefenseStation.class, Configs.Modid + ":defenseStation"); } registerBlock(oreMonazit, oreMonazit.getUnlocalizedName().substring(5)); registerItem(crushedMonazit, crushedMonazit.getUnlocalizedName().substring(5)); hadPreInit = true; CoreInit.tryLoadAfterPreInit(log); long time = System.currentTimeMillis() - tM; log.info("Pre Initialization took in " + time + " milliseconds"); }
public BlockOre addExtraState(Predicate<World> dim, int y, int a, String postFix) { addExtraState(dim, a, y, BlockMatcher.forBlock(Blocks.STONE)::apply, postFix); return this; }
public BlockOre addExtraState(Predicate<World> dim, int y, int a, String postFix, ItemStack drop) { addExtraState(dim, a, y, BlockMatcher.forBlock(Blocks.STONE)::apply, postFix, drop); return this; }
public WorldGenGoldRiver() { //http://minecraft.gamepedia.com/Ore#Availability // http://minecraft.gamepedia.com/Customized#Ore_settings genGold = new WorldGenMinable(Blocks.GOLD_ORE.getDefaultState(), blockCount, BlockMatcher.forBlock(Blocks.STONE)); }
public WorldGenEmeraldHeight() { //http://minecraft.gamepedia.com/Ore#Availability // http://minecraft.gamepedia.com/Customized#Ore_settings genEmerald = new WorldGenMinable(Blocks.EMERALD_ORE.getDefaultState(), 1, BlockMatcher.forBlock(Blocks.STONE)); }