mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 21:09:51 +00:00
Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12
This commit is contained in:
commit
0f494d4ac7
6 files changed
+61
-15
No files matched your search
@@ -23,12 +23,17 @@ public class HiveConfig {
|
||||
private final Set<Biome> blacklistedBiomes = new HashSet<>();
|
||||
|
||||
private static final Set<Integer> blacklistedDims = new HashSet<>();
|
||||
|
||||
private static final Set<Integer> whitelistedDims = new HashSet<>();
|
||||
|
||||
public static void parse(LocalizedConfiguration config){
|
||||
config.addCategoryCommentLocalized(CATEGORY);
|
||||
for(int dimId : config.get("world.generate.beehives", "dimBlacklist", new int[0]).getIntList()){
|
||||
blacklistedDims.add(dimId);
|
||||
}
|
||||
for(int dimId : config.get("world.generate.beehives", "dimWhitelist", new int[0]).getIntList()) {
|
||||
whitelistedDims.add(dimId);
|
||||
}
|
||||
for(IHiveRegistry.HiveType type : IHiveRegistry.HiveType.values()){
|
||||
String[] entries = config.get(CATEGORY, type.getName(), new String[0]).getStringList();
|
||||
configs.put(type, new HiveConfig(entries));
|
||||
@@ -62,11 +67,18 @@ public class HiveConfig {
|
||||
return BiomeDictionary.getTypes(biome).stream().anyMatch(blacklistedTypes::contains);
|
||||
}
|
||||
|
||||
public static boolean isDimBlacklisted(int dimId) {
|
||||
return blacklistedDims.contains(dimId);
|
||||
public static boolean isDimAllowed(int dimId) { //blacklist has priority
|
||||
if(blacklistedDims.isEmpty() || !blacklistedDims.contains(dimId)) {
|
||||
return whitelistedDims.isEmpty() || whitelistedDims.contains(dimId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addBlacklistedDim(int dimId) {
|
||||
blacklistedDims.add(dimId);
|
||||
}
|
||||
|
||||
public static void addWhitelistedDim(int dimId) {
|
||||
whitelistedDims.add(dimId);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public final class Hive {
|
||||
}
|
||||
|
||||
public boolean isValidLocation(World world, BlockPos pos) {
|
||||
if(HiveConfig.isDimBlacklisted(world.provider.getDimension())) {
|
||||
if(!HiveConfig.isDimAllowed(world.provider.getDimension())) {
|
||||
return false;
|
||||
}
|
||||
return hiveDescription.getHiveGen().isValidLocation(world, pos);
|
||||
|
||||
@@ -55,8 +55,9 @@ public class TreeDecorator {
|
||||
}
|
||||
|
||||
public static void decorateTrees(World world, Random rand, int worldX, int worldZ) {
|
||||
if(Config.blacklistedTreeDims.contains(world.provider.getDimension()))
|
||||
if(!Config.isValidTreeDim(world.provider.getDimension())) {
|
||||
return;
|
||||
}
|
||||
if (biomeCache.isEmpty()) {
|
||||
generateBiomeCache(world, rand);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,14 @@ public class Config {
|
||||
public static boolean generateCopperOre = true;
|
||||
public static boolean generateTinOre = true;
|
||||
public static Set<Integer> blacklistedOreDims = new HashSet<Integer>();
|
||||
public static Set<Integer> whitelistedOreDims = new HashSet<Integer>();
|
||||
private static float generateBeehivesAmount = 1.0f;
|
||||
public static boolean generateBeehivesDebug = false;
|
||||
public static boolean logHivePlacement = false;
|
||||
public static boolean enableVillagers = true;
|
||||
public static boolean generateTrees = true;
|
||||
public static Set<Integer> blacklistedTreeDims = new HashSet<Integer>();
|
||||
public static Set<Integer> whitelistedTreeDims = new HashSet<Integer>();
|
||||
|
||||
// Retrogen
|
||||
public static boolean doRetrogen = false;
|
||||
@@ -163,9 +165,31 @@ public class Config {
|
||||
blacklistedTreeDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void whitelistTreeDim(int dimID) {
|
||||
whitelistedTreeDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void blacklistOreDim(int dimID) {
|
||||
blacklistedOreDims.add(dimID);
|
||||
}
|
||||
|
||||
public static void whitelistOreDim(int dimID) {
|
||||
whitelistedOreDims.add(dimID);
|
||||
}
|
||||
|
||||
public static boolean isValidOreDim(int dimID) { //blacklist has priority
|
||||
if(blacklistedOreDims.isEmpty() || !blacklistedOreDims.contains(dimID)) {
|
||||
return whitelistedOreDims.isEmpty() || whitelistedOreDims.contains(dimID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidTreeDim(int dimID) { //blacklist has priority
|
||||
if(blacklistedTreeDims.isEmpty() || !blacklistedTreeDims.contains(dimID)) {
|
||||
return whitelistedTreeDims.isEmpty() || whitelistedTreeDims.contains(dimID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void load(Side side) {
|
||||
File configCommonFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_COMMON + ".cfg");
|
||||
@@ -235,9 +259,12 @@ public class Config {
|
||||
generateApatiteOre = configCommon.getBooleanLocalized("world.generate.ore", "apatite", generateApatiteOre);
|
||||
generateCopperOre = configCommon.getBooleanLocalized("world.generate.ore", "copper", generateCopperOre);
|
||||
generateTinOre = configCommon.getBooleanLocalized("world.generate.ore", "tin", generateTinOre);
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()){
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()) {
|
||||
blacklistedOreDims.add(dimId);
|
||||
}
|
||||
for(int dimId : configCommon.get("world.generate.ore", "dimWhitelist", new int[0]).getIntList()) {
|
||||
whitelistedOreDims.add(dimId);
|
||||
}
|
||||
|
||||
enableVillagers = configCommon.getBooleanLocalized("world.generate", "villagers", enableVillagers);
|
||||
|
||||
@@ -245,6 +272,9 @@ public class Config {
|
||||
for(int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()){
|
||||
blacklistedTreeDims.add(dimId);
|
||||
}
|
||||
for(int dimId : configCommon.get("world.generate.trees", "dimWhitelist", new int[0]).getIntList()){
|
||||
whitelistedTreeDims.add(dimId);
|
||||
}
|
||||
|
||||
|
||||
craftingBronzeEnabled = configCommon.getBooleanLocalized("crafting", "bronze", craftingBronzeEnabled);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
}
|
||||
|
||||
private void generateWorld(Random random, int chunkX, int chunkZ, World world) {
|
||||
if(Config.blacklistedOreDims.contains(world.provider.getDimension()))
|
||||
if(!Config.isValidOreDim(world.provider.getDimension()))
|
||||
return;
|
||||
|
||||
if (apatiteGenerator == null || copperGenerator == null || tinGenerator == null) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import forestry.core.items.ItemRegistryCore;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.farming.logic.farmables.FarmableAgingCrop;
|
||||
import forestry.modules.ForestryModuleUids;
|
||||
import forestry.modules.ModuleManager;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ForestryModule(containerID = ForestryCompatPlugins.ID, moduleID = ForestryModuleUids.HARVESTCRAFT, name = "HarvestCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.module.harvestcraft.description")
|
||||
@@ -348,15 +349,17 @@ public class PluginHarvestCraft extends CompatPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(20, nut, Fluids.SEED_OIL.getFluid(15 * seedamount));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack hcHoneyItem = getItemStack("honeyitem");
|
||||
if (hcHoneyItem != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
|
||||
}
|
||||
|
||||
ItemStack hcBeeswaxItem = getItemStack("beeswaxitem");
|
||||
if (hcBeeswaxItem != null) {
|
||||
RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
|
||||
if(ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
|
||||
ItemStack hcHoneyItem = getItemStack("honeyitem");
|
||||
if (hcHoneyItem != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
|
||||
}
|
||||
|
||||
ItemStack hcBeeswaxItem = getItemStack("beeswaxitem");
|
||||
if (hcBeeswaxItem != null) {
|
||||
RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user