Compare commits

..
50 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
DreamMasterXXL 98c0b66b6f bump version 2021-01-29 20:11:09 +01:00
DreamMasterXXL 5b61261d69 Merge branch 'IC2-Crop-Module' into GTNH-Fixes 2021-01-29 20:05:41 +01:00
Martin Robertz d025499747 Merge pull request #7 from GTNewHorizons/bq3_compat
Dirty fix for BQ3 crafting quest not triggering
2021-01-22 17:15:58 +01:00
Glease 7320ddb44f Dirty fix for BQ3 crafting quest not triggering 2021-01-22 22:41:32 +08:00
bartimaeusnek d2545b7a59 Ic2 crop module (#6)
* Added IC2-Crop-Module

* Changed Lang repo

* updated lang submodule
2020-12-24 21:15:03 +01:00
bartimaeusnek 66d07bcac4 updated lang submodule 2020-10-14 13:26:11 +02:00
bartimaeusnek fb2eb7cda4 Changed Lang repo 2020-10-14 13:17:05 +02:00
bartimaeusnek 347fdb101c Added IC2-Crop-Module 2020-10-14 13:01:03 +02:00
DreamMasterXXL d2a086ac02 bump version 2020-05-10 14:01:46 +02:00
Glease 859a79a824 Actually remove the debug prints
GTNewHorizons/GT-New-Horizons-Modpack#6061
2020-05-10 18:53:18 +08:00
Dream-Master 00c31a6158 bump version 2020-03-27 21:27:04 +01:00
bartimaeusnek 5db5b712ce Fixed Mutation Coniditons (#5)
+ reduced usage of reflexion
+ inlined code

Signed-off-by: bartimaeusnek <[email protected]>
2020-03-27 14:12:42 +01:00
Dream-Master 9cac9a14df bump version 2020-03-23 22:29:01 +01:00
bartimaeusnek 43f98e9cca fixed method not found exception
wrong class for get Method call... i hate reflexion >_>
2020-03-23 17:18:25 +01:00
Dream-Master ff4c09324b update gradle 2020-03-23 13:57:14 +01:00
ElNounchandbartimaeusnek d1c17a13b1 BartWorks support for apiculture requirements (#4)
* BartWorks support for apiculture requirements

Co-authored-by: bartimaeusnek <[email protected]>
2020-03-22 15:03:20 +01:00
Jason Mitchell 8a8ac56266 bump version 2020-02-29 20:26:02 -08:00
Jason Mitchell 208de8ad3a Fix NPE 2020-02-29 20:23:52 -08:00
Dream-Master d988fb849d bump version 2020-02-16 12:53:28 +01:00
Martin Robertz ab83d90dd3 Merge pull request #3 from GTNewHorizons/limit_butterflies_distance_from_home
Backport butterflys staying close to home
2020-02-16 11:39:35 +01:00
Jason Mitchell 79c5cff926 Backport butterflys staying close to home from https://github.com/ForestryMC/ForestryMC/commit/904293f407c2e9ceeb35dcb9178ed505f361a0f3#diff-96a2a2f1a71177681853bd9c5eb46752 2020-02-15 21:31:55 -08:00
Martin Robertz 5522c33924 Merge pull request #2 from GTNewHorizons/feature/shiftlag
Feature/shiftlag
2019-12-14 21:00:39 +01:00
Richard Hendricks 93aa429cf2 Add config options, remove debug prints 2019-12-14 13:44:27 -06:00
Richard Hendricks fa5c4c0218 Remove isDirty related stuff, it causes stack overflows because it is not properly cleared when the craft is partial. Performance now should be good enough we don't even care about a few extra calls. 2019-12-14 02:04:02 -06:00
Richard Hendricks 32691c6af4 Add in local recipe cache 2019-12-13 17:41:58 -06:00
Richard Hendricks 5615ffc518 Recipelist acceleration is working. Worktable local cache needs creating. 2019-12-13 00:12:06 -06:00
Richard Hendricks 2af41cf68d not working 2019-12-12 20:16:58 -06:00
Richard Hendricks 0cdaf8cff8 Add new limiting crafting time function. 2019-12-09 22:07:26 -06:00
Dream-Master 7b5eafc42a update version 2019-05-12 20:32:50 +02:00
Martin Robertz 59ca1d2082 Merge pull request #1 from GTNewHorizons/giantSequoia
added recipe.
2019-05-09 09:46:14 +02:00
bartimaeusnek 0df88973c0 added recipe.
Signed-off-by: bartimaeusnek <[email protected]>
2019-05-09 06:35:23 +02:00
Dream-Master e54bb5d4ea change api path 2019-03-26 09:06:46 +01:00
Dream-Master 824f155804 change api adress 2019-03-26 09:01:05 +01:00
Dream-Master 24e2cf668e Revert "remove redstone flux not working api"
This reverts commit f260099bfa.
2019-03-26 08:55:47 +01:00
71 changed files with 832 additions and 374 deletions

No files matched your search

+5 -2
View File
@@ -1,6 +1,9 @@
[submodule "lang"]
path = lang
url = https://github.com/ForestryMC/Forestry-Localization.git
url = https://github.com/GTNewHorizons/Forestry-Localization.git
[submodule "api/redstoneflux"]
path = api/redstoneflux
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*
+1
Submodule api/redstoneflux added at b5771e4ef8.
+4
View File
@@ -257,3 +257,7 @@ def getBuildNumber() {
return "$System.env.BUILD_NUMBER" != "null" ? "$System.env.BUILD_NUMBER" : "0"
}
sourceSets {
main { output.resourcesDir = output.classesDir }
}
+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=2
version_patch=19
version_minor=4
version_patch=0
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014
#Sat Jan 04 01:52:14 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
+1 -1
Submodule lang updated: 4cfdcf1595...005c948875.
+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;
}
@@ -10,17 +10,19 @@
******************************************************************************/
package forestry.apiculture.genetics;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IJubilanceProvider;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IJubilanceProvider;
import forestry.core.utils.ItemStackUtil;
//import forestry.core.utils.ItemStackUtil;
public class JubilanceRequiresResource implements IJubilanceProvider {
@@ -34,6 +36,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates housingCoords = housing.getCoordinates();
/*
Block block;
TileEntity tile;
int meta;
@@ -46,6 +49,12 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
} while (tile instanceof IBeeHousing);
return ItemStackUtil.equals(block, meta, blockRequired);
*/
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, housingCoords.posX, housingCoords.posY, housingCoords.posZ,
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
return InventoryUtil.isItemEqual(blockRequired, stk, true, true); //ffs dont compare itemsstacks with equal >_> and why tf didnt i got this until i debugged it? im getting old..
}
}
@@ -21,6 +21,7 @@ import net.minecraft.world.gen.feature.WorldGenerator;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.util.ForgeDirection;
import forestry.api.arboriculture.EnumFruitFamily;
@@ -458,7 +459,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
@Override
protected void registerMutations() {
// only available by rare villager trade
registerMutation(Sequioa,Baobab,1).requireNight().restrictBiomeType(BiomeDictionary.Type.FOREST);
}
},
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.log, 1, 3)) {
@@ -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));
}
}
@@ -94,6 +94,7 @@ public abstract class Circuit implements ICircuit {
public static ICircuit farmGourdManual;
public static ICircuit farmCocoaManual;
public static ICircuit farmIC2CropsManual;
public static ICircuit farmOrchardManual;
public static ICircuit farmRubberManual;
public static ICircuit farmEnderManaged;
@@ -77,6 +77,12 @@ public class Config {
// Performance
public static boolean enableBackpackResupply = true;
// Optimization
public static boolean enableCraftingTimeout = true;
public static int craftingTimeout = 200; // Time given in ms
public static boolean cacheWorktableRecipes = true;
public static boolean promoteWorktableRecipesToFrontOfGlobalRecipemap = true;
// Customization
private static boolean craftingBronzeEnabled = true;
@@ -215,6 +221,11 @@ public class Config {
enableBackpackResupply = configCommon.getBooleanLocalized("performance", "backpacks.resupply", enableBackpackResupply);
enableCraftingTimeout = configCommon.getBooleanLocalized("optimization","enable.crafting.timeout", enableCraftingTimeout);
craftingTimeout = configCommon.getIntLocalized("optimization","crafting.timeout",craftingTimeout, 50, 2000 ); // min 50ms, default 200ms, max 2000 ms. Integer.MAX_VALUE is ~ 2100 ms because of multiplication by 1,000,000
cacheWorktableRecipes = configCommon.getBooleanLocalized("optimization","cache.worktable.recipes", cacheWorktableRecipes);
promoteWorktableRecipesToFrontOfGlobalRecipemap = configCommon.getBooleanLocalized("optimization","promote.worktable.recipes",promoteWorktableRecipesToFrontOfGlobalRecipemap);
// move legacy mail property
configCommon.moveProperty("tweaks.gui", "mail.alert", "tweaks.gui.mail.alert");
configCommon.renameProperty("tweaks.gui.mail.alert", "mail.alert", "enabled");
@@ -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;
@@ -10,17 +10,22 @@
******************************************************************************/
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.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;
import net.minecraft.world.World;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.StringUtil;
//import forestry.core.utils.ItemStackUtil;
public class MutationConditionRequiresResource implements IMutationCondition {
@@ -31,7 +36,8 @@ 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;
int meta;
@@ -44,6 +50,12 @@ public class MutationConditionRequiresResource implements IMutationCondition {
} while (tile instanceof IBeeHousing);
return ItemStackUtil.equals(block, meta, blockRequired) ? 1 : 0;
*/
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, x, y, z,
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
return InventoryUtil.isItemEqual(blockRequired, stk, true, true) ? 1 : 0;
}
@Override
@@ -10,21 +10,21 @@
******************************************************************************/
package forestry.core.genetics.mutations;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
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;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
public class MutationConditionRequiresResourceOreDict implements IMutationCondition {
private final int oreDictId;
@@ -42,7 +42,8 @@ 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;
TileEntity tile;
@@ -53,18 +54,20 @@ public class MutationConditionRequiresResourceOreDict implements IMutationCondit
tile = world.getTileEntity(x, y-i, z);
i++;
} while (tile instanceof IBeeHousing);
int[] oreIds = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
for (int oreId : oreIds) {
if (oreId == this.oreDictId) {
return 1;
}
}
return 0;
*/
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, x, y, z,
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
int[] oreIds = OreDictionary.getOreIDs(stk);
for (int oreId : oreIds)
if (oreId == this.oreDictId)
return 1f;
return 0f;
}
@Override
public String getDescription() {
return StringUtil.localizeAndFormat("mutation.condition.resource", displayName);
}
}
@@ -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.
@@ -1,133 +1,133 @@
/*******************************************************************************
* 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.gui;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimaps;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import forestry.core.gui.slots.SlotFilteredInventory;
import forestry.core.gui.slots.SlotForestry;
import forestry.core.gui.slots.SlotLocked;
import forestry.core.network.IForestryPacketClient;
import forestry.core.proxy.Proxies;
import forestry.core.utils.SlotUtil;
import invtweaks.api.container.ContainerSection;
import invtweaks.api.container.ContainerSectionCallback;
@invtweaks.api.container.ChestContainer(showButtons = false)
public abstract class ContainerForestry extends Container {
protected final void addPlayerInventory(InventoryPlayer playerInventory, int xInv, int yInv) {
// Player inventory
for (int row = 0; row < 3; row++) {
for (int column = 0; column < 9; column++) {
addSlotToContainer(new Slot(playerInventory, column + row * 9 + 9, xInv + column * 18, yInv + row * 18));
}
}
// Player hotbar
for (int column = 0; column < 9; column++) {
addHotbarSlot(playerInventory, column, xInv + column * 18, yInv + 58);
}
}
protected void addHotbarSlot(InventoryPlayer playerInventory, int slot, int x, int y) {
addSlotToContainer(new Slot(playerInventory, slot, x, y));
}
@Override
public Slot addSlotToContainer(Slot p_75146_1_) {
return super.addSlotToContainer(p_75146_1_);
}
@Override
public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) {
if (!canAccess(player)) {
return null;
}
if (modifier == 2 && button >= 0 && button < 9) {
// hotkey used to move item from slot to hotbar
int hotbarSlotIndex = 27 + button;
Slot hotbarSlot = getSlot(hotbarSlotIndex);
if (hotbarSlot instanceof SlotLocked) {
return null;
}
}
Slot slot = (slotIndex < 0) ? null : getSlot(slotIndex);
if (slot instanceof SlotForestry) {
SlotForestry slotForestry = (SlotForestry) slot;
if (slotForestry.isPhantom()) {
return SlotUtil.slotClickPhantom(slotForestry, button, modifier, player);
}
}
return super.slotClick(slotIndex, button, modifier, player);
}
@Override
public final ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
if (!canAccess(player)) {
return null;
}
return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex);
}
protected abstract boolean canAccess(EntityPlayer player);
protected final void sendPacketToCrafters(IForestryPacketClient packet) {
for (Object crafter : crafters) {
if (crafter instanceof EntityPlayer) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) crafter);
}
}
}
@SuppressWarnings("unused") // inventory tweaks
@ContainerSectionCallback
public Map<ContainerSection, List<Slot>> getContainerSections() {
ArrayListMultimap<ContainerSection, Slot> map = ArrayListMultimap.create();
for (Object object : inventorySlots) {
if (!(object instanceof Slot)) {
continue;
}
Slot slot = (Slot) object;
if (slot.inventory instanceof InventoryPlayer) {
map.put(ContainerSection.INVENTORY, slot);
if (slot.slotNumber < 9) {
map.put(ContainerSection.INVENTORY_HOTBAR, slot);
} else if (slot.slotNumber < 36) {
map.put(ContainerSection.INVENTORY_NOT_HOTBAR, slot);
} else {
map.put(ContainerSection.ARMOR, slot);
}
} else {
if (!(slot instanceof SlotForestry) || slot instanceof SlotFilteredInventory) {
map.put(ContainerSection.CHEST, slot);
}
}
}
return Multimaps.asMap(map);
}
}
/*******************************************************************************
* 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.gui;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimaps;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import forestry.core.gui.slots.SlotFilteredInventory;
import forestry.core.gui.slots.SlotForestry;
import forestry.core.gui.slots.SlotLocked;
import forestry.core.network.IForestryPacketClient;
import forestry.core.proxy.Proxies;
import forestry.core.utils.SlotUtil;
import invtweaks.api.container.ContainerSection;
import invtweaks.api.container.ContainerSectionCallback;
@invtweaks.api.container.ChestContainer(showButtons = false)
public abstract class ContainerForestry extends Container {
protected final void addPlayerInventory(InventoryPlayer playerInventory, int xInv, int yInv) {
// Player inventory
for (int row = 0; row < 3; row++) {
for (int column = 0; column < 9; column++) {
addSlotToContainer(new Slot(playerInventory, column + row * 9 + 9, xInv + column * 18, yInv + row * 18));
}
}
// Player hotbar
for (int column = 0; column < 9; column++) {
addHotbarSlot(playerInventory, column, xInv + column * 18, yInv + 58);
}
}
protected void addHotbarSlot(InventoryPlayer playerInventory, int slot, int x, int y) {
addSlotToContainer(new Slot(playerInventory, slot, x, y));
}
@Override
public Slot addSlotToContainer(Slot p_75146_1_) {
return super.addSlotToContainer(p_75146_1_);
}
@Override
public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) {
if (!canAccess(player)) {
return null;
}
if (modifier == 2 && button >= 0 && button < 9) {
// hotkey used to move item from slot to hotbar
int hotbarSlotIndex = 27 + button;
Slot hotbarSlot = getSlot(hotbarSlotIndex);
if (hotbarSlot instanceof SlotLocked) {
return null;
}
}
Slot slot = (slotIndex < 0) ? null : getSlot(slotIndex);
if (slot instanceof SlotForestry) {
SlotForestry slotForestry = (SlotForestry) slot;
if (slotForestry.isPhantom()) {
return SlotUtil.slotClickPhantom(slotForestry, button, modifier, player);
}
}
return super.slotClick(slotIndex, button, modifier, player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
if (!canAccess(player)) {
return null;
}
return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex);
}
protected abstract boolean canAccess(EntityPlayer player);
protected final void sendPacketToCrafters(IForestryPacketClient packet) {
for (Object crafter : crafters) {
if (crafter instanceof EntityPlayer) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) crafter);
}
}
}
@SuppressWarnings("unused") // inventory tweaks
@ContainerSectionCallback
public Map<ContainerSection, List<Slot>> getContainerSections() {
ArrayListMultimap<ContainerSection, Slot> map = ArrayListMultimap.create();
for (Object object : inventorySlots) {
if (!(object instanceof Slot)) {
continue;
}
Slot slot = (Slot) object;
if (slot.inventory instanceof InventoryPlayer) {
map.put(ContainerSection.INVENTORY, slot);
if (slot.slotNumber < 9) {
map.put(ContainerSection.INVENTORY_HOTBAR, slot);
} else if (slot.slotNumber < 36) {
map.put(ContainerSection.INVENTORY_NOT_HOTBAR, slot);
} else {
map.put(ContainerSection.ARMOR, slot);
}
} else {
if (!(slot instanceof SlotForestry) || slot instanceof SlotFilteredInventory) {
map.put(ContainerSection.CHEST, slot);
}
}
}
return Multimaps.asMap(map);
}
}
@@ -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;
}
@@ -10,6 +10,12 @@
******************************************************************************/
package forestry.core.items;
import forestry.api.recipes.RecipeManagers;
import forestry.core.fluids.Fluids;
import forestry.core.recipes.RecipeUtil;
import forestry.plugins.PluginCore;
import net.minecraft.item.ItemStack;
import java.awt.Color;
public enum EnumElectronTube implements ItemOverlay.IOverlayInfo {
@@ -25,7 +31,8 @@ public enum EnumElectronTube implements ItemOverlay.IOverlayInfo {
EMERALD(new Color(0x00CC41)),
APATITE(new Color(0x579CD9)),
LAPIS(new Color(0x1c57c6)),
ENDER(new Color(0x33adad), new Color(0x255661));
ENDER(new Color(0x33adad), new Color(0x255661)),
URANIUM(new Color(0xFF00CC41), new Color(0x33adad));
public static final EnumElectronTube[] VALUES = values();
@@ -62,4 +69,18 @@ public enum EnumElectronTube implements ItemOverlay.IOverlayInfo {
public boolean isSecret() {
return false;
}
public void registerTubeRecipe(ItemStack stack) {
if (stack != null){
for (Object stackOreDict : RecipeUtil.getOreDictRecipeEquivalents(stack)) {
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), PluginCore.items.tubes.get(this, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', stackOreDict});
}
}
}
public void registerTubeRecipe(String stack) {
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), PluginCore.items.tubes.get(this, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', stack});
}
}
@@ -84,6 +84,8 @@ public class ItemOverlay extends ItemForestry {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int i, int j) {
if (i < 0 || i >= overlays.length)
return null;
if (j > 0 && overlays[i].getSecondaryColor() != 0) {
return secondaryIcon;
} else {
@@ -93,7 +95,7 @@ public class ItemOverlay extends ItemForestry {
@Override
public int getRenderPasses(int metadata) {
return overlays[metadata].getSecondaryColor() != 0 ? 2 : 1;
return metadata < 0 || metadata >= overlays.length ? 0 : overlays[metadata].getSecondaryColor() != 0 ? 2 : 1;
}
@Override
@@ -112,6 +114,8 @@ public class ItemOverlay extends ItemForestry {
@Override
public int getColorFromItemStack(ItemStack itemstack, int j) {
if (itemstack.getItemDamage() < 0 || itemstack.getItemDamage() >= overlays.length)
return 0;
IOverlayInfo overlayInfo = overlays[itemstack.getItemDamage()];
if (j == 0 || overlayInfo.getSecondaryColor() == 0) {
return overlayInfo.getPrimaryColor();
@@ -30,13 +30,14 @@ import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Config;
import forestry.core.fluids.Fluids;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.factory.inventory.InventoryCraftingForestry;
public abstract class RecipeUtil {
static List<Object> cachedRecipes = new ArrayList<Object>();
public static void addFermenterRecipes(ItemStack resource, int fermentationValue, Fluids output) {
if (RecipeManagers.fermenterManager == null) {
return;
@@ -58,7 +59,7 @@ public abstract class RecipeUtil {
* Returns a list containing itemStack if there are no ore dictionary names.
* Used for creating recipes that should accept equivalent itemStacks, based on the ore dictionary.
*/
public static List getOreDictRecipeEquivalents(ItemStack itemStack) {
public static List<?> getOreDictRecipeEquivalents(ItemStack itemStack) {
int[] oreDictIds = OreDictionary.getOreIDs(itemStack);
List<String> oreDictNames = new ArrayList<>(oreDictIds.length);
for (int oreId : oreDictIds) {
@@ -99,7 +100,6 @@ public abstract class RecipeUtil {
if (ItemStackUtil.containsSets(recipeItems, availableItems, true, true) == 0) {
return null;
}
// Check that it doesn't make a different recipe.
// For example:
// Wood Logs are all ore dictionary equivalent with each other,
@@ -140,7 +140,6 @@ public abstract class RecipeUtil {
}
}
}
List<ItemStack> outputs = findMatchingRecipes(crafting, world);
if (!ItemStackUtil.containsItemStack(outputs, recipeOutput)) {
return null;
@@ -155,7 +154,29 @@ public abstract class RecipeUtil {
}
List<ItemStack> matchingRecipes = new ArrayList<>();
List<Integer> matchingIndex=new ArrayList();
List<Object> matchingRecipeMap = new ArrayList();
int index = 0;
if(Config.cacheWorktableRecipes) {
// Check across the whole cached recipe map
// Add each recipe to the matchingRecipes list
for (Object recipe : cachedRecipes) {
IRecipe irecipe = (IRecipe) recipe;
if (irecipe.matches(inventory, world)) {
ItemStack result = irecipe.getCraftingResult(inventory);
if (!ItemStackUtil.containsItemStack(matchingRecipes, result)) {
matchingRecipes.add(result);
}
}
}
if( matchingRecipes.size() > 0 ) {
// If we found recipes here, we found all the potential recipes, so we can just return immediately.
return matchingRecipes;
}
}
// Only do this if there were no cached recipes hit
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
IRecipe irecipe = (IRecipe) recipe;
@@ -163,10 +184,39 @@ public abstract class RecipeUtil {
ItemStack result = irecipe.getCraftingResult(inventory);
if (!ItemStackUtil.containsItemStack(matchingRecipes, result)) {
matchingRecipes.add(result);
if(Config.promoteWorktableRecipesToFrontOfGlobalRecipemap || Config.cacheWorktableRecipes) {
// Add to the back of the list. That way when we cycle through the list
// moving items to the front, the index locations for the following items doesn't change
matchingRecipeMap.add(recipe);
matchingIndex.add(new Integer(index));
}
}
}
index++;
}
if (matchingRecipeMap.size() > 0 )
{
if (Config.promoteWorktableRecipesToFrontOfGlobalRecipemap) {
// Only move the recipes if the last one was beyond 500 in the recipeMap (in GTNH about 57k recipes)
if (matchingIndex.get(matchingIndex.size()-1) > 500) {
List recipeMap = CraftingManager.getInstance().getRecipeList();
// System.out.println( "Highest recipe found at " + matchingIndex.get(matchingIndex.size()-1) + ", moving " + matchingIndex.size() + " to front" );
// System.out.println( "Size of recipe map " + recipeMap.size() );
for (index = 0; index < matchingIndex.size(); index++) { // index is reused here, it goes through the matching groups.
// Remove recipe and add back at the front
int target = matchingIndex.get(index); // remove requires int
// System.out.println("Removing recipe at " + target);
recipeMap.remove(target);
recipeMap.add(0,matchingRecipeMap.get(index));
}
}
}
if(Config.cacheWorktableRecipes) {
// However, we should always add found recipes the cached recipe map
// Location doesn't matter since we have to scan the whole cached recipe map anyways.
cachedRecipes.addAll(matchingRecipeMap);
}
}
return matchingRecipes;
}
@@ -10,8 +10,12 @@
******************************************************************************/
package forestry.core.utils;
import java.util.ArrayList;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.Loader;
import forestry.core.config.Constants;
import forestry.core.tiles.TileEngine;
import forestry.core.utils.vect.Vect;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockLog;
@@ -22,16 +26,13 @@ import net.minecraft.util.Direction;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import forestry.core.config.Constants;
import forestry.core.tiles.TileEngine;
import forestry.core.utils.vect.Vect;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyReceiver;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.function.Predicate;
public abstract class BlockUtil {
@@ -228,4 +229,35 @@ public abstract class BlockUtil {
private static boolean isVecInsideXYBounds(Vec3 vec, float minX, float minY, float maxX, float maxY) {
return vec != null && (vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY);
}
}
private static Class<? extends Block> BW_MetaGenerated_WerkstoffBlocksClass;
private static Block BWBlocks;
private static boolean bw = Loader.isModLoaded("bartworks");
static {
if (bw)
try {
BW_MetaGenerated_WerkstoffBlocksClass = (Class<? extends Block>) Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_WerkstoffBlocks");
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader").getField("BWBlocks").get(null);
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
public static ItemStack getItemStackFromBlockBelow(World world, int x, int y, int z, Predicate<TileEntity> stillInside) {
TileEntity tile;
Block block;
int depth = 0;
do {
++depth;
tile = world.getTileEntity(x, y - depth, z);
} while (stillInside.test(tile));
block = world.getBlock(x, y - depth, z);
if (bw && BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) {
return new ItemStack(BWBlocks, 1, block.getDamageValue(world, x, y - depth, z));
}
return new ItemStack(block, 1, world.getBlockMetadata(x, y - depth, z));
}
}
@@ -105,10 +105,7 @@ public abstract class InventoryUtil {
if (a.getItemDamage() != b.getItemDamage()) {
return false;
}
if (a.stackTagCompound != null && !a.stackTagCompound.equals(b.stackTagCompound)) {
return false;
}
return true;
return a.stackTagCompound == null || a.stackTagCompound.equals(b.stackTagCompound);
}
/**
@@ -137,9 +134,7 @@ public abstract class InventoryUtil {
if (isWildcard(a) || isWildcard(b)) {
return true;
}
if (a.getItemDamage() != b.getItemDamage()) {
return false;
}
return a.getItemDamage() == b.getItemDamage();
}
return true;
}
@@ -157,8 +157,8 @@ public abstract class ItemStackUtil {
int reqCount = 0;
for (ItemStack offer : condensedOffered) {
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (matchTags ? ItemStack.areItemStackTagsEqual(req, offer) : true)) {
int stackCount = (int) Math.floor(offer.stackSize / req.stackSize);
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (!matchTags || ItemStack.areItemStackTagsEqual(req, offer))) {
int stackCount = (int) Math.floor( (float) offer.stackSize / (float) req.stackSize);
reqCount = Math.max(reqCount, stackCount);
}
}
@@ -316,7 +316,7 @@ public abstract class ItemStackUtil {
public static ItemStack copyWithRandomSize(ItemStack template, int max, Random rand) {
int size = rand.nextInt(max);
ItemStack created = template.copy();
created.stackSize = size <= 0 ? 1 : size > created.getMaxStackSize() ? created.getMaxStackSize() : size;
created.stackSize = size <= 0 ? 1 : Math.min(size, created.getMaxStackSize());
return created;
}
@@ -35,9 +35,7 @@ public abstract class ModUtil {
VersionRange versionRange = VersionParser.parseRange(versionRangeString);
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(modname, versionRange);
if (!requiredVersion.containsVersion(modVersion)) {
return false;
}
return requiredVersion.containsVersion(modVersion);
}
return true;
@@ -69,9 +67,7 @@ public abstract class ModUtil {
DefaultArtifactVersion givenVersion = new DefaultArtifactVersion(apiName, apiVersionString);
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(apiName, versionRange);
if (!requiredVersion.containsVersion(givenVersion)) {
return false;
}
return requiredVersion.containsVersion(givenVersion);
}
return true;
@@ -265,6 +265,7 @@ public abstract class SlotUtil {
// if mergeOnly = true, don't shift into empty slots.
private static boolean shiftToMachineInventory(List inventorySlots, ItemStack stackToShift, int numSlots, boolean mergeOnly) {
for (int machineIndex = playerInventorySize; machineIndex < numSlots; machineIndex++) {
// System.out.println("SlotUtil::shiftToMachineinventory");
Slot slot = (Slot) inventorySlots.get(machineIndex);
if (mergeOnly && slot.getStack() == null) {
continue;
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.factory.gui;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import forestry.core.utils.Log;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
@@ -32,7 +34,39 @@ import forestry.factory.network.packets.PacketWorktableRecipeUpdate;
import forestry.factory.recipes.RecipeMemory;
import forestry.factory.tiles.TileWorktable;
import java.lang.reflect.Method;
public class ContainerWorktable extends ContainerTile<TileWorktable> implements IContainerCrafting, IGuiSelectable {
private static final Method craftingEventHandler;
private static final Object craftingEventHandlerInstance;
static {
Object instance;
Method method;
try {
final Class<?> clazz = Class.forName("bq_standard.handlers.EventHandler");
method = clazz.getMethod("onItemCrafted", PlayerEvent.ItemCraftedEvent.class);
method.setAccessible(true);
instance = clazz.getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
method = null;
instance = null;
}
if (instance != null)
Log.fine("BetterQuesting 3 Standard Expansion crafting quest compat enabled.");
craftingEventHandlerInstance = instance;
craftingEventHandler = method;
}
private static void callBQCraftingHandler(PlayerEvent.ItemCraftedEvent event) {
if (craftingEventHandler != null) {
try {
craftingEventHandler.invoke(craftingEventHandlerInstance, event);
} catch (ReflectiveOperationException e) {
Log.logThrowable("Error calling BQ3 crafting event handler", e);
}
}
}
private final InventoryCraftingForestry craftMatrix = new InventoryCraftingForestry(this);
private long lastMemoryUpdate;
private boolean craftMatrixChanged = false;
@@ -119,6 +153,20 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
Proxies.net.sendToServer(new PacketGuiSelectRequest(mouseButton, recipeIndex));
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
final ItemStack transferred = super.transferStackInSlot(player, slotIndex);
if (!player.worldObj.isRemote) {
final Object o = inventorySlots.get(slotIndex);
if (o instanceof SlotCrafter) {
// use the ghost crafting matrix instead of actual crafting matrix
// so BQ3 won't do a lookup again later on
callBQCraftingHandler(new PlayerEvent.ItemCraftedEvent(player, transferred, ((SlotCrafter) o).inventory));
}
}
return transferred;
}
@Override
public void handleSelectionRequest(EntityPlayerMP player, PacketGuiSelectRequest packet) {
int primary = packet.getPrimaryIndex();
@@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import forestry.core.config.Config;
import forestry.core.inventory.InventoryAdapterTile;
import forestry.core.inventory.wrappers.InventoryMapper;
import forestry.core.network.DataInputStreamForestry;
@@ -41,7 +42,9 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
private final RecipeMemory recipeMemory;
private final InventoryAdapterTile craftingDisplay;
private MemorizedRecipe currentRecipe;
private long savedTick = 0;
private long savedSystemTimeExpiration = 0;
public TileWorktable() {
super("worktable");
setInternalInventory(new InventoryWorktable(this));
@@ -121,10 +124,27 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
return false;
}
if( Config.enableCraftingTimeout ) {
long currentTick = worldObj.getTotalWorldTime();
if (currentTick == savedTick){
// Processing in the same tick, second call, check expiration timer
long currentTime = System.nanoTime();
if(currentTime > savedSystemTimeExpiration) {
// Time to craft has expired, stop crafting loop
return false;
}
} else {
// New tick has arrived, so reset timer data
savedTick=currentTick;
savedSystemTimeExpiration = System.nanoTime() + Config.craftingTimeout * 1000000;
}
}
ItemStack[] recipeItems = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
ItemStack[] inventory = InventoryUtil.getStacks(this);
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(recipeItems, inventory, worldObj, currentRecipe.getRecipeOutput());
return crafting != null;
return crafting != null;
}
@Override
@@ -147,7 +167,6 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
if (removed == null) {
return false;
}
// update crafting display to match the ingredients that were actually used
setCraftingDisplay(crafting);
return true;
@@ -47,7 +47,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
}
public FarmLogicArboreal(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.dirt), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get("farmArboreal"));
super(housing, new ItemStack(Blocks.dirt), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get(FarmableReference.Arboreal.get()));
}
@Override
@@ -22,7 +22,7 @@ import forestry.api.farming.IFarmHousing;
public class FarmLogicCereal extends FarmLogicCrops {
public FarmLogicCereal(IFarmHousing housing) {
super(housing, Farmables.farmables.get("farmWheat"));
super(housing, Farmables.farmables.get(FarmableReference.Wheat.get()));
}
@Override
@@ -34,7 +34,7 @@ import forestry.core.utils.vect.VectUtil;
public class FarmLogicEnder extends FarmLogicHomogeneous {
public FarmLogicEnder(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.end_stone), new ItemStack(Blocks.end_stone), Farmables.farmables.get("farmEnder"));
super(housing, new ItemStack(Blocks.end_stone), new ItemStack(Blocks.end_stone), Farmables.farmables.get(FarmableReference.Ender.get()));
}
@Override
@@ -34,7 +34,7 @@ public class FarmLogicGourd extends FarmLogic {
public FarmLogicGourd(IFarmHousing housing) {
super(housing);
Collection<IFarmable> farmables = Farmables.farmables.get("farmGourd");
Collection<IFarmable> farmables = Farmables.farmables.get(FarmableReference.Gourd.get());
seeds = farmables.toArray(new IFarmable[farmables.size()]);
}
@@ -0,0 +1,22 @@
/*******************************************************************************
* 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.farming.logic;
import forestry.api.farming.Farmables;
import forestry.api.farming.IFarmHousing;
//TODO: Make special Logic for Crops, maybe a virtual map of references to iterate faster?
public class FarmLogicIC2Crops extends FarmLogicOrchard {
public FarmLogicIC2Crops(IFarmHousing housing) {
super(housing);
this.farmables = Farmables.farmables.get(FarmableReference.IC2Crops.get());
}
}
@@ -34,7 +34,7 @@ import forestry.core.utils.vect.VectUtil;
public class FarmLogicInfernal extends FarmLogicHomogeneous {
public FarmLogicInfernal(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand), Farmables.farmables.get("farmInfernal"));
super(housing, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand), Farmables.farmables.get(FarmableReference.Infernal.get()));
}
@Override
@@ -44,13 +44,13 @@ import forestry.plugins.PluginManager;
public class FarmLogicOrchard extends FarmLogic {
private final Collection<IFarmable> farmables;
private final HashMap<Vect, Integer> lastExtents = new HashMap<>();
private final ImmutableList<Block> traversalBlocks;
protected Collection<IFarmable> farmables;
protected final HashMap<Vect, Integer> lastExtents = new HashMap<>();
protected final ImmutableList<Block> traversalBlocks;
public FarmLogicOrchard(IFarmHousing housing) {
super(housing);
this.farmables = Farmables.farmables.get("farmOrchard");
this.farmables = Farmables.farmables.get(FarmableReference.Orchard.get());
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
if (PluginManager.Module.AGRICRAFT.isEnabled() || PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
@@ -36,7 +36,7 @@ public class FarmLogicReeds extends FarmLogic {
public FarmLogicReeds(IFarmHousing housing) {
super(housing);
Collection<IFarmable> farmables = Farmables.farmables.get("farmPoales");
Collection<IFarmable> farmables = Farmables.farmables.get(FarmableReference.Poales.get());
germlings = farmables.toArray(new IFarmable[farmables.size()]);
}
@@ -26,7 +26,7 @@ import forestry.api.farming.IFarmHousing;
public class FarmLogicShroom extends FarmLogicArboreal {
public FarmLogicShroom(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.mycelium), new ItemStack(Blocks.mycelium), Farmables.farmables.get("farmShroom"));
super(housing, new ItemStack(Blocks.mycelium), new ItemStack(Blocks.mycelium), Farmables.farmables.get(FarmableReference.Shroom.get()));
}
@Override
@@ -36,7 +36,7 @@ public class FarmLogicSucculent extends FarmLogic {
public FarmLogicSucculent(IFarmHousing housing) {
super(housing);
Collection<IFarmable> farmables = Farmables.farmables.get("farmSucculentes");
Collection<IFarmable> farmables = Farmables.farmables.get(FarmableReference.Succulentes.get());
germlings = farmables.toArray(new IFarmable[farmables.size()]);
}
@@ -22,7 +22,7 @@ import forestry.api.farming.IFarmHousing;
public class FarmLogicVegetable extends FarmLogicCrops {
public FarmLogicVegetable(IFarmHousing housing) {
super(housing, Farmables.farmables.get("farmVegetables"));
super(housing, Farmables.farmables.get(FarmableReference.Vegetables.get()));
}
@Override
@@ -0,0 +1,39 @@
/*******************************************************************************
* 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.farming.logic;
public enum FarmableReference {
Arboreal,
Wheat,
Cocoa,
Ender,
Gourd,
IC2Crops,
Infernal,
Orchard,
Poales,
Rubber,
Shroom,
Succulentes,
Vegetables,
;
private final String VALUE;
public String get() {
return VALUE;
}
FarmableReference() {
VALUE = "farm" + this.name();
}
}
@@ -28,7 +28,7 @@ public class ButterflySpawner implements ILeafTickHandler {
if (world.rand.nextFloat() >= tree.getGenome().getSappiness() * tree.getGenome().getYield()) {
return false;
}
IButterfly spawn = ButterflyManager.butterflyRoot.getIndividualTemplates().get(world.rand.nextInt(ButterflyManager.butterflyRoot.getIndividualTemplates().size()));
if (world.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) {
return false;
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
@@ -69,6 +70,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
public static final int EXHAUSTION_REST = 1000;
public static final int EXHAUSTION_CONSUMPTION = 100 * EXHAUSTION_REST;
public static final int MAX_LIFESPAN = 24000 * 7; // one minecraft week in ticks
private int maximumHomeDistance = 64;
private Vec3 flightTarget;
private int exhaustion;
@@ -89,10 +91,11 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
setDefaults();
}
public EntityButterfly(World world, IButterfly butterfly) {
public EntityButterfly(World world, IButterfly butterfly, int x, int y, int z) {
super(world);
setDefaults();
setIndividual(butterfly);
setHomeArea(x, y, z, maximumHomeDistance);
}
@Override
@@ -124,7 +127,9 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
super.writeEntityToNBT(nbttagcompound);
NBTTagCompound bio = new NBTTagCompound();
contained.writeToNBT(bio);
if (contained != null)
contained.writeToNBT(bio);
nbttagcompound.setTag("BTFLY", bio);
if (pollen != null) {
@@ -194,6 +199,13 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
@Override
public float getBlockPathWeight(int x, int y, int z) {
float weight = 0.0f;
final ChunkCoordinates home = getHomePosition();
double distanceToHome = home.getDistanceSquared(x, y, z);
if(!isWithinHomeDistanceFromPosition(distanceToHome)){
weight -= 7.5f + 0.005 * (distanceToHome / 4);
}
if (!getButterfly().isAcceptedEnvironment(worldObj, x, y, z)) {
weight -= 15.0f;
@@ -232,6 +244,10 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
return weight;
}
private boolean isWithinHomeDistanceFromPosition(double distanceToHome) {
return distanceToHome < (maximumHomeDistance * maximumHomeDistance);
}
private int getFluidDepth(int x, int z) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x, z);
int xx = x & 15;
@@ -149,7 +149,7 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot {
@Override
public EntityButterfly spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z) {
return EntityUtil.spawnEntity(world, new EntityButterfly(world, butterfly), x, y, z);
return EntityUtil.spawnEntity(world, new EntityButterfly(world, butterfly, (int)x, (int)y, (int)z), x, y, z);
}
@Override
@@ -133,7 +133,7 @@ public class ItemButterflyGE extends ItemGE {
return false;
}
if (EntityUtil.spawnEntity(entityItem.worldObj, new EntityButterfly(entityItem.worldObj, butterfly), entityItem.posX, entityItem.posY, entityItem.posZ) != null) {
if (EntityUtil.spawnEntity(entityItem.worldObj, new EntityButterfly(entityItem.worldObj, butterfly, (int)entityItem.posX, (int)entityItem.posY, (int)entityItem.posZ), entityItem.posX, entityItem.posY, entityItem.posZ) != null) {
if (entityItem.getEntityItem().stackSize > 1) {
entityItem.getEntityItem().stackSize--;
} else {
@@ -81,7 +81,7 @@ public class RenderButterflyItem implements IItemRenderer {
}
if (entity == null) {
entity = new EntityButterfly(Proxies.common.getRenderWorld(), butterfly);
entity = new EntityButterfly(Proxies.common.getRenderWorld(), butterfly, 0, 0, 0);
} else {
entity.setIndividual(butterfly);
}
@@ -227,29 +227,18 @@ public class PluginFactory extends ForestryPlugin {
// / FABRICATOR
ItemElectronTube electronTube = PluginCore.items.tubes;
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.COPPER, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "ingotCopper"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.TIN, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "ingotTin"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.BRONZE, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "ingotBronze"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.IRON, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "ingotIron"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.GOLD, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "ingotGold"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.DIAMOND, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemDiamond"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.OBSIDIAN, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Blocks.obsidian});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.BLAZE, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Items.blaze_powder});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.EMERALD, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemEmerald"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.APATITE, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemApatite"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.LAPIS, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', new ItemStack(Items.dye, 1, 4)});
EnumElectronTube.COPPER.registerTubeRecipe("ingotCopper");
EnumElectronTube.BRONZE.registerTubeRecipe("ingotBronze");
EnumElectronTube.TIN.registerTubeRecipe("ingotTin");
EnumElectronTube.IRON.registerTubeRecipe("ingotIron");
EnumElectronTube.GOLD.registerTubeRecipe("ingotGold");
EnumElectronTube.DIAMOND.registerTubeRecipe("gemDiamond");
EnumElectronTube.OBSIDIAN.registerTubeRecipe(new ItemStack(Blocks.obsidian));
EnumElectronTube.BLAZE.registerTubeRecipe(new ItemStack(Items.blaze_powder));
EnumElectronTube.EMERALD.registerTubeRecipe("gemEmerald");
EnumElectronTube.APATITE.registerTubeRecipe("gemApatite");
EnumElectronTube.LAPIS.registerTubeRecipe("gemLapis");
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.ENDER, 4),
new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ender_eye, 1, 0), 'X', new ItemStack(Blocks.end_stone, 1, 0)});
@@ -16,6 +16,7 @@ import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import forestry.farming.logic.*;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -42,25 +43,6 @@ import forestry.core.utils.Log;
import forestry.farming.blocks.BlockFarmType;
import forestry.farming.blocks.BlockRegistryFarming;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicArboreal;
import forestry.farming.logic.FarmLogicCereal;
import forestry.farming.logic.FarmLogicCocoa;
import forestry.farming.logic.FarmLogicGourd;
import forestry.farming.logic.FarmLogicInfernal;
import forestry.farming.logic.FarmLogicOrchard;
import forestry.farming.logic.FarmLogicPeat;
import forestry.farming.logic.FarmLogicReeds;
import forestry.farming.logic.FarmLogicShroom;
import forestry.farming.logic.FarmLogicSucculent;
import forestry.farming.logic.FarmLogicVegetable;
import forestry.farming.logic.FarmableBasicFruit;
import forestry.farming.logic.FarmableGE;
import forestry.farming.logic.FarmableGenericCrop;
import forestry.farming.logic.FarmableGenericSapling;
import forestry.farming.logic.FarmableGourd;
import forestry.farming.logic.FarmableStacked;
import forestry.farming.logic.FarmableVanillaMushroom;
import forestry.farming.logic.FarmableVanillaSapling;
import forestry.farming.proxy.ProxyFarming;
import forestry.farming.render.EnumFarmBlockTexture;
import forestry.farming.tiles.TileFarmControl;
@@ -87,42 +69,41 @@ public class PluginFarming extends ForestryPlugin {
@Override
public void preInit() {
super.preInit();
Farmables.farmables.put("farmArboreal", new ArrayList<IFarmable>());
Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling());
Farmables.farmables.put(FarmableReference.Arboreal.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Arboreal.get()).add(new FarmableVanillaSapling());
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
Farmables.farmables.get(FarmableReference.Arboreal.get()).add(new FarmableGE());
}
Farmables.farmables.put("farmOrchard", new ArrayList<IFarmable>());
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.wheat, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.potatoes, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7));
Farmables.farmables.put(FarmableReference.Orchard.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(Blocks.wheat, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(Blocks.potatoes, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(Blocks.carrots, 7));
Farmables.farmables.put("farmShroom", new ArrayList<IFarmable>());
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0));
Farmables.farmables.put(FarmableReference.Shroom.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Shroom.get()).add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0));
Farmables.farmables.get(FarmableReference.Shroom.get()).add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0));
Farmables.farmables.put("farmWheat", new ArrayList<IFarmable>());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));
Farmables.farmables.put(FarmableReference.Wheat.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));
Farmables.farmables.put("farmGourd", new ArrayList<IFarmable>());
Farmables.farmables.get("farmGourd").add(
Farmables.farmables.put(FarmableReference.Gourd.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Gourd.get()).add(
new FarmableGourd(new ItemStack(Items.pumpkin_seeds), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
Farmables.farmables.get(FarmableReference.Gourd.get()).add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
Farmables.farmables.put("farmInfernal", new ArrayList<IFarmable>());
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
Farmables.farmables.put(FarmableReference.Infernal.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Infernal.get()).add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
Farmables.farmables.put("farmPoales", new ArrayList<IFarmable>());
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0));
Farmables.farmables.put(FarmableReference.Poales.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Poales.get()).add(new FarmableStacked(Blocks.reeds, 3, 0));
Farmables.farmables.put("farmSucculentes", new ArrayList<IFarmable>());
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3, 0));
Farmables.farmables.put(FarmableReference.Succulentes.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Succulentes.get()).add(new FarmableStacked(Blocks.cactus, 3, 0));
Farmables.farmables.put("farmVegetables", new ArrayList<IFarmable>());
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7));
Farmables.farmables.put(FarmableReference.Vegetables.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.Vegetables.get()).add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7));
Farmables.farmables.get(FarmableReference.Vegetables.get()).add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7));
proxy.initializeRendering();
@@ -165,6 +146,9 @@ public class PluginFarming extends ForestryPlugin {
Circuit.farmCocoaManual = new CircuitFarmLogic("manualCocoa", FarmLogicCocoa.class).setManual();
Circuit.farmOrchardManual = new CircuitFarmLogic("manualOrchard", FarmLogicOrchard.class);
if (PluginManager.Module.FARMING.isEnabled() && GameRegistry.findBlock("IC2", "blockCrop") != null)
Circuit.farmIC2CropsManual = new CircuitFarmLogic("manualIC2Crop", FarmLogicIC2Crops.class).setManual();
}
@Override
@@ -342,5 +326,7 @@ public class PluginFarming extends ForestryPlugin {
ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.OBSIDIAN, 1), Circuit.farmGourdManual);
ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.APATITE, 1), Circuit.farmShroomManual);
ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.LAPIS, 1), Circuit.farmCocoaManual);
}
}
@@ -12,6 +12,7 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -92,7 +93,7 @@ public class PluginAgriCraft extends ForestryPlugin {
Block cropBlock = GameRegistry.findBlock(AgriCraft, "crops");
if (cropBlock != null && PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicAgricraft(cropBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicAgricraft(cropBlock, 7));
}
}
@@ -13,6 +13,7 @@ package forestry.plugins.compat;
import java.util.ArrayList;
import java.util.List;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -110,7 +111,7 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
}
if (saplings != null && persimmon != null) {
Farmables.farmables.get("farmArboreal").add(new FarmableGenericSapling(saplings, 15, persimmon));
Farmables.farmables.get(FarmableReference.Arboreal.get()).add(new FarmableGenericSapling(saplings, 15, persimmon));
}
Block boPTurnip = GameRegistry.findBlock(BoP, "turnip");
@@ -118,13 +119,13 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
Item boPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds");
ItemStack boPTurnipSeedStack = new ItemStack(boPTurnipSeeds, 1, 0);
if (boPTurnipSeeds != null) {
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(boPTurnipSeedStack, boPTurnip, 7));
Farmables.farmables.get(FarmableReference.Vegetables.get()).add(new FarmableGenericCrop(boPTurnipSeedStack, boPTurnip, 7));
if (PluginManager.Module.FACTORY.isEnabled()) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{boPTurnipSeedStack}, Fluids.SEEDOIL.getFluid(amount));
}
}
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(boPTurnip, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(boPTurnip, 7));
}
}
@@ -12,6 +12,7 @@ package forestry.plugins.compat;
import java.util.ArrayList;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -54,10 +55,10 @@ public class PluginExtraUtilities extends ForestryPlugin {
super.doInit();
Block exUEnderLilly = GameRegistry.findBlock(ExU, "plant/ender_lilly");
Farmables.farmables.put("farmEnder", new ArrayList<IFarmable>());
Farmables.farmables.put(FarmableReference.Ender.get(), new ArrayList<IFarmable>());
if (Config.isExUtilEnderLilyEnabled()) {
Circuit.farmEnderManaged = new CircuitFarmLogic("managedEnder", FarmLogicEnder.class);
Farmables.farmables.get("farmEnder").add(new FarmableGenericCrop(new ItemStack(exUEnderLilly, 1, 0), exUEnderLilly, 7));
Farmables.farmables.get(FarmableReference.Ender.get()).add(new FarmableGenericCrop(new ItemStack(exUEnderLilly, 1, 0), exUEnderLilly, 7));
}
}
@@ -12,6 +12,7 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableMap;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -86,11 +87,11 @@ public class PluginGrowthCraft extends ForestryPlugin {
}
Block hopVine = GameRegistry.findBlock("Growthcraft|Hops", "grc.hopVine");
if (hopVine != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(hopVine, 3, false, false)); // need custom fruit to weed out rope
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicGrowthCraft(hopVine, 3, false, false)); // need custom fruit to weed out rope
}
Block riceBlock = GameRegistry.findBlock("Growthcraft|Rice", "grc.riceBlock");
if (riceBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(riceBlock, 7, true, false)); //need to set paddyfield to 7
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicGrowthCraft(riceBlock, 7, true, false)); //need to set paddyfield to 7
}
if (PluginManager.Module.APICULTURE.isEnabled()) {
@@ -133,7 +134,7 @@ public class PluginGrowthCraft extends ForestryPlugin {
}
Block grapeBlock = GameRegistry.findBlock("Growthcraft|Grapes", "grc.grapeBlock");
if (grapeBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(grapeBlock, 0, false, true));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicGrowthCraft(grapeBlock, 0, false, true));
}
ItemStack bambooLeaves = GameRegistry.findItemStack("Growthcraft|Bamboo", "grc.bambooLeaves", 1);
@@ -12,6 +12,7 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -38,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() {
@@ -189,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;
@@ -207,8 +220,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{berrySeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && berrySeed != null && berryBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(berrySeed, berryBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(berryBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(berrySeed, berryBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(berryBlock, 7));
}
plants.add(berryName);
}
@@ -225,8 +238,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{fruitSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && fruitSeed != null && fruitBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(fruitSeed, fruitBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(fruitSeed, fruitBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(fruitBlock, 7));
}
plants.add(fruitName);
}
@@ -244,8 +257,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{vegetableSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && vegetableSeed != null && vegetableBlock != null) {
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(vegetableSeed, vegetableBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(vegetableBlock, 7));
Farmables.farmables.get(FarmableReference.Vegetables.get()).add(new FarmableGenericCrop(vegetableSeed, vegetableBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(vegetableBlock, 7));
}
plants.add(vegetableName);
}
@@ -263,8 +276,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.moistenerManager.addRecipe(grainSeed, new ItemStack(Blocks.mycelium), 5000);
}
if (PluginManager.Module.FARMING.isEnabled() && grainSeed != null && grainBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(grainSeed, grainBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(grainBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(grainSeed, grainBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(grainBlock, 7));
}
plants.add(grainName);
}
@@ -273,7 +286,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
ItemStack treeFruit = GameRegistry.findItemStack(HC, treeFruitName + "Item", 1);
Block treeFruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeFruitName.charAt(0)) + treeFruitName.substring(1)));
if (PluginManager.Module.FARMING.isEnabled() && treeFruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(treeFruitBlock, 2));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(treeFruitBlock, 2));
}
if (treeFruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{treeFruit}, Fluids.JUICE.getFluid(juiceAmount));
@@ -284,7 +297,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
for (String treeName : trees) {
Block fruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (PluginManager.Module.FARMING.isEnabled() && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 2));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(fruitBlock, 2));
}
plants.add(treeName);
}
@@ -292,7 +305,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
for (String treeName : treesSpecial) {
Block fruitBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (PluginManager.Module.FARMING.isEnabled() && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(fruitBlock, 2));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(fruitBlock, 2));
}
}
@@ -303,11 +316,12 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{genericCropSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && genericCropSeed != null && genericCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(genericCropSeed, genericCropBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(genericCropBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(genericCropSeed, genericCropBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(genericCropBlock, 7));
}
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);
@@ -315,8 +329,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{mustardCropSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && mustardCropSeed != null && mustardCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(mustardCropSeed, mustardCropBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(mustardCropBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(mustardCropSeed, mustardCropBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(mustardCropBlock, 7));
}
if (mustardFruit != null) {
RecipeUtil.addFermenterRecipes(mustardFruit, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
@@ -337,8 +351,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{cropnutSeed}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled() && cropnutSeed != null && cropnutBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(cropnutSeed, cropnutBlock, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(cropnutBlock, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(cropnutSeed, cropnutBlock, 7));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(cropnutBlock, 7));
}
if (cropnut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{cropnut}, Fluids.SEEDOIL.getFluid(12 * seedamount));
@@ -349,7 +363,7 @@ public class PluginHarvestCraft extends ForestryPlugin {
ItemStack nut = GameRegistry.findItemStack(HC, nutName + "Item", 1);
Block nutBlock = GameRegistry.findBlock(HC, "pam" + (Character.toUpperCase(nutName.charAt(0)) + nutName.substring(1)));
if (PluginManager.Module.FARMING.isEnabled() && nutBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(nutBlock, 2));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(nutBlock, 2));
}
if (nut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{nut}, Fluids.SEEDOIL.getFluid(15 * seedamount));
@@ -365,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));
}
}
}
}
}
}
@@ -18,7 +18,9 @@ import java.util.EnumSet;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.farming.Farmables;
import forestry.core.config.Config;
import forestry.farming.logic.FarmableBasicIC2Crop;
import forestry.farming.logic.FarmableReference;
import ic2.api.crops.ICropTile;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -86,6 +88,7 @@ public class PluginIC2 extends ForestryPlugin {
private static ItemStack rubberleaves;
private static ItemStack emptyCell;
private static ItemStack lavaCell;
private static ItemStack uran238;
private static ItemStack waterCell;
private static ItemStack rubber;
private static ItemStack scrap;
@@ -160,6 +163,8 @@ public class PluginIC2 extends ForestryPlugin {
silver = IC2Items.getItem("silverIngot");
brass = IC2Items.getItem("bronzeIngot");
uran238 = IC2Items.getItem("Uran238");
Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class);
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
@@ -243,12 +248,8 @@ public class PluginIC2 extends ForestryPlugin {
@Optional.Method(modid = "IC2")
protected void registerRecipes() {
if (rubber != null) {
for (Object rubberOreDict : RecipeUtil.getOreDictRecipeEquivalents(rubber)) {
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), PluginCore.items.tubes.get(EnumElectronTube.RUBBER, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', rubberOreDict});
}
}
EnumElectronTube.RUBBER.registerTubeRecipe(rubber);
EnumElectronTube.URANIUM.registerTubeRecipe(uran238);
if (plantBall != null) {
RecipeUtil.addFermenterRecipes(plantBall, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
@@ -310,7 +311,10 @@ public class PluginIC2 extends ForestryPlugin {
Block ic2Crop = GameRegistry.findBlock("IC2", "blockCrop");
if (PluginManager.Module.FARMING.isEnabled() && ic2Crop != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicIC2Crop());
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.items.tubes.get(EnumElectronTube.URANIUM, 1), Circuit.farmIC2CropsManual);
Farmables.farmables.put(FarmableReference.IC2Crops.get(), new ArrayList<>());
Farmables.farmables.get(FarmableReference.IC2Crops.get()).add(new FarmableBasicIC2Crop());
}
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
@@ -341,10 +345,7 @@ public class PluginIC2 extends ForestryPlugin {
*/
@Optional.Method(modid = "IC2")
public boolean isIC2Crop(TileEntity tileEntity) {
if (tileEntity != null && tileEntity instanceof ICropTile) {
return true;
}
return false;
return tileEntity instanceof ICropTile;
}
/**
@@ -359,9 +360,7 @@ public class PluginIC2 extends ForestryPlugin {
if (crop.getCrop() == null) {
return false;
}
if (crop.getSize() == crop.getCrop().getOptimalHavestSize(crop)) {
return true;
}
return crop.getSize() == crop.getCrop().getOptimalHavestSize(crop);
}
return false;
}
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.plugins.compat;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -49,7 +50,7 @@ public class PluginImmersiveEngineering extends ForestryPlugin {
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
if (hempSeed != null && hempCrop != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{hempSeed}, Fluids.SEEDOIL.getFluid(seedAmount));
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(hempSeed, hempCrop, 4, hempFiber));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(hempSeed, hempCrop, 4, hempFiber));
}
}
@@ -12,6 +12,7 @@ package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -268,7 +269,7 @@ public class PluginMagicalCrops extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{seed}, Fluids.SEEDOIL.getFluid(fluidAmount));
}
if (seed != null && crop != null && Config.isMagicalCropsSupportEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seed, crop, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(seed, crop, 7));
}
}
@@ -276,7 +277,7 @@ public class PluginMagicalCrops extends ForestryPlugin {
ItemStack seed = GameRegistry.findItemStack(MagCrop, middlefix + name + seedSuffix, 1);
Block crop = GameRegistry.findBlock(MagCrop, middlefix + name + cropSuffix);
if (seed != null && crop != null && Config.isMagicalCropsSupportEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seed, crop, 7));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(seed, crop, 7));
}
}
}
@@ -13,6 +13,7 @@ package forestry.plugins.compat;
import java.util.ArrayList;
import java.util.List;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@@ -218,8 +219,8 @@ public class PluginNatura extends ForestryPlugin {
}
Block cropBlock = GameRegistry.findBlock(NATURA, "N Crops");
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedBarley, cropBlock, 3));
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedCotton, cropBlock, 8));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(seedBarley, cropBlock, 3));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(seedCotton, cropBlock, 8));
List<ItemStack> berries = new ArrayList<>();
if (berryBlight != null) {
@@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -375,7 +376,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
if (reedBlock != null && reedStack != null) {
RecipeUtil.addFermenterRecipes(reedStack, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmPoales").add(new FarmableStacked(reedBlock, 14, 4));
Farmables.farmables.get(FarmableReference.Poales.get()).add(new FarmableStacked(reedBlock, 14, 4));
}
}
}
@@ -392,8 +393,8 @@ public class PluginPlantMegaPack extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{seedStack}, Fluids.SEEDOIL.getFluid(seedamount));
}
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedStack, landCropBlock, 4));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(landCropBlock, 4));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(seedStack, landCropBlock, 4));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(landCropBlock, 4));
}
}
}
@@ -410,7 +411,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
for (Map.Entry<String, Integer> wPlant : floatingWaterPlant.entrySet()) {
Block waterPlantBlock = GameRegistry.findBlock(PlantMP, wPlant.getKey());
if (PluginManager.Module.FARMING.isEnabled() && waterPlantBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(waterPlantBlock, wPlant.getValue()));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(waterPlantBlock, wPlant.getValue()));
}
}
@@ -426,8 +427,8 @@ public class PluginPlantMegaPack extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{foodStack}, Fluids.JUICE.getFluid(juiceAmount));
}
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(berryBushStack, berryBushCropBlock, berryBushCrop.getValue()));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(berryBushCropBlock, berryBushCrop.getValue()));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(berryBushStack, berryBushCropBlock, berryBushCrop.getValue()));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(berryBushCropBlock, berryBushCrop.getValue()));
}
}
}
@@ -444,7 +445,7 @@ public class PluginPlantMegaPack extends ForestryPlugin {
FlowerManager.flowerRegistry.registerAcceptableFlower(plantBlock, special.getValue());
FlowerManager.flowerRegistry.registerPlantableFlower(plantBlock, 0, 0.75, special.getValue());
if (PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(specialStack, plantBlock, 4));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(specialStack, plantBlock, 4));
}
}
}
@@ -466,9 +467,9 @@ public class PluginPlantMegaPack extends ForestryPlugin {
FlowerManager.flowerRegistry.registerPlantableFlower(flowerBlock, 0, 0.75, flowertype);
}
if (PluginManager.Module.FARMING.isEnabled() && flowerStack != null && flowerBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(flowerStack, flowerBlock, flower.getValue()));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(flowerStack, flowerBlock, flower.getValue()));
if (flower.getValue() < 5) {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(flowerBlock, flower.getValue()));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(flowerBlock, flower.getValue()));
}
}
}
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.plugins.compat;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -55,8 +56,8 @@ public class PluginRotaryCraft extends ForestryPlugin {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{canolaSeed}, Fluids.SEEDOIL.getFluid(seedAmount));
}
if(PluginManager.Module.FARMING.isEnabled()) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(canolaSeed, canolaCrop, 9));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(canolaCrop, 9));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(canolaSeed, canolaCrop, 9));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(canolaCrop, 9));
}
}
}
@@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
import forestry.farming.logic.FarmableReference;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -91,8 +92,8 @@ public class PluginWitchery extends ForestryPlugin {
Block cropDirectBlock = GameRegistry.findBlock(Witch, cropDirectName + "plant");
ItemStack cropDirectStack = GameRegistry.findItemStack(Witch, cropDirectName, 1);
if (cropDirectStack != null && cropDirectBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(cropDirectStack, cropDirectBlock, 5));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(cropDirectBlock, 5));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(cropDirectStack, cropDirectBlock, 5));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(cropDirectBlock, 5));
}
}
for (Map.Entry<String, Integer> cropSeedName : cropSeed.entrySet()) {
@@ -100,13 +101,13 @@ public class PluginWitchery extends ForestryPlugin {
ItemStack cropSeedStack = GameRegistry.findItemStack(Witch, "seeds" + cropSeedName.getKey(), 1);
if (cropSeedStack != null && cropSeedBlock != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{cropSeedStack}, Fluids.SEEDOIL.getFluid(seedamount));
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(cropSeedStack, cropSeedBlock, cropSeedName.getValue()));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(cropSeedBlock, cropSeedName.getValue()));
Farmables.farmables.get(FarmableReference.Wheat.get()).add(new FarmableGenericCrop(cropSeedStack, cropSeedBlock, cropSeedName.getValue()));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(cropSeedBlock, cropSeedName.getValue()));
}
}
Block artichokeBlock = GameRegistry.findBlock(Witch, "artichoke");
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(artichokeBlock, 4));
Farmables.farmables.get(FarmableReference.Orchard.get()).add(new FarmableBasicFruit(artichokeBlock, 4));
}
}