Compare commits

..
16 Commits
Author SHA1 Message Date
boubou19 a958073079 Merge pull request #11 from GTNewHorizons/patch-getblock-npe
Fix unprotected block access
2021-11-05 10:16:33 +01:00
Glease d4e58b84c8 Fix unprotected block access 2021-11-05 16:00:12 +08:00
Martin Robertz 689a822058 Merge pull request #10 from Flanisch/PamNetherCompat
Pams' Harvest The Nether Compatibility
2021-08-22 12:40:47 +02:00
BuildTools 0acbd6b247 Made MultiFarm typing crop specific 2021-08-21 14:02:23 +02:00
BuildTools d4206beba7 Add Pam's Harvest The Nether compatibility for MultiFarms 2021-08-21 04:01:34 +02:00
DreamMasterXXL 5412a73dc5 update api sub module 2021-08-14 15:37:31 +02:00
Martin Robertz dbd4246beb Merge pull request #9 from D-Cysteine/GTNH-Fixes
Update code to handle mutations with modified climate
2021-08-14 15:19:23 +02:00
D-Cysteine 6a205d71cc Remove incorrect IButterflyMutation change 2021-08-13 17:35:39 -06:00
Dream-MasterXXL ad50ab6716 update submodule Redstone flux use us repo fork 2021-08-12 15:41:13 +02:00
Dream-MasterXXL bb597e7403 update(Forestry API) use GTNH Fork 2021-08-12 15:35:35 +02:00
D-Cysteine 9614f95961 Fix import order 2021-08-11 23:58:10 -06:00
D-Cysteine ef0b5c7c1d Reset patch version 2021-08-11 23:28:12 -06:00
D-Cysteine 7e889775c1 Update code to handle mutations with modified climate 2021-08-11 23:25:56 -06:00
DreamMasterXXL 7ea1f150e0 add(Forestry)Changelog 2021-06-27 23:25:27 +02:00
Martin Robertz 4c7c7c3438 Merge pull request #8 from GTNewHorizons/worktable-npe
Fix NPE on crafting in worktable
2021-04-06 17:05:20 +02:00
Glease 621208393e Fix NPE on crafting in worktable 2021-04-06 22:46:39 +08:00
21 changed files with 213 additions and 24 deletions

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
url = https://github.com/GTNewHorizons/Forestry-Localization.git
[submodule "api/redstoneflux"]
path = api/redstoneflux
url = https://github.com/Texasjake95/RedstoneFlux-API.git
url=https://github.com/GTNewHorizons/RedstoneFlux-API.git
[submodule "api/forestry"]
path = api/forestry
url = https://github.com/ForestryMC/ForestryAPI.git
url=https://github.com/GTNewHorizons/ForestryAPI.git
+48
View File
@@ -0,0 +1,48 @@
# ForestryMC
Changelog of ForestryMC.
### [#8 Fix NPE on crafting in worktable](https://github.com/GTNewHorizons/ForestryMC/pull/8)
**Merge pull request #8 from GTNewHorizons/worktable-npe**
* Fix NPE on crafting in worktable
[4c7c7c34388aebd](https://github.com/GTNewHorizons/ForestryMC/commit/4c7c7c34388aebd)
by Martin Robertz *2021-04-06 15:05:20*
### No issue
**Fix NPE on crafting in worktable**
[621208393e64d97](https://github.com/GTNewHorizons/ForestryMC/commit/621208393e64d97)
by Glease *2021-04-06 14:46:39*
### [#6 Ic2 crop module](https://github.com/GTNewHorizons/ForestryMC/pull/6)
**Ic2 crop module (#6)**
* Added IC2-Crop-Module
* Changed Lang repo
* updated lang submodule
[d2545b7a5990cf2](https://github.com/GTNewHorizons/ForestryMC/commit/d2545b7a5990cf2)
by bartimaeusnek *2020-12-24 20:15:03*
### [#7 Dirty fix for BQ3 crafting quest not triggering](https://github.com/GTNewHorizons/ForestryMC/pull/7)
**Merge pull request #7 from GTNewHorizons/bq3_compat**
* Dirty fix for BQ3 crafting quest not triggering
[d0254997472c5be](https://github.com/GTNewHorizons/ForestryMC/commit/d0254997472c5be)
by Martin Robertz *2021-01-22 16:15:58*
### No issue
**bump version**
[98c0b66b6fbe598](https://github.com/GTNewHorizons/ForestryMC/commit/98c0b66b6fbe598)
by DreamMasterXXL *2021-01-29 19:11:09*
**Merge branch 'IC2-Crop-Module' into GTNH-Fixes**
[5b61261d69d541b](https://github.com/GTNewHorizons/ForestryMC/commit/5b61261d69d541b)
by DreamMasterXXL *2021-01-29 19:05:41*
**Dirty fix for BQ3 crafting quest not triggering**
[7320ddb44f63bfd](https://github.com/GTNewHorizons/ForestryMC/commit/7320ddb44f63bfd)
by Glease *2021-01-22 14:41:32*
+2 -2
View File
@@ -1,5 +1,5 @@
mcversion=1.7.10
forgeversion=10.13.4.1614-1.7.10
version_major=4
version_minor=3
version_patch=1
version_minor=4
version_patch=0
+2
View File
@@ -33,6 +33,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.Type;
import forestry.api.core.ForestryAPI;
import forestry.core.ClimateManager;
import forestry.core.EventHandlerCore;
import forestry.core.config.Config;
import forestry.core.config.Constants;
@@ -74,6 +75,7 @@ public class Forestry {
public Forestry() {
ForestryAPI.instance = this;
ForestryAPI.climateManager = new ClimateManager();
ForestryAPI.forestryConstants = new Constants();
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
EnumErrorCode.init();
@@ -191,6 +191,9 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
return false;
}
if (!world.blockExists(x, y, z))
return false;
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
if (acceptableFlower.isAcceptableFlower(flowerType, world, x, y, z)) {
@@ -42,7 +42,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
int y = housingCoordinates.posY;
int z = housingCoordinates.posZ;
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1, housing);
if (processedChance <= 0) {
return 0;
}
@@ -17,6 +17,7 @@ import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.ITreeMutationCustom;
import forestry.api.arboriculture.ITreeRoot;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.ForestryAPI;
import forestry.api.genetics.IAllele;
import forestry.core.genetics.mutations.Mutation;
@@ -33,7 +34,7 @@ public class TreeMutation extends Mutation implements ITreeMutationCustom {
@Override
public float getChance(World world, int x, int y, int z, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1) {
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
float processedChance = super.getChance(world, x, y, z, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, x, y, z));
if (processedChance <= 0) {
return 0;
}
@@ -23,6 +23,7 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import com.mojang.authlib.GameProfile;
@@ -39,6 +40,9 @@ import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.ITreekeepingMode;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IEffectData;
@@ -576,4 +580,19 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
ITree tree = getTree();
return !isDecorative && !isDestroyed(tree, damage) && caterpillar == null;
}
@Override
public BiomeGenBase getBiome() {
return worldObj.getBiomeGenForCoords(xCoord, zCoord);
}
@Override
public EnumTemperature getTemperature() {
return EnumTemperature.getFromBiome(getBiome(), xCoord, yCoord, zCoord);
}
@Override
public EnumHumidity getHumidity() {
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(worldObj, xCoord, yCoord, zCoord));
}
}
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.IClimateManager;
import forestry.api.core.IClimateProvider;
public class ClimateManager implements IClimateManager {
@Override
public float getTemperature(World world, int x, int y, int z) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
return biome.temperature;
}
@Override
public float getHumidity(World world, int x, int y, int z) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
return biome.rainfall;
}
@Override
public IClimateProvider getDefaultClimate(World world, int x, int y, int z) {
return new DefaultClimateProvider(world, x, y, z);
}
}
@@ -0,0 +1,36 @@
package forestry.core;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
import forestry.api.core.IClimateProvider;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class DefaultClimateProvider implements IClimateProvider {
private World world;
private int xCoord, yCoord, zCoord;
public DefaultClimateProvider(World world, int x, int y, int z) {
this.world = world;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
}
@Override
public BiomeGenBase getBiome() {
return world.getBiomeGenForCoords(xCoord, zCoord);
}
@Override
public EnumTemperature getTemperature() {
return EnumTemperature.getFromBiome(getBiome(), xCoord, yCoord, zCoord);
}
@Override
public EnumHumidity getHumidity() {
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(world, xCoord, yCoord, zCoord));
}
}
@@ -21,6 +21,7 @@ import net.minecraftforge.common.BiomeDictionary;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IGenome;
@@ -124,10 +125,10 @@ public abstract class Mutation implements IMutationCustom {
return this;
}
protected float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
protected float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
float mutationChance = chance;
for (IMutationCondition mutationCondition : mutationConditions) {
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1);
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
if (mutationChance == 0) {
return 0;
}
@@ -19,6 +19,7 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
@@ -33,8 +34,8 @@ public class MutationConditionBiome implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
BiomeGenBase biome = climate.getBiome();
for (BiomeDictionary.Type type : validBiomeTypes) {
if (BiomeDictionary.isBiomeOfType(biome, type)) {
return 1;
@@ -12,6 +12,7 @@ package forestry.core.genetics.mutations;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
@@ -26,7 +27,7 @@ public class MutationConditionDaytime implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (world.isDaytime() == daytime) {
return 1;
}
@@ -11,9 +11,9 @@
package forestry.core.genetics.mutations;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.EnumHumidity;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
@@ -30,9 +30,8 @@ public class MutationConditionHumidity implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(biome.rainfall);
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
EnumHumidity biomeHumidity = climate.getHumidity();
if (biomeHumidity.ordinal() < minHumidity.ordinal() || biomeHumidity.ordinal() > maxHumidity.ordinal()) {
return 0;
@@ -11,6 +11,7 @@
package forestry.core.genetics.mutations;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
@@ -18,6 +19,7 @@ import forestry.core.utils.BlockUtil;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -34,7 +36,7 @@ public class MutationConditionRequiresResource implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
/*
Block block;
TileEntity tile;
@@ -11,11 +11,13 @@
package forestry.core.genetics.mutations;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.StringUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -40,7 +42,7 @@ public class MutationConditionRequiresResourceOreDict implements IMutationCondit
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
/*
Block block;
int meta;
@@ -11,9 +11,9 @@
package forestry.core.genetics.mutations;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
@@ -31,9 +31,8 @@ public class MutationConditionTemperature implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome, x, y, z);
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
EnumTemperature biomeTemperature = climate.getTemperature();
if (biomeTemperature.ordinal() < minTemperature.ordinal() || biomeTemperature.ordinal() > maxTemperature.ordinal()) {
return 0;
@@ -14,6 +14,7 @@ import java.util.Calendar;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
@@ -31,7 +32,7 @@ public class MutationConditionTimeLimited implements IMutationCondition {
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
DayMonth now = new DayMonth();
// If we are equal to start day, return 1.
@@ -56,7 +56,7 @@ public class SlotCrafter extends SlotCrafting {
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack itemStack) {
if (!crafter.onCraftingStart(player)) {
if (itemStack == null || !crafter.onCraftingStart(player)) {
return;
}
@@ -39,6 +39,7 @@ import forestry.plugins.PluginManager;
public class PluginHarvestCraft extends ForestryPlugin {
private static final String HC = "harvestcraft";
private static final String HCN = "harvestthenether";
@Override
public boolean isAvailable() {
@@ -190,6 +191,17 @@ public class PluginHarvestCraft extends ForestryPlugin {
ImmutableList<String> genericCrops = genericCropsBuilder.build();
// Pam's Harvest The Nether Crops
ImmutableList.Builder<String> genericNetherCropsBuilder = ImmutableList.builder();
genericNetherCropsBuilder.add(
"glowflower",
"fleshroot",
"bloodleaf",
"marrowberry"
);
ImmutableList<String> genericNetherCrops = genericNetherCropsBuilder.build();
ImmutableList.Builder<String> plants = ImmutableList.builder();
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
@@ -309,6 +321,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
}
plants.add(cropName);
}
ItemStack mustardCropSeed = GameRegistry.findItemStack(HC, "mustard" + "seedItem", 1);
Block mustardCropBlock = GameRegistry.findBlock(HC, "pam" + "mustardseeds" + "Crop");
ItemStack mustardFruit = GameRegistry.findItemStack(HC, "mustard" + "seedsItem", 1);
@@ -366,6 +379,30 @@ public class PluginHarvestCraft extends ForestryPlugin {
if (hcBeeswaxItem != null) {
RecipeUtil.addRecipe(ForestryAPI.activeMode.getStackSetting("recipe.output.capsule"), "XXX ", 'X', hcBeeswaxItem);
}
// Recipe registering for Pam's Harvest the Nether
if (ModUtil.isModLoaded(HCN)) {
for (String netherCropName : genericNetherCrops) {
ItemStack genericNetherCropSeed = GameRegistry.findItemStack(HCN, netherCropName + "seedItem", 1);
Block genericNetherCropBlock = GameRegistry.findBlock(HCN, netherCropName + "Crop");
if (genericNetherCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{genericNetherCropSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && genericNetherCropSeed != null && genericNetherCropBlock != null) {
// Add all crops to orchard farms
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(genericNetherCropBlock, 7));
if (netherCropName == "glowflower") {
// Add glowflowers to managed and manual crop farms
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(genericNetherCropSeed, genericNetherCropBlock, 7));
} else {
// Add every other crop to infernal farms, since they only grow on soul sand
Farmables.farmables.get(FarmableReference.Infernal.get()).add(new FarmableGenericCrop(genericNetherCropSeed, genericNetherCropBlock, 7));
}
}
}
}
}
}