mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a958073079 | ||
|
|
d4e58b84c8 | ||
|
|
689a822058 | ||
|
|
0acbd6b247 | ||
|
|
d4206beba7 | ||
|
|
5412a73dc5 | ||
|
|
dbd4246beb | ||
|
|
6a205d71cc | ||
|
|
ad50ab6716 | ||
|
|
bb597e7403 | ||
|
|
9614f95961 | ||
|
|
ef0b5c7c1d | ||
|
|
7e889775c1 | ||
|
|
7ea1f150e0 | ||
|
|
4c7c7c3438 | ||
|
|
621208393e | ||
|
|
98c0b66b6f | ||
|
|
5b61261d69 | ||
|
|
d025499747 | ||
|
|
7320ddb44f | ||
|
|
d2545b7a59 | ||
|
|
66d07bcac4 | ||
|
|
fb2eb7cda4 | ||
|
|
347fdb101c | ||
|
|
d2a086ac02 | ||
|
|
859a79a824 | ||
|
|
00c31a6158 | ||
|
|
5db5b712ce | ||
|
|
9cac9a14df | ||
|
|
43f98e9cca | ||
|
|
ff4c09324b | ||
|
|
d1c17a13b1 | ||
|
|
8a8ac56266 | ||
|
|
208de8ad3a | ||
|
|
d988fb849d | ||
|
|
ab83d90dd3 | ||
|
|
79c5cff926 | ||
|
|
5522c33924 | ||
|
|
93aa429cf2 | ||
|
|
fa5c4c0218 | ||
|
|
32691c6af4 | ||
|
|
5615ffc518 | ||
|
|
2af41cf68d | ||
|
|
0cdaf8cff8 | ||
|
|
7b5eafc42a | ||
|
|
59ca1d2082 | ||
|
|
0df88973c0 | ||
|
|
e54bb5d4ea | ||
|
|
824f155804 | ||
|
|
24e2cf668e | ||
|
|
f260099bfa | ||
|
|
855d359b02 | ||
|
|
abcb180689 | ||
|
|
507adb1b3f | ||
|
|
23c4e4ed91 | ||
|
|
e5057788a8 | ||
|
|
a5045bfc0f | ||
|
|
bfd678c63e | ||
|
|
320ea99090 | ||
|
|
08f16ba26d | ||
|
|
9419dc82de | ||
|
|
2d1f64c5f6 | ||
|
|
cd9f82001c | ||
|
|
f7b8435d28 | ||
|
|
013806f158 | ||
|
|
062b5ee75f | ||
|
|
56adc25fdf | ||
|
|
df375b1b30 | ||
|
|
789da29af0 | ||
|
|
e0df2f84a0 | ||
|
|
01656f13a6 | ||
|
|
b466e9ce4a | ||
|
|
60c9dad874 | ||
|
|
d734ca55e6 | ||
|
|
f16f349f10 | ||
|
|
66561ac66d | ||
|
|
ad96e21b37 | ||
|
|
3967d21b06 | ||
|
|
2a025254a0 | ||
|
|
97bfbe2213 | ||
|
|
98c56973db | ||
|
|
b83da5c628 | ||
|
|
4a2af4743f | ||
|
|
e90771e38a | ||
|
|
9c98a6a00b | ||
|
|
75a3a7b935 | ||
|
|
99020cde7f | ||
|
|
98e13299d6 | ||
|
|
010fe4662a | ||
|
|
92ee6dbc0d | ||
|
|
98c7b3b5ed | ||
|
|
507b03043e | ||
|
|
c1e00ff395 | ||
|
|
897123c883 | ||
|
|
0ed33cf9a3 | ||
|
|
8ba8c0fb17 | ||
|
|
9c40b03751 | ||
|
|
194c0a0e77 | ||
|
|
77157aa9cb | ||
|
|
f4681d251c | ||
|
|
96cc1b869c | ||
|
|
20ca044be0 | ||
|
|
6cd9f33c3f | ||
|
|
7585c6a265 | ||
|
|
91a5084bde | ||
|
|
0876a50be2 | ||
|
|
1941690330 | ||
|
|
bbd39ea5c7 | ||
|
|
53f4107ee3 | ||
|
|
6265c01f60 | ||
|
|
b9478e16b7 | ||
|
|
2cdee67624 | ||
|
|
58fe331fe3 | ||
|
|
a4d5117a97 | ||
|
|
32a9a6ff5c | ||
|
|
9f2f2ed85b | ||
|
|
22258c2dac | ||
|
|
e0c1c538aa | ||
|
|
825768e522 | ||
|
|
dd21d83ea3 | ||
|
|
d0ead16eaa | ||
|
|
1d924d5ed5 | ||
|
|
ff7adac9e1 | ||
|
|
45993f8213 | ||
|
|
33573fea20 | ||
|
|
178142bf7a | ||
|
|
5d2aaea757 | ||
|
|
fbb02e43f5 | ||
|
|
896767ae1b | ||
|
|
d11034e4aa | ||
|
|
cc64b09ad4 | ||
|
|
d5ebc02999 | ||
|
|
8415b657f2 | ||
|
|
962a17494c |
No files matched your search
+3
-3
@@ -1,9 +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/CoFH/RedstoneFlux-API.git
|
||||
url=https://github.com/GTNewHorizons/RedstoneFlux-API.git
|
||||
[submodule "api/forestry"]
|
||||
path = api/forestry
|
||||
url = https://github.com/ForestryMC/ForestryAPI.git
|
||||
url=https://github.com/GTNewHorizons/ForestryAPI.git
|
||||
@@ -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
-1
Submodule api/forestry updated: 5e44fe9c6a...41e3cd955d.
+1
-1
Submodule api/redstoneflux updated: 10e10af214...b5771e4ef8.
+17
-11
@@ -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 }
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
mcversion=1.7.10
|
||||
forgeversion=10.13.4.1541-1.7.10
|
||||
forgeversion=10.13.4.1614-1.7.10
|
||||
version_major=4
|
||||
version_minor=2
|
||||
version_patch=2
|
||||
version_minor=4
|
||||
version_patch=0
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -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.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
|
||||
+1
-1
Submodule lang updated: cb5900228e...005c948875.
@@ -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;
|
||||
@@ -59,7 +60,7 @@ import forestry.plugins.PluginManager;
|
||||
name = "Forestry",
|
||||
version = Version.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[10.13.4.1448,);"
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);"
|
||||
+ "after:Buildcraft|Core@[6.1.7,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -113,4 +113,9 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIdOfEntity() {
|
||||
return getEntityId();
|
||||
}
|
||||
}
|
||||
@@ -98,4 +98,9 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIdOfEntity() {
|
||||
return getEntityId();
|
||||
}
|
||||
}
|
||||
@@ -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)) {
|
||||
@@ -225,7 +228,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
|
||||
if (block == cropBlock) {
|
||||
if(block instanceof IPlantable) {
|
||||
if (block instanceof IPlantable) {
|
||||
//For agricraft versions which implement IPlantable in the BlockCrop class
|
||||
block = ((IPlantable) block).getPlant(world, x, y, z);
|
||||
} else {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,16 +10,19 @@
|
||||
******************************************************************************/
|
||||
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.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.core.utils.ItemStackUtil;
|
||||
|
||||
public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
@@ -33,10 +36,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 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..
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemBeealyzer extends ItemWithGui {
|
||||
public ItemBeealyzer() {
|
||||
super(Tabs.tabApiculture);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
private final HabitatLocatorLogic locatorLogic;
|
||||
|
||||
public ItemHabitatLocator() {
|
||||
super(Tabs.tabApiculture);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setMaxStackSize(1);
|
||||
locatorLogic = new HabitatLocatorLogic();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemImprinter extends ItemWithGui {
|
||||
public ItemImprinter() {
|
||||
super(Tabs.tabApiculture);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ItemWaxCast extends ItemForestry implements ICraftingPlan {
|
||||
public ItemWaxCast() {
|
||||
super(Tabs.tabApiculture);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(10);
|
||||
setMaxDamage(16);
|
||||
setNoRepair();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,6 +36,7 @@ public class FruitProviderPod extends FruitProviderNone {
|
||||
PAPAYA((short) 2013, (short) 2014, (short) 2015);//, COCONUT((short)2016, (short)2017, (short)2018);
|
||||
|
||||
public final short[] uids;
|
||||
|
||||
EnumPodType(short stage1, short stage2, short stage3) {
|
||||
uids = new short[]{stage1, stage2, stage3};
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.arboriculture.tiles.TileArboristChest;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
@@ -46,8 +46,9 @@ public class BlockPlanks extends BlockWood {
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
EnumWoodType woodType = EnumWoodType.LARCH;
|
||||
if (meta > 0 && meta < EnumWoodType.VALUES.length)
|
||||
if (meta > 0 && meta < EnumWoodType.VALUES.length) {
|
||||
woodType = EnumWoodType.VALUES[meta];
|
||||
}
|
||||
return IconProviderWood.getPlankIcon(woodType);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.arboriculture.items.ItemBlockWoodSlab;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
@@ -19,11 +20,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
public final BlockLog logs;
|
||||
public final BlockPlanks planks;
|
||||
public final BlockSlab slabs;
|
||||
public final BlockSlab slabsDouble;
|
||||
public final BlockArbFence fences;
|
||||
public final BlockArbStairs stairs;
|
||||
public final BlockLog logsFireproof;
|
||||
public final BlockPlanks planksFireproof;
|
||||
public final BlockSlab slabsFireproof;
|
||||
public final BlockSlab slabsDoubleFireproof;
|
||||
public final BlockArbFence fencesFireproof;
|
||||
public final BlockArbStairs stairsFireproof;
|
||||
|
||||
@@ -40,9 +43,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
|
||||
planks = registerBlock(new BlockPlanks(false), ItemBlockWood.class, "planks");
|
||||
registerOreDictWildcard("plankWood", planks);
|
||||
|
||||
slabs = registerBlock(new BlockSlab(false), ItemBlockWood.class, "slabs");
|
||||
|
||||
BlockSlab blockSlab = new BlockSlab(false, false);
|
||||
BlockSlab blockSlabDouble = new BlockSlab(true, false);
|
||||
slabs = registerBlock(blockSlab, ItemBlockWoodSlab.class, "slabs", blockSlabDouble, blockSlab);
|
||||
registerOreDictWildcard("slabWood", slabs);
|
||||
|
||||
slabsDouble = registerBlock(blockSlabDouble, ItemBlockWoodSlab.class, "slabsDouble", blockSlabDouble, blockSlab);
|
||||
|
||||
fences = registerBlock(new BlockArbFence(false), ItemBlockWood.class, "fences");
|
||||
registerOreDictWildcard("fenceWood", fences);
|
||||
@@ -55,9 +62,13 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
|
||||
planksFireproof = registerBlock(new BlockPlanks(true), ItemBlockWood.class, "planksFireproof");
|
||||
registerOreDictWildcard("plankWood", planksFireproof);
|
||||
|
||||
slabsFireproof = registerBlock(new BlockSlab(true), ItemBlockWood.class, "slabsFireproof");
|
||||
|
||||
BlockSlab blockSlabFireproof = new BlockSlab(false, true);
|
||||
BlockSlab blockSlabDoubleFireproof = new BlockSlab(true, true);
|
||||
slabsFireproof = registerBlock(blockSlabFireproof, ItemBlockWoodSlab.class, "slabsFireproof", blockSlabDoubleFireproof, blockSlabFireproof);
|
||||
registerOreDictWildcard("slabWood", slabsFireproof);
|
||||
|
||||
slabsDoubleFireproof = registerBlock(blockSlabDoubleFireproof, ItemBlockWoodSlab.class, "slabsDoubleFireproof", blockSlabDoubleFireproof, blockSlabFireproof);
|
||||
|
||||
fencesFireproof = registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
|
||||
registerOreDictWildcard("fenceWood", fencesFireproof);
|
||||
|
||||
@@ -46,8 +46,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
private final boolean fireproof;
|
||||
|
||||
public BlockSlab(boolean fireproof) {
|
||||
super(false, Material.wood);
|
||||
public BlockSlab(boolean doubleSlab, boolean fireproof) {
|
||||
super(doubleSlab, Material.wood);
|
||||
|
||||
this.fireproof = fireproof;
|
||||
|
||||
@@ -61,9 +61,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
this.particleCallback = new ParticleHelper.DefaultCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
public boolean isDoubleSlab() {
|
||||
return field_150004_a;
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@@ -100,8 +99,10 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) {
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getSlab(woodType, fireproof));
|
||||
if (!isDoubleSlab()) {
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getSlab(woodType, fireproof));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -45,7 +46,6 @@ import forestry.arboriculture.genetics.alleles.AlleleFruit;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
|
||||
import forestry.arboriculture.render.IconProviderGermling;
|
||||
import forestry.arboriculture.render.IconProviderGermlingVanilla;
|
||||
import forestry.arboriculture.render.IconProviderLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.worldgen.BlockTypeLog;
|
||||
import forestry.arboriculture.worldgen.WorldGenAcacia;
|
||||
@@ -459,10 +459,10 @@ 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(0x539d12), 3, new ItemStack(Blocks.log, 1, 3)) {
|
||||
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.log, 1, 3)) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenJungle(tree);
|
||||
@@ -868,7 +868,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
.restrictHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
},
|
||||
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x9ee67f), EnumWoodType.PAPAYA) {
|
||||
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x75E675), EnumWoodType.PAPAYA) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPapaya(tree);
|
||||
@@ -893,7 +893,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Jungle, Cherry, 5);
|
||||
}
|
||||
},
|
||||
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xf0f38f), EnumWoodType.PALM) {
|
||||
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xB3F370), EnumWoodType.PALM) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenDate(tree);
|
||||
@@ -963,7 +963,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
this.branch = branch;
|
||||
|
||||
ILeafIconProvider leafIconProvider = new IconProviderLeaves(leafType, primary, secondary);
|
||||
ILeafIconProvider leafIconProvider = TreeManager.treeFactory.getLeafIconProvider(leafType, primary, secondary);
|
||||
IGermlingIconProvider germlingIconProvider = new IconProviderGermlingVanilla(vanillaMeta);
|
||||
|
||||
this.species = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, leafIconProvider, germlingIconProvider, this);
|
||||
@@ -979,7 +979,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
this.branch = branch;
|
||||
|
||||
ILeafIconProvider leafIconProvider = new IconProviderLeaves(leafType, primary, secondary);
|
||||
ILeafIconProvider leafIconProvider = TreeManager.treeFactory.getLeafIconProvider(leafType, primary, secondary);
|
||||
IGermlingIconProvider germlingIconProvider = new IconProviderGermling(uid);
|
||||
|
||||
this.species = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, leafIconProvider, germlingIconProvider, this);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ public class ItemBlockWood extends ItemBlockForestry {
|
||||
EnumWoodType woodType = getWoodType(stack);
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
|
||||
return placeWood(stack, woodType, block, player, world, x, y, z, metadata);
|
||||
}
|
||||
|
||||
public static boolean placeWood(ItemStack stack, EnumWoodType woodType, Block block, @Nullable EntityPlayer player, World world, int x, int y, int z, int metadata) {
|
||||
boolean placed = world.setBlock(x, y, z, block, metadata, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
if (!placed) {
|
||||
return false;
|
||||
@@ -117,7 +121,12 @@ public class ItemBlockWood extends ItemBlockForestry {
|
||||
if (ordinal >= 0 && ordinal < EnumWoodType.VALUES.length) {
|
||||
return EnumWoodType.VALUES[ordinal];
|
||||
}
|
||||
return null;
|
||||
return EnumWoodType.LARCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.blocks.BlockSlab;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class ItemBlockWoodSlab extends ItemBlockWood {
|
||||
private final BlockSlab slab;
|
||||
private final BlockSlab doubleSlab;
|
||||
private final boolean isDoubleSlab;
|
||||
|
||||
public ItemBlockWoodSlab(Block block, BlockSlab doubleSlab, BlockSlab slab) {
|
||||
super(block);
|
||||
this.doubleSlab = doubleSlab;
|
||||
this.slab = slab;
|
||||
this.isDoubleSlab = (block == doubleSlab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (isDoubleSlab) {
|
||||
return super.onItemUse(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
} else if (itemStack.stackSize == 0) {
|
||||
return false;
|
||||
} else if (!player.canPlayerEdit(x, y, z, side, itemStack)) {
|
||||
return false;
|
||||
} else {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int i1 = world.getBlockMetadata(x, y, z);
|
||||
boolean flag = (i1 & 8) != 0;
|
||||
|
||||
EnumWoodType blockWoodType = null;
|
||||
EnumWoodType stackWoodType = getWoodType(itemStack);
|
||||
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
|
||||
if (tile != null) {
|
||||
blockWoodType = tile.getWoodType();
|
||||
}
|
||||
|
||||
if ((side == 1 && !flag || side == 0 && flag) && block == this.slab && blockWoodType == stackWoodType) {
|
||||
if (world.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))) {
|
||||
if (placeWood(itemStack, stackWoodType, doubleSlab, player, world, x, y, z, 0)) {
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.doubleSlab.stepSound.func_150496_b(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F);
|
||||
--itemStack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (this.func_150946_a(itemStack, player, world, x, y, z, side)) {
|
||||
return true;
|
||||
} else {
|
||||
return super.onItemUse(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack itemStack) {
|
||||
int i1 = x;
|
||||
int j1 = y;
|
||||
int k1 = z;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int l1 = world.getBlockMetadata(x, y, z);
|
||||
boolean flag = (l1 & 8) != 0;
|
||||
|
||||
EnumWoodType blockWoodType = null;
|
||||
EnumWoodType stackWoodType = getWoodType(itemStack);
|
||||
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
|
||||
if (tile != null) {
|
||||
blockWoodType = tile.getWoodType();
|
||||
}
|
||||
|
||||
if ((side == 1 && !flag || side == 0 && flag) && block == this.slab && stackWoodType == blockWoodType) {
|
||||
return true;
|
||||
} else {
|
||||
if (side == 0) {
|
||||
--y;
|
||||
}
|
||||
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
|
||||
Block block1 = world.getBlock(x, y, z);
|
||||
tile = TileUtil.getTile(world, x, y, z, TileWood.class);
|
||||
if (tile == null) {
|
||||
blockWoodType = null;
|
||||
} else {
|
||||
blockWoodType = tile.getWoodType();
|
||||
}
|
||||
|
||||
if (block1 == this.slab && stackWoodType == blockWoodType) {
|
||||
return true;
|
||||
} else {
|
||||
return super.func_150936_a(world, i1, j1, k1, side, player, itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean func_150946_a(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side) {
|
||||
if (side == 0) {
|
||||
--y;
|
||||
}
|
||||
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
EnumWoodType blockWoodType = null;
|
||||
EnumWoodType stackWoodType = getWoodType(itemStack);
|
||||
TileWood tile = TileUtil.getTile(world, x, y, z, TileWood.class);
|
||||
if (tile != null) {
|
||||
blockWoodType = tile.getWoodType();
|
||||
}
|
||||
|
||||
if (block == this.slab && blockWoodType == stackWoodType) {
|
||||
if (world.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))) {
|
||||
if (placeWood(itemStack, stackWoodType, doubleSlab, player, world, x, y, z, 0)) {
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.doubleSlab.stepSound.func_150496_b(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F);
|
||||
--itemStack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemTreealyzer extends ItemWithGui {
|
||||
public ItemTreealyzer() {
|
||||
super(Tabs.tabArboriculture);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,16 +40,25 @@ public abstract class IconProviderWood {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getPlankIcon(EnumWoodType woodType) {
|
||||
if (woodType == null) {
|
||||
woodType = EnumWoodType.LARCH;
|
||||
}
|
||||
return icons[0][woodType.ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getBarkIcon(EnumWoodType woodType) {
|
||||
if (woodType == null) {
|
||||
woodType = EnumWoodType.LARCH;
|
||||
}
|
||||
return icons[1][woodType.ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getHeartIcon(EnumWoodType woodType) {
|
||||
if (woodType == null) {
|
||||
woodType = EnumWoodType.LARCH;
|
||||
}
|
||||
return icons[2][woodType.ordinal()];
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,14 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.blocks.BlockSlab;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.packets.PacketTileStream;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class TileWood extends TileEntity implements IStreamable {
|
||||
private EnumWoodType woodType;
|
||||
@@ -93,7 +95,16 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
}
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
|
||||
ItemStack itemStack = new ItemStack(block);
|
||||
int amount = 1;
|
||||
if (block instanceof BlockSlab) {
|
||||
BlockSlab blockSlab = (BlockSlab) block;
|
||||
if (blockSlab.isDoubleSlab()) {
|
||||
amount = 2;
|
||||
block = PluginArboriculture.blocks.slabs;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(block, amount);
|
||||
ItemBlockWood.saveToItemStack(woodType, itemStack);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@@ -285,8 +285,11 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
wood.setDirection(branchDirection);
|
||||
}
|
||||
}
|
||||
addWood(world, x, y, z, EnumReplaceMode.SOFT);
|
||||
branchEnds.add(new ChunkCoordinates(x, y, z));
|
||||
if (addWood(world, x, y, z, EnumReplaceMode.SOFT)) {
|
||||
branchEnds.add(new ChunkCoordinates(x, y, z));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,28 +298,30 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) {
|
||||
protected boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) {
|
||||
if (replace == EnumReplaceMode.ALL
|
||||
|| (replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startX + x, startY + y, startZ + z))
|
||||
|| world.isAirBlock(startX + x, startY + y, startZ + z)) {
|
||||
type.setBlock(world, tree, startX + x, startY + y, startZ + z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected final void clearBlock(World world, int x, int y, int z) {
|
||||
air.setBlock(world, startX + x, startY + y, startZ + z);
|
||||
}
|
||||
|
||||
protected final void addWood(World world, int x, int y, int z, EnumReplaceMode replace) {
|
||||
addBlock(world, x, y, z, wood, replace);
|
||||
protected final boolean addWood(World world, int x, int y, int z, EnumReplaceMode replace) {
|
||||
return addBlock(world, x, y, z, wood, replace);
|
||||
}
|
||||
|
||||
protected final void addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) {
|
||||
addBlock(world, x, y, z, leaf, replace);
|
||||
protected final boolean addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) {
|
||||
return addBlock(world, x, y, z, leaf, replace);
|
||||
}
|
||||
|
||||
protected final void addVine(World world, int x, int y, int z, ITreeBlockType vine) {
|
||||
addBlock(world, x, y, z, vine, EnumReplaceMode.NONE);
|
||||
protected final boolean addVine(World world, int x, int y, int z, ITreeBlockType vine) {
|
||||
return addBlock(world, x, y, z, vine, EnumReplaceMode.NONE);
|
||||
}
|
||||
|
||||
protected final void addVines(World world, int x, int y, int z, float chance) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
|
||||
public class TickHandlerCoreClient {
|
||||
@@ -24,18 +25,30 @@ public class TickHandlerCoreClient {
|
||||
private boolean hasNaturalistEye;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(PlayerTickEvent event) {
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase != Phase.END) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = event.player;
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (minecraft == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = minecraft.thePlayer;
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasNaturalistEye = GeneticsUtil.hasNaturalistEye(player);
|
||||
if (this.hasNaturalistEye != hasNaturalistEye) {
|
||||
this.hasNaturalistEye = hasNaturalistEye;
|
||||
Proxies.common.getClientInstance().renderGlobal.markBlockRangeForRenderUpdate(
|
||||
(int) player.posX - 32, (int) player.posY - 32, (int) player.posZ - 32,
|
||||
(int) player.posX + 32, (int) player.posY + 32, (int) player.posZ + 32);
|
||||
RenderGlobal renderGlobal = minecraft.renderGlobal;
|
||||
if (renderGlobal != null) {
|
||||
renderGlobal.markBlockRangeForRenderUpdate(
|
||||
(int) player.posX - 32, (int) player.posY - 32, (int) player.posZ - 32,
|
||||
(int) player.posX + 32, (int) player.posY + 32, (int) player.posZ + 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
if (this.owner != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a(nbt, owner);
|
||||
nbt.removeTag("Properties");
|
||||
data.setTag("owner", nbt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,6 @@ package forestry.core.access;
|
||||
|
||||
public interface IRestrictedAccess {
|
||||
IAccessHandler getAccessHandler();
|
||||
|
||||
void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess);
|
||||
}
|
||||
@@ -22,12 +22,12 @@ import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public abstract class BlockRegistry {
|
||||
protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name) {
|
||||
protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name, Object... itemCtorArgs) {
|
||||
if (PluginManager.getStage() != PluginManager.Stage.SETUP) {
|
||||
throw new RuntimeException("Tried to register Block outside of Setup");
|
||||
}
|
||||
block.setBlockName("for." + name);
|
||||
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block));
|
||||
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block), itemCtorArgs);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
|
||||
}
|
||||
|
||||
private void syncToPlayer(Collection<String> discoveredSpecies, Collection<String> discoveredMutations, Collection<String> researchedMutations) {
|
||||
if (world != null && username != null) {
|
||||
if (world != null && username != null && username.getName() != null) {
|
||||
EntityPlayer player = world.getPlayerEntityByName(username.getName());
|
||||
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer)) {
|
||||
IBreedingTracker breedingTracker = getBreedingTracker(player);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+21
-6
@@ -10,17 +10,23 @@
|
||||
******************************************************************************/
|
||||
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.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.core.utils.ItemStackUtil;
|
||||
|
||||
public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
|
||||
private final ItemStack blockRequired;
|
||||
@@ -30,17 +36,26 @@ 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;
|
||||
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 InventoryUtil.isItemEqual(blockRequired, stk, true, true) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+24
-18
@@ -10,20 +10,21 @@
|
||||
******************************************************************************/
|
||||
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.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;
|
||||
@@ -41,27 +42,32 @@ 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;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static void openGui(EntityPlayer entityplayer, IGuiHandlerEntity guiHandler, short data) {
|
||||
int guiData = encodeGuiData(guiHandler, data);
|
||||
entityplayer.openGui(ForestryAPI.instance, guiData, entityplayer.worldObj, guiHandler.getEntityId(), 0, 0);
|
||||
entityplayer.openGui(ForestryAPI.instance, guiData, entityplayer.worldObj, guiHandler.getIdOfEntity(), 0, 0);
|
||||
}
|
||||
|
||||
public static void openGui(EntityPlayer entityplayer, IGuiHandlerItem guiHandler) {
|
||||
|
||||
@@ -17,5 +17,6 @@ public interface IGuiHandlerEntity extends IGuiHandlerForestry {
|
||||
|
||||
Object getContainer(EntityPlayer player, int data);
|
||||
|
||||
int getEntityId();
|
||||
// can't be named getEntityId() for obfuscation reasons
|
||||
int getIdOfEntity();
|
||||
}
|
||||
@@ -16,9 +16,11 @@ package forestry.core.gui.buttons;
|
||||
public interface IButtonTextureSet {
|
||||
|
||||
int getX();
|
||||
|
||||
int getY();
|
||||
|
||||
int getHeight();
|
||||
|
||||
int getWidth();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SlotWorking extends SlotForestry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasStack() {
|
||||
public boolean canTakeStack(EntityPlayer stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,11 @@ import forestry.core.utils.StringUtil;
|
||||
public class ItemOverlay extends ItemForestry {
|
||||
public interface IOverlayInfo {
|
||||
String getName();
|
||||
|
||||
int getPrimaryColor();
|
||||
|
||||
int getSecondaryColor();
|
||||
|
||||
boolean isSecret();
|
||||
}
|
||||
|
||||
@@ -81,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 {
|
||||
@@ -90,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
|
||||
@@ -109,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();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,11 +21,7 @@ import forestry.core.gui.IGuiHandlerItem;
|
||||
|
||||
public abstract class ItemWithGui extends ItemForestry implements IGuiHandlerItem {
|
||||
public ItemWithGui() {
|
||||
|
||||
}
|
||||
|
||||
public ItemWithGui(CreativeTabs creativeTabs) {
|
||||
super(creativeTabs);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,6 +61,7 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
|
||||
if (this.owner != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a(nbt, owner);
|
||||
nbt.removeTag("Properties");
|
||||
data.setTag("owner", nbt);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,6 @@ import java.io.IOException;
|
||||
|
||||
public interface IStreamableGui {
|
||||
void writeGuiData(DataOutputStreamForestry data) throws IOException;
|
||||
|
||||
void readGuiData(DataInputStreamForestry data) throws IOException;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,10 @@ import forestry.energy.EnergyManager;
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
|
||||
public abstract class TileEngine extends TileBase implements IEnergyConnection, IActivatable {
|
||||
private static final int CANT_SEND_ENERGY_TIME = 20;
|
||||
|
||||
private boolean active = false; // Used for smp.
|
||||
private int cantSendEnergyCountdown = CANT_SEND_ENERGY_TIME;
|
||||
/**
|
||||
* Indicates whether the piston is receding from or approaching the
|
||||
* combustion chamber
|
||||
@@ -147,8 +149,14 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
if (energyManager.canSendEnergy(getOrientation(), tile)) {
|
||||
stagePiston = 1; // If we can transfer energy, start running
|
||||
setActive(true);
|
||||
cantSendEnergyCountdown = CANT_SEND_ENERGY_TIME;
|
||||
} else {
|
||||
setActive(false);
|
||||
if (isActive()) {
|
||||
cantSendEnergyCountdown--;
|
||||
if (cantSendEnergyCountdown <= 0) {
|
||||
setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setActive(false);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ package forestry.core.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -407,6 +402,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) {
|
||||
@@ -466,7 +477,7 @@ public abstract class InventoryUtil {
|
||||
int added = addStack(inventory, stack, startSlot, slots, false);
|
||||
boolean success = all ? (added == stack.stackSize) : (added > 0);
|
||||
|
||||
if (success && doAdd) {
|
||||
if (success && doAdd) {
|
||||
addStack(inventory, stack, startSlot, slots, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 +157,8 @@ public abstract class ItemStackUtil {
|
||||
|
||||
int reqCount = 0;
|
||||
for (ItemStack offer : condensedOffered) {
|
||||
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -309,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;
|
||||
|
||||
@@ -66,7 +66,7 @@ public abstract class WorldGenBase extends WorldGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace);
|
||||
protected abstract boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace);
|
||||
|
||||
protected final void generateCuboid(World world, Vector start, Vector area, ITreeBlockType block, EnumReplaceMode replace) {
|
||||
for (int x = (int) start.x; x < (int) start.x + area.x; x++) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.gui;
|
||||
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
|
||||
@@ -36,13 +37,9 @@ public class ContainerEngineElectric extends ContainerSocketed<TileEngineElectri
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (tile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Object crafter : crafters) {
|
||||
tile.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
if (tile != null) {
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToCrafters(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,9 @@ package forestry.energy.tiles;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.blocks.IMachinePropertiesTESR;
|
||||
import forestry.core.render.IBlockRenderer;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class EngineDefinition extends MachineDefinition {
|
||||
|
||||
@@ -10,13 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
@@ -26,15 +19,25 @@ import forestry.core.circuits.ISocketable;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.tiles.TemperatureState;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.energy.gui.ContainerEngineElectric;
|
||||
import forestry.energy.gui.GuiEngineElectric;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEngineElectric extends TileEngine implements ISocketable, IInventory {
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileEngineElectric extends TileEngine implements ISocketable, IInventory, IStreamableGui {
|
||||
protected static class EuConfig {
|
||||
|
||||
public int euForCycle;
|
||||
@@ -92,6 +95,32 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
sockets.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeVarInt(currentOutput);
|
||||
data.writeVarInt(heat);
|
||||
sockets.writeData(data);
|
||||
energyManager.writeData(data);
|
||||
final boolean hasIc2EnergySink = (ic2EnergySink != null);
|
||||
data.writeBoolean(hasIc2EnergySink);
|
||||
if (hasIc2EnergySink) {
|
||||
data.writeVarInt((int) ic2EnergySink.getEnergyStored());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
currentOutput = data.readVarInt();
|
||||
heat = data.readVarInt();
|
||||
sockets.readData(data);
|
||||
energyManager.readData(data);
|
||||
final boolean hasIc2EnergySink = data.readBoolean();
|
||||
if (hasIc2EnergySink) {
|
||||
final int energyStored = data.readVarInt();
|
||||
ic2EnergySink.setEnergyStored(energyStored);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
if (ic2EnergySink != null) {
|
||||
@@ -219,35 +248,12 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
// / SMP GUI
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
|
||||
switch (i) {
|
||||
|
||||
case 0:
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 1:
|
||||
energyManager.fromGuiInt(j);
|
||||
break;
|
||||
case 2:
|
||||
heat = j;
|
||||
break;
|
||||
case 3:
|
||||
if (ic2EnergySink != null) {
|
||||
ic2EnergySink.setEnergyStored(j);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// handled by IStreamableGui
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 0, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, energyManager.toGuiInt());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 2, heat);
|
||||
if (ic2EnergySink != null) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, (short) ic2EnergySink.getEnergyStored());
|
||||
}
|
||||
// handled by IStreamableGui
|
||||
}
|
||||
|
||||
// / ENERGY CONFIG CHANGE
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -70,17 +70,21 @@ public class SqueezerRecipeManager implements ISqueezerManager {
|
||||
}
|
||||
}
|
||||
|
||||
// First try to match a specific recipe (without OreDictionary)
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
if (ItemStackUtil.containsSets(recipe.getResources(), items, false, false) > 0) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
// If that fails - try again with OreDictionary support enabled
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ISqueezerRecipe findRecipeWithIngredient(ItemStack ingredient) {
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
if (ItemStackUtil.containsSets(recipe.getResources(), items, true, false) > 0) {
|
||||
return recipe;
|
||||
for (ItemStack recipeIngredient : recipe.getResources()) {
|
||||
if (ItemStackUtil.isCraftingEquivalent(recipeIngredient, ingredient, false, false)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,11 +246,9 @@ public class NEIHandlerSqueezer extends RecipeHandlerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
ISqueezerRecipe recipe = SqueezerRecipeManager.findMatchingRecipe(new ItemStack[]{ingred});
|
||||
ISqueezerRecipe recipe = SqueezerRecipeManager.findRecipeWithIngredient(ingred);
|
||||
if (recipe != null) {
|
||||
CachedSqueezerRecipe crecipe = new CachedSqueezerRecipe(recipe);
|
||||
// Override recipe to show the right input in case it's OD
|
||||
crecipe.setIngredients(new ItemStack[]{ingred});
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I
|
||||
setEnergyPerWorkCycle(200);
|
||||
craftingInventory = new InventoryGhostCrafting<>(this, InventoryGhostCrafting.SLOT_CRAFTING_COUNT);
|
||||
setInternalInventory(new InventoryFabricator(this));
|
||||
moltenTank = new FilteredTank(2 * Constants.BUCKET_VOLUME, Fluids.GLASS.getFluid());
|
||||
moltenTank = new FilteredTank(8 * Constants.BUCKET_VOLUME, Fluids.GLASS.getFluid());
|
||||
moltenTank.tankMode = StandardTank.TankMode.INTERNAL;
|
||||
tankManager = new TankManager(this, moltenTank);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package forestry.farming.logic;
|
||||
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class CropBasicIC2Crop extends Crop {
|
||||
private final TileEntity tileEntity;
|
||||
|
||||
public CropBasicIC2Crop(World world, TileEntity tileEntity, Vect position) {
|
||||
super(world, position);
|
||||
this.tileEntity = tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCrop(Vect pos) {
|
||||
return PluginIC2.instance.canHarvestCrop(this.tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ItemStack> harvestBlock(Vect pos) {
|
||||
return PluginIC2.instance.getCropDrops(this.tileEntity);
|
||||
}
|
||||
}
|
||||
@@ -40,13 +40,14 @@ import forestry.core.utils.vect.VectUtil;
|
||||
import forestry.plugins.PluginCore;
|
||||
|
||||
public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
private static final int BRANCH_RANGE = 20;
|
||||
|
||||
public FarmLogicArboreal(IFarmHousing housing, ItemStack resource, ItemStack ground, Iterable<IFarmable> germlings) {
|
||||
super(housing, resource, ground, germlings);
|
||||
}
|
||||
|
||||
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
|
||||
@@ -172,10 +173,10 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
if (candidate.equals(position)) {
|
||||
continue;
|
||||
}
|
||||
if (Math.abs(candidate.x - start.x) > 10) {
|
||||
if (Math.abs(candidate.x - start.x) > BRANCH_RANGE) {
|
||||
continue;
|
||||
}
|
||||
if (Math.abs(candidate.z - start.z) > 10) {
|
||||
if (Math.abs(candidate.z - start.z) > BRANCH_RANGE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,26 +44,32 @@ 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()) {
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled() || PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.farmland);
|
||||
}
|
||||
if (PluginManager.Module.GROWTHCRAFT.isEnabled()) {
|
||||
if (PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.dirt);
|
||||
}
|
||||
if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.water);
|
||||
}
|
||||
|
||||
{
|
||||
Block grapeVine = GameRegistry.findBlock("Growthcraft|Grapes", "grc.grapeVine1");
|
||||
if (grapeVine != null) {
|
||||
traversalBlocksBuilder.add(grapeVine);
|
||||
}
|
||||
}
|
||||
if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.water);
|
||||
}
|
||||
|
||||
traversalBlocksBuilder.build();
|
||||
this.traversalBlocks = traversalBlocksBuilder.build();
|
||||
}
|
||||
|
||||
@@ -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()]);
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user