Compare commits

..
52 Commits
Author SHA1 Message Date
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
Dream-Master f260099bfa remove redstone flux not working api 2019-03-26 08:46:07 +01:00
bartimaeusnek 855d359b02 changed crop logic a bit
if crop havest is not possible at the optimal state, just harvest, ffs.

Signed-off-by: bartimaeusnek <[email protected]>
2019-03-23 23:29:26 +01:00
bartimaeusnek abcb180689 added a null check
might help for  https://github.com/GTNewHorizons/NewHorizons/issues/4283
2019-03-18 18:58:33 +01:00
Jason Mitchell 507adb1b3f version bump 2018-10-06 09:09:25 -07:00
Jason Mitchell 23c4e4ed91 Fix pollination crash 2018-10-06 09:08:06 -07:00
bartimaeusnek e5057788a8 version bump 2018-06-09 17:08:51 +02:00
bartimaeusnek a5045bfc0f try to limit nbttag compound on apiaries to 128 entries 2018-06-08 00:52:00 +02:00
bartimaeusnek bfd678c63e removed shades Java7Checker due to issures with Java 9
+ updated Forge Version to v1614
+ updated used Java version to v8
+ updated used grandle wrapper to 2.14.1
2018-06-07 20:15:02 +02:00
LunaticExperimentalist 320ea99090 Have trade station compare tags when accepting payment (#1850) 2017-09-18 21:44:11 -07:00
mezz 08f16ba26d Bump version 2016-10-02 15:41:30 -07:00
mezz 9419dc82de Fix #1442 Let BeeHousings detect biome changes 2016-10-02 15:41:09 -07:00
mezz 2d1f64c5f6 Bump version 2016-07-31 17:11:05 -07:00
mezz cd9f82001c Fix #1366 Alveary in the Nether does not have Hellish temperature 2016-07-31 17:10:59 -07:00
mezz f7b8435d28 Update lang, bump version 2016-06-23 15:38:24 -07:00
mezz 013806f158 Merge remote-tracking branch 'origin/dev' into 4.2 2016-06-23 15:33:48 -07:00
Nirek-K 062b5ee75f Fix #1328 Crash when trying to pick up wheat from Moistener process slot 2016-06-23 17:30:34 -05:00
Nirek-K 56adc25fdf Fix #1330 Change resource checks to check tile for IBeeHousing 2016-06-23 15:40:41 -05:00
mezz df375b1b30 Merge remote-tracking branch 'origin/dev' into 4.2 2016-06-09 16:43:14 -07:00
Nirek-K 789da29af0 Fix #1293 Prevent nulls from passing Agricraft harvest
Update HC compat
2016-06-05 19:18:53 -05:00
Nirek-K e0df2f84a0 Fix Fabricator glass recipes 4000mb->4 blocks 2016-05-29 18:40:57 -05:00
Nirek-K 01656f13a6 Basic MFR plugin, allow farm to plant/cut rubber trees
(trying to plant sacreds is a ..bad idea)
Centrifuge raw rubber from propolis in the absense of IC2
minor bugfix for witchery sapling ferment
2016-04-28 02:47:58 -05:00
mezz b466e9ce4a Merge remote-tracking branch 'origin/dev' into 4.2 2016-04-27 19:30:56 -07:00
Nirek-K 60c9dad874 Merge pull request #1137 from ultrasn0w/dev
Update PlantMegaPack Plugin
2016-04-25 14:55:21 -05:00
ultrasn0w d734ca55e6 Update PlantMegaPack Plugin 2016-04-25 21:15:47 +02:00
Nirek-K f16f349f10 Version bump to be ahead of stable, and pull in lang fixes 2016-04-24 14:32:05 -05:00
Nirek-K 66561ac66d Fix #1129 Bugfixes for Multifarm BC Gate Triggers. 2016-04-18 17:28:37 -05:00
Nirek-K ad96e21b37 Fix eating bottles slightly better, Steve now enjoys mead in 8packs (hic). 2016-04-17 18:46:52 -05:00
Nirek-K 3967d21b06 Short mead now has a purpose, further distillation produces mead (only drinkable in bottles).
Also fix somehow eating it glass bottle and all.
2016-04-17 01:40:45 -05:00
Nirek-K 2a025254a0 Add ic2 industrial fert as farming fertilizer. (seperate config option to probably come later) 2016-04-05 16:08:00 -05:00
Nirek-K 97bfbe2213 Fix #1117 Radioactive bee effect can bypass apiarist suit 2016-04-03 11:17:30 -05:00
Nirek-K 98c56973db Fix #1123 Add lang string for Leporine Bee, Add some basic bee trades to Aparist. 2016-03-31 09:41:47 -05:00
mezz b83da5c628 Merge branch 'mc-1.7.10' into 4.2 2016-03-22 12:29:14 -07:00
mezz 4a2af4743f Fix #1117 Radioactive bee effect can bypass apiarist suit 2016-03-22 12:28:31 -07:00
50 changed files with 482 additions and 122 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
url = https://github.com/ForestryMC/Forestry-Localization.git
[submodule "api/redstoneflux"]
path = api/redstoneflux
url = https://github.com/CoFH/RedstoneFlux-API.git
url = https://github.com/Texasjake95/RedstoneFlux-API.git
[submodule "api/forestry"]
path = api/forestry
url = https://github.com/ForestryMC/ForestryAPI.git
+17 -11
View File
@@ -35,8 +35,10 @@ ext.apiForestry = "./api/forestry"
ext.apiRedstoneFlux = "./api/redstoneflux"
// java version
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
version = mcversion + "-" + forgeversion
@@ -82,8 +84,8 @@ repositories {
configurations {
api
compile.extendsFrom api
shade
compile.extendsFrom shade
//shade
//compile.extendsFrom shade
}
dependencies {
@@ -99,7 +101,7 @@ dependencies {
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.111:src"
// http://maven.tterrag.com/
shade "chylex.javacheck:JavaChecker:v1.2-b1"
//shade "chylex.javacheck:JavaChecker:v1.2-b1"
testCompile 'junit:junit:4.12'
}
@@ -158,11 +160,11 @@ jar {
from "./src/main/java/invtweaks/LICENSE.txt"
}
configurations.shade.each{ dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**', 'mcmod.info'
}
}
//configurations.shade.each{ dep ->
// from(project.zipTree(dep)){
// exclude 'META-INF', 'META-INF/**', 'mcmod.info'
// }
//}
}
task mainJar(type: Jar, dependsOn: 'reobf') {
@@ -177,7 +179,7 @@ task mainJar(type: Jar, dependsOn: 'reobf') {
includeEmptyDirs = false
manifest{
attributes 'TweakClass': 'forestry.shade.javacheck.Java7Checker'
//attributes 'TweakClass': 'forestry.shade.javacheck.Java7Checker'
}
}
@@ -255,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.1566-1.7.10
forgeversion=10.13.4.1614-1.7.10
version_major=4
version_minor=2
version_patch=10
version_patch=24
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
+1 -1
Submodule lang updated: cb5900228e...4cfdcf1595.
@@ -116,9 +116,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
hasFlowersCache.writeToNBT(nbttagcompound);
Stack<ItemStack> spawnCopy = new Stack<>();
spawnCopy.addAll(spawn);
if (spawn.size()<128)
spawnCopy.addAll(spawn);
else
for (byte b=0;b<128;++b)
spawnCopy.add(spawn.get(b));
NBTTagList nbttaglist = new NBTTagList();
while (!spawnCopy.isEmpty()) {
while (!spawnCopy.isEmpty() && spawnCopy.size()<=128) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
spawnCopy.pop().writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
@@ -49,6 +49,7 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
ItemStack wildcardPrincess = new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE);
ItemStack wildcardDrone = new ItemStack(PluginApiculture.items.beeDroneGE, 4, OreDictionary.WILDCARD_VALUE);
recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1)));
ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false);
@@ -62,6 +63,23 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), wildcardPrincess, monasticDrone));
ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
recipeList.add(new MerchantRecipe(new ItemStack(Items.ender_eye, 16), wildcardPrincess, endDrone));
ItemStack propolis = new ItemStack(PluginApiculture.items.propolis,1);
ItemStack forestDrone = BeeDefinition.FOREST.getMemberStack(EnumBeeType.DRONE);
ItemStack meadowsDrone = BeeDefinition.MEADOWS.getMemberStack(EnumBeeType.DRONE);
ItemStack modestDrone = BeeDefinition.MODEST.getMemberStack(EnumBeeType.DRONE);
ItemStack tropicalDrone = BeeDefinition.TROPICAL.getMemberStack(EnumBeeType.DRONE);
ItemStack wintryDrone = BeeDefinition.WINTRY.getMemberStack(EnumBeeType.DRONE);
ItemStack marshyDrone = BeeDefinition.MARSHY.getMemberStack(EnumBeeType.DRONE);
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, forestDrone));
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, meadowsDrone));
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, modestDrone));
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, tropicalDrone));
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, wintryDrone));
recipeList.add(new MerchantRecipe(propolis, wildcardDrone, marshyDrone));
}
@Override
@@ -283,7 +283,7 @@ public class Bee extends IndividualLiving implements IBee {
}
// / Check for the sky, except if in hell
if (biome != null && !BiomeHelper.isBiomeHellish(biome)) {
if (!world.provider.hasNoSky) {
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
errorStates.add(EnumErrorCode.NO_SKY);
}
@@ -10,16 +10,17 @@
******************************************************************************/
package forestry.apiculture.genetics;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
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.BlockUtil;
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.core.utils.ItemStackUtil;
public class JubilanceRequiresResource implements IJubilanceProvider {
@@ -33,10 +34,25 @@ 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;
int i = 1;
do {
block = world.getBlock(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
meta = world.getBlockMetadata(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
tile = world.getTileEntity(housingCoords.posX, housingCoords.posY - i, housingCoords.posZ);
i++;
} while (tile instanceof IBeeHousing);
Block block = world.getBlock(housingCoords.posX, housingCoords.posY - 1, housingCoords.posZ);
int meta = world.getBlockMetadata(housingCoords.posX, housingCoords.posY - 1, housingCoords.posZ);
return ItemStackUtil.equals(block, meta, blockRequired);
*/
ItemStack stk = BlockUtil.getItemStackFromBlockBelow(world, housingCoords.posX, housingCoords.posY, housingCoords.posZ,
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
return blockRequired.equals(stk); //this way to prevent NPEs
}
}
@@ -49,7 +49,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
// Entities are not attacked if they wear a full set of apiarist's armor.
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
damage -= count;
damage -= (count * 2);
if (damage <= 0) {
continue;
}
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import forestry.api.core.BiomeHelper;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -53,7 +54,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
private final InventoryBeeHousing inventory;
private final IBeekeepingLogic beekeepingLogic;
private BiomeGenBase cachedBiome;
private float tempChange = 0.0f;
private float humidChange = 0.0f;
@@ -290,7 +290,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
data.setFloat("TempChange", tempChange);
data.setFloat("HumidChange", humidChange);
beekeepingLogic.writeToNBT(data);
inventory.writeToNBT(data);
}
@@ -359,8 +358,11 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
@Override
public EnumTemperature getTemperature() {
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
if (beeModifier.isHellish() && tempChange >= 0) {
return EnumTemperature.HELLISH;
BiomeGenBase biome = getBiome();
if (beeModifier.isHellish() || BiomeHelper.isBiomeHellish(biome)) {
if (tempChange >= 0) {
return EnumTemperature.HELLISH;
}
}
return EnumTemperature.getFromValue(getExactTemperature());
@@ -383,11 +385,8 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
@Override
public BiomeGenBase getBiome() {
if (cachedBiome == null) {
ChunkCoordinates coords = getReferenceCoord();
cachedBiome = worldObj.getBiomeGenForCoords(coords.posX, coords.posZ);
}
return cachedBiome;
ChunkCoordinates coords = getReferenceCoord();
return worldObj.getBiomeGenForCoords(coords.posX, coords.posZ);
}
@Override
@@ -35,7 +35,6 @@ import forestry.core.tiles.TileBase;
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
private final IBeekeepingLogic beeLogic;
private BiomeGenBase cachedBiome;
// CLIENT
private int breedingProgressPercent = 0;
@@ -142,10 +141,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
// / IBEEHOUSING
@Override
public BiomeGenBase getBiome() {
if (cachedBiome == null) {
cachedBiome = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord);
}
return cachedBiome;
return worldObj.getBiomeGenForCoordsBody(xCoord, zCoord);
}
@Override
@@ -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)) {
@@ -184,17 +184,13 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(world, x, y, z);
if (checkPollinatable == null) {
return false;
}
if (!checkPollinatable.canMateWith(tree)) {
if (checkPollinatable == null || !checkPollinatable.canMateWith(tree)) {
return false;
}
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(player.getGameProfile(), world, x, y, z);
if (!pollinatable.canMateWith(tree)) {
if (pollinatable == null || !pollinatable.canMateWith(tree)) {
return false;
}
@@ -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");
+26 -2
View File
@@ -211,7 +211,31 @@ public enum Fluids {
@Override
public EnumSet<EnumContainerType> getContainerTypes() {
return EnumSet.of(
EnumContainerType.BUCKET
EnumContainerType.BUCKET,
EnumContainerType.CAN,
EnumContainerType.CAPSULE,
EnumContainerType.REFRACTORY
);
}
},
MEAD("Mead", new Color(202, 102, 0), 1000, 1200) {
@Override
public String getTag() {
return "mead";
}
@Override
public Block makeBlock() {
return new BlockForestryFluid(this);
}
@Override
public EnumSet<EnumContainerType> getContainerTypes() {
return EnumSet.of(
EnumContainerType.BUCKET,
EnumContainerType.CAN,
EnumContainerType.CAPSULE,
EnumContainerType.REFRACTORY
);
}
},
@@ -260,7 +284,7 @@ public enum Fluids {
CREOSOTE(new Color(0x635c03)),
STEAM(new Color(0x91938F));
public static final Fluids[] forestryFluids = {ETHANOL, BIOMASS, GLASS, HONEY, LEGACY_HONEY, ICE, JUICE, MILK, SEEDOIL, SHORT_MEAD};
public static final Fluids[] forestryFluids = {ETHANOL, BIOMASS, GLASS, HONEY, LEGACY_HONEY, ICE, JUICE, MILK, SEEDOIL, SHORT_MEAD, MEAD};
private static final Map<String, Fluids> tagToFluid = new HashMap<>();
@@ -10,16 +10,18 @@
******************************************************************************/
package forestry.core.genetics.mutations;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
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.BlockUtil;
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.core.utils.ItemStackUtil;
public class MutationConditionRequiresResource implements IMutationCondition {
@@ -31,16 +33,25 @@ 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) {
/*
Block block;
TileEntity tile;
int meta;
int i = 1;
do {
block = world.getBlock(x, y - i, z);
meta = world.getBlockMetadata(x, y - i, z);
tile = world.getTileEntity(x, y - i, z);
i++;
} while (block instanceof IBeeHousing);
} 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 blockRequired.equals(stk) ? 1f : 0f;
}
@Override
@@ -10,19 +10,18 @@
******************************************************************************/
package forestry.core.genetics.mutations;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.apiculture.IBeeHousing;
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 {
@@ -42,26 +41,31 @@ 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) {
/*
Block block;
int meta;
TileEntity tile;
int i = 1;
do {
block = world.getBlock(x, y - i, z);
meta = world.getBlockMetadata(x, y - i, z);
tile = world.getTileEntity(x, y-i, z);
i++;
} while (block instanceof IBeeHousing);
int[] oreIds = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
for (int oreId : oreIds) {
if (oreId == this.oreDictId) {
return 1;
}
}
return 0;
} while (tile instanceof IBeeHousing);
*/
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);
}
}
@@ -31,7 +31,7 @@ public class SlotWorking extends SlotForestry {
}
@Override
public boolean getHasStack() {
public boolean canTakeStack(EntityPlayer stack) {
return false;
}
@@ -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;
@@ -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,42 @@ 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 Method getDamage;
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");
getDamage = BW_MetaGenerated_WerkstoffBlocksClass.getMethod("getDamageValue", World.class, int.class, int.class, int.class);
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader").getField("BWBlocks").get(null);
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException 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)) {
try {
return new ItemStack(BWBlocks, 1, (Integer) getDamage.invoke(block, world, x, y - depth, z));
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
}
return new ItemStack(block, 1, world.getBlockMetadata(x, y - depth, z));
}
}
@@ -407,6 +407,22 @@ public abstract class InventoryUtil {
return ((float) amount / (float) stackMax) >= percent;
}
public static boolean containsAmount(IInventory inventory, int amount) {
int total = 0;
int slot1 = 0;
int length = inventory.getSizeInventory();
for (ItemStack itemStack : getStacks(inventory, slot1, length)) {
if (itemStack == null) {
continue;
}
total += itemStack.stackSize;
if (total >= amount) {
return true;
}
}
return false;
}
public static boolean isEmpty(IInventory inventory, int slotStart, int slotCount) {
for (int i = slotStart; i < slotStart + slotCount; i++) {
if (inventory.getStackInSlot(i) != null) {
@@ -141,6 +141,13 @@ public abstract class ItemStackUtil {
* Counts how many full sets are contained in the passed stock
*/
public static int containsSets(ItemStack[] set, ItemStack[] stock, boolean oreDictionary, boolean craftingTools) {
return containsSets(set, stock, oreDictionary, craftingTools, false);
}
/**
* Counts how many full sets are contained in the passed stock
*/
public static int containsSets(ItemStack[] set, ItemStack[] stock, boolean oreDictionary, boolean craftingTools, boolean matchTags) {
int totalSets = 0;
ItemStack[] condensedRequired = ItemStackUtil.condenseStacks(set);
@@ -150,7 +157,7 @@ public abstract class ItemStackUtil {
int reqCount = 0;
for (ItemStack offer : condensedOffered) {
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools)) {
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (matchTags ? ItemStack.areItemStackTagsEqual(req, offer) : true)) {
int stackCount = (int) Math.floor(offer.stackSize / req.stackSize);
reqCount = Math.max(reqCount, stackCount);
}
@@ -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;
@@ -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;
@@ -12,6 +12,7 @@ package forestry.farming.logic;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -47,6 +48,7 @@ public class CropBasicAgriCraft extends Crop {
harvest.remove(0);
Proxies.common.addBlockDestroyEffects(world, pos.x, pos.y, pos.z, Blocks.melon_block, 0);
world.setBlockMetadataWithNotify(pos.x, pos.y, pos.z, 0, Constants.FLAG_BLOCK_SYNCH);
harvest.removeAll(Collections.singleton(null)); //sanatize nulls that get thru from Agricraft+Harvestcraft (sesameseed)
return harvest;
}
@@ -31,6 +31,9 @@ import forestry.core.utils.InventoryUtil;
import forestry.core.utils.PlayerUtil;
import forestry.core.utils.SlotUtil;
import forestry.plugins.PluginCore;
import forestry.plugins.PluginManager;
import ic2.api.item.IC2Items;
public class InventoryFarm extends InventoryAdapterRestricted implements IFarmInventory {
public static final int SLOT_RESOURCES_1 = 0;
@@ -132,8 +135,14 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
if (itemstack == null) {
return false;
}
Item item = itemstack.getItem();
if (PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
Item ic2fert = IC2Items.getItem("fertilizer").getItem();
if (ic2fert == item) {
return true;
}
}
return PluginCore.items.fertilizerCompound == item;
}
@@ -199,7 +208,10 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
public void stowHarvest(Iterable<ItemStack> harvested, Stack<ItemStack> pendingProduce) {
for (ItemStack harvest : harvested) {
if (harvest == null) {
continue;
}
if (acceptsAsGermling(harvest)) {
harvest.stackSize -= InventoryUtil.addStack(germlingsInventory, harvest, true);
}
@@ -244,4 +256,4 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
decrStackSize(SLOT_FERTILIZER, 1);
return true;
}
}
}
@@ -44,6 +44,6 @@ public class TriggerLowFertilizer extends Trigger {
TileFarmHatch tileHatch = (TileFarmHatch) tile;
IInventory fertilizerInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getFertilizerInventory();
return InventoryUtil.containsPercent(fertilizerInventory, threshold);
return !InventoryUtil.containsPercent(fertilizerInventory, threshold);
}
}
@@ -47,6 +47,6 @@ public class TriggerLowGermlings extends Trigger {
TileFarmHatch tileHatch = (TileFarmHatch) tile;
IInventory germlingsInventory = tileHatch.getMultiblockLogic().getController().getFarmInventory().getGermlingsInventory();
return InventoryUtil.containsPercent(germlingsInventory, threshold);
return !InventoryUtil.containsPercent(germlingsInventory, threshold);
}
}
@@ -24,6 +24,7 @@ import forestry.farming.tiles.TileFarmHatch;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementParameterItemStack;
public class TriggerLowSoil extends Trigger {
@@ -49,6 +50,11 @@ public class TriggerLowSoil extends Trigger {
return 0;
}
@Override
public IStatementParameter createParameter(int index) {
return new StatementParameterItemStack();
}
/**
* Return true if the tile given in parameter activates the trigger, given
* the parameters.
@@ -67,14 +73,14 @@ public class TriggerLowSoil extends Trigger {
TileFarmHatch tileHatch = (TileFarmHatch) tile;
IFarmController farmController = tileHatch.getMultiblockLogic().getController();
IFarmInventory farmInventory = farmController.getFarmInventory();
IInventory resourcesInventory = farmInventory.getResourcesInventory();
if (parameter == null || parameter.getItemStack() == null) {
IInventory resourcesInventory = farmInventory.getResourcesInventory();
return InventoryUtil.containsPercent(resourcesInventory, threshold);
return !InventoryUtil.containsAmount(resourcesInventory, threshold);
} else {
ItemStack filter = parameter.getItemStack().copy();
filter.stackSize = threshold;
return farmInventory.hasResources(new ItemStack[]{filter});
return !InventoryUtil.contains(resourcesInventory, new ItemStack[]{filter});
}
}
}
@@ -22,8 +22,8 @@ import forestry.core.render.TextureManager;
public enum EnumBeverage implements ItemBeverage.IBeverageInfo {
MEAD_SHORT("meadShort", "glass", new Color(0xec9a19), new Color(0xffffff), 1, 0.2f, true),
MEAD_CURATIVE("meadCurative", "glass", new Color(0xc5feff), new Color(0xffffff), 1, 0.2f, true);
MEAD_CURATIVE("meadCurative", "glass", new Color(0xc5feff), new Color(0xffffff), 1, 0.2f, true),
MEAD("mead", "glass", new Color(0xcc6600), new Color(0xffffff), 10, 0.1f, true);
public static final EnumBeverage[] VALUES = values();
private final String name;
@@ -15,6 +15,7 @@ import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -49,7 +50,7 @@ public class ItemBeverage extends ItemForestryFood {
public ItemBeverage() {
super(1, 0.2f);
setMaxStackSize(1);
setMaxStackSize(8);
this.beverages = EnumBeverage.VALUES;
}
@@ -64,11 +65,18 @@ public class ItemBeverage extends ItemForestryFood {
@Override
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
List<IBeverageEffect> effects = BeverageEffect.loadEffects(itemstack);
ItemStack container = new ItemStack(Items.glass_bottle, 1);
itemstack.stackSize--;
if (!entityplayer.inventory.addItemStackToInventory(container)) {
entityplayer.dropPlayerItemWithRandomChoice(container, false);
} else {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, container);
}
entityplayer.inventory.markDirty();
entityplayer.getFoodStats().func_151686_a(this, itemstack);
world.playSoundAtEntity(entityplayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
if (world.isRemote) {
return itemstack;
}
@@ -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);
}
@@ -176,7 +176,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
return EnumStationState.INSUFFICIENT_PAPER;
}
int ordersToFillCount = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments());
int ordersToFillCount = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments(), false, false, true);
// Not a single match.
if (ordersToFillCount <= 0) {
@@ -523,6 +523,9 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
if (!pol.isItemEqual(req)) {
continue;
}
if (!ItemStack.areItemStackTagsEqual(req, pol)) {
continue;
}
if (req.stackSize >= pol.stackSize) {
req.stackSize -= pol.stackSize;
@@ -710,6 +710,8 @@ public class PluginApiculture extends ForestryPlugin {
// / FERMENTER
RecipeManagers.fermenterManager.addRecipe(items.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.HONEY.getFluid(1));
// / STILL
RecipeManagers.stillManager.addRecipe(Constants.STILL_DESTILLATION_DURATION, Fluids.SHORT_MEAD.getFluid(10), Fluids.MEAD.getFluid(5));
}
// ANALYZER
@@ -258,15 +258,14 @@ public class PluginFactory extends ForestryPlugin {
if (PluginManager.Module.APICULTURE.isEnabled()) {
ItemRegistryApiculture beeItems = PluginApiculture.items;
FluidStack liquidGlass = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME);
FluidStack liquidGlassX4 = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME * 4);
for (int i = 0; i < 16; i++) {
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.stained_glass, 4, 15 - i), new Object[]{
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.stained_glass, 4, 15 - i), new Object[]{
"#", "X",
'#', dyes[i],
'X', beeItems.propolis.getWildcard()});
}
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.glass, 1, 0), new Object[]{
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.glass, 4, 0), new Object[]{
"#", "X",
'X', beeItems.propolis.getWildcard()});
}
@@ -50,6 +50,7 @@ public class PluginFood extends ForestryPlugin {
super.preInit();
LiquidRegistryHelper.registerLiquidContainer(Fluids.SHORT_MEAD, Constants.BUCKET_VOLUME, items.beverage.get(EnumBeverage.MEAD_SHORT, 1), new ItemStack(Items.glass_bottle));
LiquidRegistryHelper.registerLiquidContainer(Fluids.MEAD, Constants.BUCKET_VOLUME, items.beverage.get(EnumBeverage.MEAD, 1), new ItemStack(Items.glass_bottle));
ItemRegistryApiculture beeItems = PluginApiculture.items;
if (beeItems != null) {
@@ -57,6 +57,7 @@ import forestry.plugins.compat.PluginHarvestCraft;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.compat.PluginImmersiveEngineering;
import forestry.plugins.compat.PluginMagicalCrops;
import forestry.plugins.compat.PluginMineFactoryReloaded;
import forestry.plugins.compat.PluginNatura;
import forestry.plugins.compat.PluginPlantMegaPack;
import forestry.plugins.compat.PluginRotaryCraft;
@@ -115,6 +116,7 @@ public class PluginManager {
IMMERSIVEENGINEERING(new PluginImmersiveEngineering()),
INDUSTRIALCRAFT(new PluginIC2()),
MAGICALCROPS(new PluginMagicalCrops()),
MINEFACTORYRELOADED(new PluginMineFactoryReloaded()),
NATURA(new PluginNatura()),
PLANTMEGAPACK(new PluginPlantMegaPack()),
ROTARYCRAFT(new PluginRotaryCraft()),
@@ -89,7 +89,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
"persimmon",
"avocado",
"coconut",
"durian"
"durian",
"gooseberry"
);
ImmutableList<String> trees = ImmutableList.of(
@@ -112,7 +113,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
ImmutableList<String> spices = ImmutableList.of(
"ginger",
"spiceleaf"
"spiceleaf",
"curryleaf"
//"mustardseed" Mustard is inconsistent and annoying.
);
@@ -149,7 +151,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
"wintersquash",
"zucchini",
"bambooshoot",
"spinach"
"spinach",
"waterchestnut"
);
ImmutableList<String> grains = ImmutableList.of(
@@ -159,7 +162,8 @@ public class PluginHarvestCraft extends ForestryPlugin {
);
ImmutableList<String> cropNuts = ImmutableList.of(
"peanut"
"peanut",
"sesameseeds"
);
ImmutableList<String> nuts = ImmutableList.of(
@@ -400,7 +400,13 @@ public class PluginIC2 extends ForestryPlugin {
public ArrayList<ItemStack> getCropDrops(TileEntity tileEntity) {
if (isIC2Crop(tileEntity)) {
ICropTile crop = (ICropTile)tileEntity;
ItemStack[] cropDrops = crop.harvest_automated(true);
if (crop == null || crop.getCrop() == null)
return null;
ItemStack[] cropDrops;
if ((crop.getCrop().canGrow(crop) && crop.getSize() < crop.getCrop().getOptimalHavestSize(crop)) || crop.getSize() == crop.getCrop().getOptimalHavestSize(crop))
cropDrops = crop.harvest_automated(true);
else
cropDrops = crop.harvest_automated(false);
if (cropDrops != null) {
return new ArrayList<>(Arrays.asList(cropDrops));
}
@@ -0,0 +1,72 @@
/*******************************************************************************
* 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.plugins.compat;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.api.recipes.RecipeManagers;
import forestry.apiculture.items.EnumPropolis;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ModUtil;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.Plugin;
import forestry.plugins.PluginApiculture;
import forestry.plugins.PluginManager;
@Plugin(pluginID = "MinefactoryReloaded", name = "MineFactoryReloaded", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.minefactoryreloaded.description")
public class PluginMineFactoryReloaded extends ForestryPlugin {
private static final String MFR = "MineFactoryReloaded";
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(MFR);
}
@Override
public String getFailMessage() {
return "MineFactoryReloaded not found";
}
@Override
protected void registerRecipes() {
Block rubbersapling = GameRegistry.findBlock(MFR, "rubberwood.sapling");
Item saplingItem = GameRegistry.findItem(MFR, "rubberwood.sapling");
ItemStack saplingStack = new ItemStack(saplingItem, 1, 0);
ItemStack rubberRaw = GameRegistry.findItemStack(MFR,"rubber.raw", 1);
GameRegistry.findItemStack(MFR,"rubber.raw", 1);
if (PluginManager.Module.APICULTURE.isEnabled() && !PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
if (rubberRaw != null) {
ItemRegistryApiculture beeItems = PluginApiculture.items;
RecipeManagers.centrifugeManager.addRecipe(20, beeItems.propolis.get(EnumPropolis.NORMAL, 1), ImmutableMap.of(rubberRaw, 1.0f));
}
}
if (rubbersapling != null && rubberRaw != null) {
RecipeUtil.addFermenterRecipes(saplingStack, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
String saplingName = GameData.getItemRegistry().getNameForObject(saplingItem);
FMLInterModComms.sendMessage(Constants.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
}
}
}
@@ -67,12 +67,20 @@ public class PluginPlantMegaPack extends ForestryPlugin {
ImmutableList<String> landCropPlant = ImmutableList.of(
"Beet",
"BellPepperOrange",
"BellPepperRed",
"BellPepperYellow",
"Broccoli",
"Cassava",
"Celery",
"Corn",
"Cucumber",
"Eggplant",
"GreenBean",
"Leek",
"Lettuce",
"Onion",
"Sorrel",
"Spinach",
"Tomato"
);
@@ -77,7 +77,7 @@ public class PluginWitchery extends ForestryPlugin {
Item saplingItem = GameRegistry.findItem(Witch, "witchsapling");
ItemStack saplingStack = new ItemStack(saplingItem, 1, OreDictionary.WILDCARD_VALUE);
RecipeUtil.addFermenterRecipes(saplingStack, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(saplingStack, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
String saplingName = GameData.getItemRegistry().getNameForObject(saplingItem);
FMLInterModComms.sendMessage(Constants.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

@@ -0,0 +1 @@
{"animation":{"width":1,"height":32,"frametime":1,"frames":[{"index":0,"time":2},{"index":1,"time":2},{"index":2,"time":2},{"index":3,"time":2},{"index":4,"time":2},{"index":5,"time":2},{"index":6,"time":2},{"index":7,"time":2},{"index":8,"time":2},{"index":9,"time":2},{"index":10,"time":2},{"index":11,"time":2},{"index":12,"time":2},{"index":13,"time":2},{"index":14,"time":2},{"index":15,"time":2},{"index":16,"time":2},{"index":17,"time":2},{"index":18,"time":2},{"index":19,"time":2},{"index":20,"time":2},{"index":21,"time":2},{"index":22,"time":2},{"index":23,"time":2},{"index":24,"time":2},{"index":25,"time":2},{"index":26,"time":2},{"index":27,"time":2},{"index":28,"time":2},{"index":29,"time":2},{"index":30,"time":2},{"index":31,"time":2}]}}