boolean matches(@SuppressWarnings("TypeMayBeWeakened") @Nonnull Biome other) { return biome == null || biome.getRegistryName().equals(other.getRegistryName()); }
public void loadBiomeList() { for (Biome biome : Biome.REGISTRY) { if (biome == null) { continue; } templatesByBiome.put(biome.getRegistryName().toString(), new HashSet<>()); } }
private static boolean isBiomeValid(Biome biome) { if (biome != null) { if (biomesWhitelist.size() > 0) { return biomesWhitelist.contains(biome.getRegistryName().toString()); } else { return !biomesBlacklist.contains(biome.getRegistryName().toString()); } } return false; }
public static boolean enablesSeasonalEffects(Biome biome) { String name = biome.getRegistryName().toString(); if (biomeDataMap.containsKey(name)) { return biomeDataMap.get(name).enableSeasonalEffects; } return true; }
public static boolean usesTropicalSeasons(Biome biome) { String name = biome.getRegistryName().toString(); if (biomeDataMap.containsKey(name)) { return biomeDataMap.get(name).useTropicalSeasons; } return false; }
public static boolean disablesCrops(Biome biome) { String name = biome.getRegistryName().toString(); if (biomeDataMap.containsKey(name)) { return biomeDataMap.get(name).disableCrops; } return false; }
TradeInfo(String category, Biome biome, boolean enabled, int level, int minPrice, int maxPrice, int color) { this(category, biome, enabled, level, minPrice, maxPrice, color, "quark.biomeMap." + biome.getRegistryName().getResourcePath()); }
@Override protected void saveData(JsonObject json, BiomeTextureMap data) { // Sort resource locations by name List<Biome> keys = new ArrayList<Biome>(data.biomeTextureMap.keySet()); Collections.sort(keys, Comparator.comparing(Biome::getRegistryName)); for(Biome key : keys) { int biomeID = Biome.getIdForBiome(key); if (biomeID >= 0 && (AntiqueAtlasMod.instance.jeidPresent || biomeID < 256)) { json.addProperty(key.getRegistryName().toString(), data.biomeTextureMap.get(key).name); } } } }
@Override public boolean getSundamageInBiome(@Nonnull Biome biome) { if (!getSundamageInBiome(biome.getRegistryName())) return false; for (Class clazz : noSundamageBiomes) { if (clazz.isAssignableFrom(biome.getBiomeClass())) { return false; } } return true; }
public BiomeCheck(int topLeftY, Biome biome) { super(8, topLeftY, 16, 16, String.format("%s (%s)", biome.getBiomeName(), biome.getRegistryName().toString())); //noinspection ConstantConditions this.name = biome.getRegistryName().toString(); } }
protected boolean isExcluded(Biome candidate) { for (BiomeDictionary.Type exType : typeExcludes) { if (BiomeDictionary.hasType(candidate, exType)) { Log.debug("Excluded ", candidate.getRegistryName(), ", "); return true; } } for (ResourceLocation exName : nameExcludes) { if (exName != null && exName.equals(candidate.getRegistryName())) { Log.debug("Excluded ", candidate.getRegistryName(), ", "); return false; } } return false; }
@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; } }
private void loadTradeInfo(Biome biome, boolean enabled, int level, int minPrice, int maxPrice, int color, String overrideCategory, String overrideName) { String category = configCategory + "."; if(!overrideCategory.isEmpty()) category += overrideCategory; else category += biome.getRegistryName().getResourcePath(); TradeInfo info; if(overrideName.isEmpty()) info = new TradeInfo(category, biome, enabled, level, minPrice, maxPrice, color); else info = new TradeInfo(category, biome, enabled, level, minPrice, maxPrice, color, overrideName); if(info.enabled) trades.put(info.level, info); }
@Override public void serialize (JsonObject json, BiomeSpecific value, JsonSerializationContext context) { json.add("biome_id", context.serialize(value.biome.getRegistryName().toString())); }
protected static void printBiomeNames(Biome[] biomes) { for (Biome biome : biomes) { if (biome != null) { Log.debug(" - ", biome.getRegistryName()); } else { Log.debug(" - null"); } } }
List<TownTemplate> getTemplatesValidAtPosition(World world, int x, int z) { if (world.provider == null) { AncientWarfareStructure.LOG.debug("World provider was null when trying to generate town"); return Collections.emptyList(); } Biome biome = world.provider.getBiomeForCoords(new BlockPos(x, 1, z)); ResourceLocation rl = biome.getRegistryName(); if (rl == null) { AncientWarfareStructure.LOG.debug("Biome based on class {} isn't registered and because of that Ancient Warfare can't process biome validation. This may be an error which may need to be fixed by the mod that added the biome.", biome.getClass()); return Collections.emptyList(); } String biomeName = rl.toString(); return templates.values().stream().filter(t -> isDimensionValid(world.provider.getDimension(), t) && isBiomeValid(biomeName, t)).collect(Collectors.toList()); }
@Override protected List<String> getLines() { //noinspection ConstantConditions return ForgeRegistries.BIOMES.getValuesCollection().stream() .map(b -> String.join(",", b.getRegistryName().toString(), getBiomeName(b), b.getTempCategory().name() , Boolean.toString(b.isHighHumidity()), Float.toString(b.getHeightVariation()), b.topBlock.getBlock().getRegistryName().toString() , BiomeDictionary.getTypes(b).stream().map(BiomeDictionary.Type::getName).collect(Collectors.joining("|")), b.getBiomeClass().toString())) .sorted(Comparator.naturalOrder()).collect(Collectors.toList()); }
private static Biome findBiome(String biomeId) { Biome biome = Biome.REGISTRY.getObject(new ResourceLocation(biomeId)); if (biome == null) { for (Biome b : Biome.REGISTRY) { ResourceLocation registryName = b.getRegistryName(); if (registryName != null && biomeId.equals(registryName.getResourcePath())) { biome = b; break; } } } return biome; }
public static boolean isEntityInVampireBiome(Entity e) { if (e == null) return false; try { return ModBiomes.vampireForest.getRegistryName().equals(e.getEntityWorld().getBiome(e.getPosition()).getRegistryName()); } catch (NullPointerException e1) { //http://openeye.openmods.info/crashes/8cef4d710e41adf9be8362e57ad70d28 VampirismMod.log.e("Helper", e1, "Nullpointer when checking biome. This is strange and should not happen"); return false; } }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { EntityPlayer player = getCommandSenderAsPlayer(sender); ResourceLocation res = player.getEntityWorld().getBiome(player.getPosition()).getRegistryName(); sender.sendMessage(new TextComponentString(res.toString())); }