Java Code Examples for net.minecraftforge.common.BiomeDictionary#Type

The following examples show how to use net.minecraftforge.common.BiomeDictionary#Type . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TraverseWorld.java    From Traverse-Legacy-1-12-2 with MIT License 7 votes vote down vote up
public static void register(Version versionAdded,
                            Biome biome,
                            BiomeType type,
                            String name,
                            int weight,
                            boolean disabled,
                            boolean canSpawn,
                            VillageReplacements villageReplacements,
                            RegistryEvent.Register<Biome> event,
                            BiomeDictionary.Type... biomeDictTypes) {
	if (!disabled) {
		biome.setRegistryName(new ResourceLocation(TraverseConstants.MOD_ID, name));
		event.getRegistry().register(biome);
		for (BiomeDictionary.Type biomeDictType : biomeDictTypes) {
			BiomeDictionary.addTypes(biome, biomeDictType);
		}
		biomeList.add(new TraverseBiomeEntry(biome, type, weight, canSpawn, !TraverseConfig.disallowVillages && villageReplacements != NO_VILLAGES, versionAdded));
		if (!TraverseConfig.disallowVillages && villageReplacements != NO_VILLAGES && villageReplacements != NO_REPLACEMENTS) {
			villageReplacementBiomes.put(biome, villageReplacements);
		}
	}
}
 
Example 2
Source File: DimensionProperties.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
/**
 * Adds all biomes of this type to the list of biomes allowed to generate
 * @param type
 */
public void addBiomeType(BiomeDictionary.Type type) {

	ArrayList<Biome> entryList = new ArrayList<Biome>();

	entryList.addAll(BiomeDictionary.getBiomes(type));

	//Neither are acceptable on planets
	entryList.remove(Biome.getBiome(8));
	entryList.remove(Biome.getBiome(9));

	//Make sure we dont add double entries
	Iterator<Biome> iter = entryList.iterator();
	while(iter.hasNext()) {
		Biome nextbiome = iter.next();
		for(BiomeEntry entry : allowedBiomes) {
			if(BiomeDictionary.areSimilar(entry.biome, nextbiome))
				iter.remove();
		}

	}
	allowedBiomes.addAll(getBiomesEntries(entryList));

}
 
Example 3
Source File: AbstractBiomeFilter.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
protected boolean isExcluded(Biome candidate) {
  for (BiomeDictionary.Type exType : typeExcludes) {
    if (BiomeDictionary.hasType(candidate, exType)) {
      if (Config.spawnConfigPrintDetailedOutput) {
        System.out.print("Excluded " + candidate.getBiomeName() + ", ");
      }
      return true;

    }
  }
  for (ResourceLocation exName : nameExcludes) {
    if (exName != null && exName.equals(candidate.getRegistryName())) {
      System.out.print("Excluded " + candidate.getRegistryName() + ", ");
      return false;
    }
  }
  return false;
}
 
Example 4
Source File: BiomeFilterAll.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
@Override
public boolean isMatchingBiome(Biome biome) {

  if (isExcluded(biome)) {
    return false;
  }
  if (!names.isEmpty() && !names.contains(biome.getRegistryName())) {
    return false;
  }
  for (BiomeDictionary.Type type : types) {
    if (!BiomeDictionary.hasType(biome, type)) {
      return false;
    }
  }
  return true;
}
 
Example 5
Source File: TraverseWorld.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void register(Version versionAdded,
                            Biome biome,
                            BiomeType type,
                            String name,
                            int weight,
                            boolean disabled,
                            boolean canSpawn,
                            RegistryEvent.Register<Biome> event,
                            BiomeDictionary.Type... biomeDictTypes) {
    register(versionAdded, biome, type, name, weight, disabled, canSpawn, NO_VILLAGES, event, biomeDictTypes);

}
 
Example 6
Source File: TraverseWorld.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public static void register(Version versionAdded,
                            Biome biome,
                            BiomeType type,
                            String name,
                            int weight,
                            boolean disabled,
                            boolean canSpawn,
                            RegistryEvent.Register<Biome> event,
                            BiomeDictionary.Type... biomeDictTypes) {
	register(versionAdded, biome, type, name, weight, disabled, canSpawn, NO_VILLAGES, event, biomeDictTypes);

}
 
Example 7
Source File: EntityHelper.java    From Moo-Fluids with GNU General Public License v3.0 5 votes vote down vote up
public static void addSpawnFromType(final Class<? extends EntityLiving> entityClass,
                                    final int weightedProb, final int min, final int max,
                                    final EnumCreatureType typeOfCreature,
                                    final BiomeDictionary.Type... biomeTypes) {
  final ArrayList<Biome> biomes = new ArrayList<Biome>();
  for (final BiomeDictionary.Type biomeType : biomeTypes) {
    biomes.addAll(BiomeDictionary.getBiomes(biomeType));
  }

  EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature,
                          biomes.toArray(new Biome[biomes.size()]));
}
 
Example 8
Source File: SettingsIceTheme.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
public SettingsIceTheme(){
	
	this.id = ID;
	this.inherit.add(SettingsBase.ID);
	
	this.criteria = new SpawnCriteria();
	List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
	biomes.add(BiomeDictionary.Type.SNOWY);
	this.criteria.setBiomeTypes(biomes);
	
	this.towerSettings = new TowerSettings(Tower.PYRAMID, Theme.getTheme(Theme.ICE));
}
 
Example 9
Source File: BiomeFilterAny.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean isMatchingBiome(Biome biome) {
  if (isExcluded(biome)) {
    return false;
  }
  if (names.contains(biome.getRegistryName())) {
    return true;
  }
  for (BiomeDictionary.Type type : types) {
    if (BiomeDictionary.hasType(biome, type)) {
      return true;
    }
  }
  return false;
}
 
Example 10
Source File: CommandRouteBiome.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void execute(ICommandContext context, List<String> args) {
	
	ArgumentParser ap = new ArgumentParser(args);
	
	IWorldEditor editor = context.createEditor();
	Coord pos;
	if(!ap.hasEntry(0)){
		pos = context.getPos();
	} else {
		int x; int z;
		try {
			x = CommandBase.parseInt(ap.get(0));
			z = CommandBase.parseInt(ap.get(1));
		} catch (NumberInvalidException e) {
			context.sendMessage("Failure: Invalid Coords: X Z", MessageType.ERROR);
			return;
		}
		pos = new Coord(x, 0, z);
	}
	
	context.sendMessage("Biome Information for " + pos.toString(), MessageType.SPECIAL);
	
	Biome biome = editor.getInfo(pos).getBiome();
	context.sendMessage(biome.getBiomeName(), MessageType.SPECIAL);
	
	Set<BiomeDictionary.Type> biomeTypes = BiomeDictionary.getTypes(biome);
	String types = "";
	for(BiomeDictionary.Type type : biomeTypes){
		types += type.getName() + " ";
	}
	
	context.sendMessage(types, MessageType.SPECIAL);
	return;
}
 
Example 11
Source File: SpawnContext.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean includesBiomeType(List<Type> biomeTypes) {
	
	for(BiomeDictionary.Type type : biomeTypes){
		if(biomeHasType(type)) return true;
	}
	
	return false;
}
 
Example 12
Source File: SettingsGrasslandTheme.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
public SettingsGrasslandTheme(){
	
	this.id = ID;
	this.inherit.add(SettingsBase.ID);
	
	this.criteria = new SpawnCriteria();
	List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
	biomes.add(BiomeDictionary.Type.PLAINS);
	this.criteria.setBiomeTypes(biomes);
	
	this.towerSettings = new TowerSettings(Tower.ROGUE, Theme.getTheme(Theme.TOWER));
	
	for(int i = 0; i < 5; ++i){
		
		LevelSettings level = new LevelSettings();
		SecretFactory secrets = new SecretFactory();
		DungeonFactory rooms = new DungeonFactory();
		
		switch(i){
		case 0:
			secrets.addRoom(DungeonRoom.BEDROOM);
			secrets.addRoom(DungeonRoom.SMITH);
			secrets.addRoom(DungeonRoom.FIREWORK);
			level.setSecrets(secrets);
			break;
		case 1:
			secrets.addRoom(DungeonRoom.BTEAM);
			rooms.addSingle(DungeonRoom.MUSIC);
			rooms.addSingle(DungeonRoom.PIT);
			rooms.addSingle(DungeonRoom.MESS);
			rooms.addSingle(DungeonRoom.LAB);
			rooms.addRandom(DungeonRoom.CORNER, 10);
			rooms.addRandom(DungeonRoom.BRICK, 3);
			level.setSecrets(secrets);
			level.setRooms(rooms);
			break;
		case 2:
			break;
		case 3:
			break;
		case 4:
			break;
		default:
			break;
		}
		levels.put(i, level);
	}
	
	levels.get(3).addFilter(Filter.VINE);
}
 
Example 13
Source File: SettingsJungleTheme.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
public SettingsJungleTheme(){
	
	this.id = ID;
	this.inherit.add(SettingsBase.ID);
	
	this.criteria = new SpawnCriteria();
	List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
	biomes.add(BiomeDictionary.Type.JUNGLE);
	this.criteria.setBiomeTypes(biomes);
	
	this.towerSettings = new TowerSettings(Tower.JUNGLE, Theme.getTheme(Theme.JUNGLE));
	
	this.lootRules = new LootRuleManager();
	for(int i = 0; i < 5; ++i){
		this.lootRules.add(null, new WeightedRandomLoot(Items.EMERALD, 0, 1, 1 + i, 1), i, false, 6);	
		this.lootRules.add(null, new WeightedRandomLoot(Items.DIAMOND, 1), i, false, 3 + i * 3);
	}

	
	Theme[] themes = {Theme.JUNGLE, Theme.JUNGLE, Theme.MOSSY, Theme.MOSSY, Theme.NETHER};

	SegmentGenerator segments;
	for(int i = 0; i < 5; ++i){
		LevelSettings level = new LevelSettings();
		if(i < 4){
			level.setDifficulty(3);
			segments = new SegmentGenerator(Segment.MOSSYARCH);
			segments.add(Segment.SHELF, 2);
			segments.add(Segment.INSET, 2);
			segments.add(Segment.JUNGLE, 5);
			segments.add(Segment.SKULL, 1);
			segments.add(Segment.ARROW, 1);
			segments.add(Segment.CELL, 1);
			segments.add(Segment.SILVERFISH, 1);
			segments.add(Segment.CHEST, 1);
			segments.add(Segment.SPAWNER, 2);
			level.setSegments(segments);
			level.addFilter(Filter.VINE);
		}
					
		level.setTheme(Theme.getTheme(themes[i]));
		levels.put(i, level);
	}
}
 
Example 14
Source File: SpawnCriteria.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
public void setBiomeTypes(List<BiomeDictionary.Type> biomeTypes){
	this.biomeTypes = biomeTypes;
	this.everywhere = this.biomes.isEmpty() && this.biomeTypes.isEmpty();
}
 
Example 15
Source File: SettingsForestTheme.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
public SettingsForestTheme(){
	
	this.id = ID;
	this.inherit.add(SettingsBase.ID);
	
	this.criteria = new SpawnCriteria();
	List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
	biomes.add(BiomeDictionary.Type.FOREST);
	this.criteria.setBiomeTypes(biomes);
	
	this.towerSettings = new TowerSettings(Tower.ROGUE, Theme.getTheme(Theme.TOWER));
			
	for(int i = 0; i < 5; ++i){
		
		LevelSettings level = new LevelSettings();
		SecretFactory secrets; 
		DungeonFactory rooms;
		SegmentGenerator segments;
		
		
		switch(i){
		case 0:
			rooms = new DungeonFactory();
			rooms.addRandom(DungeonRoom.CORNER, 8);
			rooms.addRandom(DungeonRoom.BRICK, 3);
			rooms.addSingle(DungeonRoom.CAKE);
			rooms.addSingle(DungeonRoom.DARKHALL);
			rooms.addSingle(DungeonRoom.LIBRARY);
			level.setRooms(rooms);
			secrets = new SecretFactory();
			secrets.addRoom(DungeonRoom.SMITH);
			secrets.addRoom(DungeonRoom.BEDROOM, 2);
			level.setSecrets(secrets);
			level.setTheme(Theme.getTheme(Theme.SPRUCE));
			segments = new SegmentGenerator(Segment.ARCH);
			segments.add(Segment.DOOR, 8);
			segments.add(Segment.LAMP, 2);
			segments.add(Segment.WHEAT, 3);
			segments.add(Segment.FLOWERS, 2);
			segments.add(Segment.INSET, 1);
			segments.add(Segment.PLANT, 2);
			segments.add(Segment.SHELF, 1);
			segments.add(Segment.CHEST, 1);
			level.setSegments(segments);
			break;
		case 1:
			rooms = new DungeonFactory();
			rooms.addSingle(DungeonRoom.MUSIC);
			rooms.addSingle(DungeonRoom.PIT);
			rooms.addSingle(DungeonRoom.LAB);
			rooms.addSingle(DungeonRoom.SLIME, 2);
			rooms.addRandom(DungeonRoom.CORNER, 10);
			rooms.addRandom(DungeonRoom.BRICK, 3);
			level.setRooms(rooms);
			level.setTheme(Theme.getTheme(Theme.DARKHALL));
			segments = new SegmentGenerator(Segment.ARCH);
			segments.add(Segment.DOOR, 10);
			segments.add(Segment.FLOWERS, 2);
			segments.add(Segment.INSET, 2);
			segments.add(Segment.PLANT, 2);
			segments.add(Segment.SHELF, 2);
			segments.add(Segment.CHEST, 1);
			level.setSegments(segments);
			break;
		case 2:
			break;
		case 3:
			break;
		case 4:
			break;
		default:
			break;
		}
		
		
		levels.put(i, level);
	}
	levels.get(3).addFilter(Filter.VINE);
}
 
Example 16
Source File: BiomeDescriptor.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public BiomeDictionary.Type getType() {
  return type;
}
 
Example 17
Source File: GTUtility.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static BiomeDictionary.Type getBiomeTypeTagByName(String name) {
    Map<String, BiomeDictionary.Type> byName = ReflectionHelper.getPrivateValue(BiomeDictionary.Type.class, null, "byName");
    return byName.get(name);
}
 
Example 18
Source File: IAlleleButterflySpecies.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Allows butterflies to restrict random spawns beyond the restrictions set by getTemperature() and getHumidity().
 * 
 * @return EnumSet of biome tags this butterfly species can be spawned in.
 */
EnumSet<BiomeDictionary.Type> getSpawnBiomes();
 
Example 19
Source File: ISpawnContext.java    From minecraft-roguelike with GNU General Public License v3.0 votes vote down vote up
public boolean biomeHasType(BiomeDictionary.Type type); 
Example 20
Source File: IBiomeDescriptor.java    From EnderZoo with Creative Commons Zero v1.0 Universal votes vote down vote up
BiomeDictionary.Type getType();