mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98e506cc4a | ||
|
|
ecfb11c096 | ||
|
|
6b59736ffe | ||
|
|
a3a1f7720e | ||
|
|
89cfbfca9c | ||
|
|
e0676030d6 | ||
|
|
0c76e22b8a |
No files matched your search
+4
-4
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.0.2005-1.10.0
|
||||
forgeversion=12.18.1.2044
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
tesla_version=1.9.4-1.1.0.24
|
||||
tesla_version=1.10.2-1.2.1.41
|
||||
jei_version=3.7.3.221
|
||||
ic2_version=2.6.5-ex110
|
||||
ic2_version=2.6.15-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=4
|
||||
version_patch=7
|
||||
@@ -7,6 +7,7 @@ package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -18,7 +19,7 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
@@ -39,10 +40,6 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
int getBlockLightValue();
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
@@ -50,8 +47,6 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
Biome getBiome();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "4.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -13,5 +13,7 @@ public interface IClimateManager {
|
||||
float getTemperature(World world, BlockPos pos);
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
@@ -8,22 +8,10 @@ package forestry.api.fuels;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class EngineBronzeFuel {
|
||||
/**
|
||||
* Item that is valid fuel for a biogas engine.
|
||||
*/
|
||||
public final Fluid liquid;
|
||||
/**
|
||||
* Power produced by this fuel per work cycle of the engine.
|
||||
*/
|
||||
public final int powerPerCycle;
|
||||
/**
|
||||
* How many work cycles a single "stack" of this type lasts.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
/**
|
||||
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
|
||||
*/
|
||||
public final int dissipationMultiplier;
|
||||
private final Fluid liquid;
|
||||
private final int powerPerCycle;
|
||||
private final int burnDuration;
|
||||
private final int dissipationMultiplier;
|
||||
|
||||
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
|
||||
this.liquid = liquid;
|
||||
@@ -31,4 +19,32 @@ public class EngineBronzeFuel {
|
||||
this.burnDuration = burnDuration;
|
||||
this.dissipationMultiplier = dissipationMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a biogas engine.
|
||||
*/
|
||||
public Fluid getLiquid() {
|
||||
return liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power produced by this fuel per work cycle of the engine.
|
||||
*/
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* How many work cycles a single "stack" of this type lasts.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
|
||||
*/
|
||||
public int getDissipationMultiplier() {
|
||||
return dissipationMultiplier;
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,9 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class EngineCopperFuel {
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a peat-fired engine.
|
||||
*/
|
||||
public final ItemStack fuel;
|
||||
/**
|
||||
* Power produced by this fuel per work cycle.
|
||||
*/
|
||||
public final int powerPerCycle;
|
||||
/**
|
||||
* Amount of work cycles this item lasts before being consumed.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
private final ItemStack fuel;
|
||||
private final int powerPerCycle;
|
||||
private final int burnDuration;
|
||||
|
||||
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
|
||||
this.fuel = fuel;
|
||||
@@ -28,4 +19,24 @@ public class EngineCopperFuel {
|
||||
this.burnDuration = burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is valid fuel for a peat-fired engine.
|
||||
*/
|
||||
public ItemStack getFuel() {
|
||||
return fuel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Power produced by this fuel per work cycle.
|
||||
*/
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of work cycles this item lasts before being consumed.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,34 @@ package forestry.api.fuels;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FermenterFuel {
|
||||
/**
|
||||
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
|
||||
*/
|
||||
public final ItemStack item;
|
||||
/**
|
||||
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
|
||||
*/
|
||||
public final int fermentPerCycle;
|
||||
/**
|
||||
* Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
public final int burnDuration;
|
||||
private final ItemStack item;
|
||||
private final int fermentPerCycle;
|
||||
private final int burnDuration;
|
||||
|
||||
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
|
||||
this.item = item;
|
||||
this.fermentPerCycle = fermentPerCycle;
|
||||
this.burnDuration = burnDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
|
||||
*/
|
||||
public int getFermentPerCycle() {
|
||||
return fermentPerCycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount of work cycles a single item of this fuel lasts before expiring.
|
||||
*/
|
||||
public int getBurnDuration() {
|
||||
return burnDuration;
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,9 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class GeneratorFuel {
|
||||
|
||||
/**
|
||||
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
|
||||
*/
|
||||
public final FluidStack fuelConsumed;
|
||||
/**
|
||||
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
|
||||
*/
|
||||
public final int eu;
|
||||
/**
|
||||
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
|
||||
*/
|
||||
public final int rate;
|
||||
private final FluidStack fuelConsumed;
|
||||
private final int eu;
|
||||
private final int rate;
|
||||
|
||||
public GeneratorFuel(FluidStack fuelConsumed, int eu, int rate) {
|
||||
this.fuelConsumed = fuelConsumed;
|
||||
@@ -28,4 +19,24 @@ public class GeneratorFuel {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
|
||||
*/
|
||||
public FluidStack getFuelConsumed() {
|
||||
return fuelConsumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
|
||||
*/
|
||||
public int getEu() {
|
||||
return eu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
|
||||
*/
|
||||
public int getRate() {
|
||||
return rate;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,10 @@ package forestry.api.fuels;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MoistenerFuel {
|
||||
/**
|
||||
* The item to use
|
||||
*/
|
||||
public final ItemStack item;
|
||||
/**
|
||||
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
|
||||
*/
|
||||
public final ItemStack product;
|
||||
/**
|
||||
* How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
*/
|
||||
public final int moistenerValue;
|
||||
/**
|
||||
* What stage this product represents. Resources with lower stage value will be consumed first.
|
||||
*/
|
||||
public final int stage;
|
||||
private final ItemStack item;
|
||||
private final ItemStack product;
|
||||
private final int moistenerValue;
|
||||
private final int stage;
|
||||
|
||||
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
|
||||
this.item = item;
|
||||
@@ -31,4 +19,32 @@ public class MoistenerFuel {
|
||||
this.stage = stage;
|
||||
this.moistenerValue = moistenerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item to use
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
|
||||
*/
|
||||
public ItemStack getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* How much this item contributes to the final product of the moistener (i.e. mycelium)
|
||||
*/
|
||||
public int getMoistenerValue() {
|
||||
return moistenerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* What stage this product represents. Resources with lower stage value will be consumed first.
|
||||
*/
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "2.0.1", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
|
||||
package forestry.api.fuels;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -15,7 +16,7 @@ public interface IMutationCondition {
|
||||
* Most will return 1 if the condition is met and 0 otherwise,
|
||||
* but the float offers flexibility for more advanced conditions.
|
||||
*/
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate);
|
||||
|
||||
/**
|
||||
* A localized description of the mutation condition. (i.e. "A temperature of HOT is required.")
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IButterflyNursery extends IHousing {
|
||||
public interface IButterflyNursery extends IHousing, IClimateProvider {
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BeeMutation extends Mutation implements IBeeMutation, IBeeMutationB
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1, housing);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.DefaultClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -40,7 +42,7 @@ public class TreeMutation extends Mutation implements ITreeMutation, ITreeMutati
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1) {
|
||||
float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, pos));
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,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;
|
||||
@@ -55,6 +58,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class TileLeaves extends TileTreeContainer implements IPollinatable, IFruitBearer, IButterflyNursery, IRipeningPacketReceiver {
|
||||
@@ -495,4 +499,19 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
ITree tree = getTree();
|
||||
return !isDestroyed(tree, damage) && caterpillar == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
return worldObj.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(worldObj.getBiome(pos), worldObj, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(worldObj, pos));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -42,4 +43,8 @@ public class ClimateManager implements IClimateManager{
|
||||
return biome.getRainfall();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateProvider getDefaultClimate(World world, BlockPos pos) {
|
||||
return new DefaultClimateProvider(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class DefaultClimateProvider implements IClimateProvider {
|
||||
private World world;
|
||||
private BlockPos pos;
|
||||
|
||||
public DefaultClimateProvider(World world, BlockPos pos) {
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
return world.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(world.getBiome(pos), world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(world, pos));
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class BlockBogEarth extends Block implements IItemModelRegister, IBlockWi
|
||||
SoilType type = SoilType.fromMaturity(maturity);
|
||||
|
||||
if (type == SoilType.PEAT) {
|
||||
ret.add(PluginCore.items.peat.getItemStack());
|
||||
ret.add(PluginCore.items.peat.getItemStack(2));
|
||||
ret.add(new ItemStack(Blocks.DIRT));
|
||||
} else {
|
||||
ret.add(new ItemStack(this, 1, SoilType.BOG_EARTH.ordinal()));
|
||||
|
||||
@@ -23,6 +23,8 @@ public class Constants implements IForestryConstants {
|
||||
public static final String VERSION = "@VERSION@";
|
||||
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
|
||||
|
||||
public static final String TESLA_MOD_ID = "tesla";
|
||||
|
||||
public static final int FLAG_BLOCK_UPDATE = 1;
|
||||
public static final int FLAG_BLOCK_SYNC = 2;
|
||||
|
||||
@@ -89,10 +91,10 @@ public class Constants implements IForestryConstants {
|
||||
public static final int ENGINE_BRONZE_HEAT_LOSS_OVERHEATING = 5;
|
||||
public static final int ENGINE_BRONZE_HEAT_GENERATION_ENERGY = 1;
|
||||
|
||||
public static final int ENGINE_COPPER_CYCLE_DURATION_PEAT = 5000;
|
||||
public static final int ENGINE_COPPER_FUEL_VALUE_PEAT = 10;
|
||||
public static final int ENGINE_COPPER_CYCLE_DURATION_BITUMINOUS_PEAT = 6000;
|
||||
public static final int ENGINE_COPPER_FUEL_VALUE_BITUMINOUS_PEAT = 20;
|
||||
public static final int ENGINE_COPPER_CYCLE_DURATION_PEAT = 2500;
|
||||
public static final int ENGINE_COPPER_FUEL_VALUE_PEAT = 20;
|
||||
public static final int ENGINE_COPPER_CYCLE_DURATION_BITUMINOUS_PEAT = 3000;
|
||||
public static final int ENGINE_COPPER_FUEL_VALUE_BITUMINOUS_PEAT = 40;
|
||||
public static final int ENGINE_COPPER_HEAT_MAX = 10000;
|
||||
public static final int ENGINE_COPPER_ASH_FOR_ITEM = 7500;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
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 IMutation, IMutationBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
protected float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
float mutationChance = chance;
|
||||
for (IMutationCondition mutationCondition : mutationConditions) {
|
||||
mutationChance *= mutationCondition.getChance(world, pos, allele0, allele1, genome0, genome1);
|
||||
mutationChance *= mutationCondition.getChance(world, pos, allele0, allele1, genome0, genome1, climate);
|
||||
if (mutationChance == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -34,8 +35,8 @@ public class MutationConditionBiome implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
Biome biome = climate.getBiome();
|
||||
for (BiomeDictionary.Type type : validBiomeTypes) {
|
||||
if (BiomeDictionary.isBiomeOfType(biome, type)) {
|
||||
return 1;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class MutationConditionDaytime implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
if (world.isDaytime() == daytime) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -31,8 +32,8 @@ public class MutationConditionHumidity implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(world, pos));
|
||||
public float getChance(World world, BlockPos pos, 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;
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
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;
|
||||
@@ -54,7 +55,7 @@ public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
TileEntity tile;
|
||||
do {
|
||||
pos = pos.down();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -32,9 +33,9 @@ public class MutationConditionTemperature implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
Biome biome = world.getBiomeProvider().getBiome(pos);
|
||||
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome, world, pos);
|
||||
EnumTemperature biomeTemperature = climate.getTemperature();
|
||||
|
||||
if (biomeTemperature.ordinal() < minTemperature.ordinal() || biomeTemperature.ordinal() > maxTemperature.ordinal()) {
|
||||
return 0;
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.core.genetics.mutations;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class MutationConditionTimeLimited implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
DayMonth now = new DayMonth();
|
||||
|
||||
// If we are equal to start day, return 1.
|
||||
|
||||
@@ -93,5 +93,6 @@ public class GameTokenWidget extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
game.choose(index);
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ public class ProbeButton extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
pressed = true;
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(-1, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,11 @@ import java.io.File;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -92,4 +95,11 @@ public class ProxyClient extends ProxyCommon {
|
||||
public EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playButtonClick() {
|
||||
Minecraft minecraft = getClientInstance();
|
||||
SoundHandler soundHandler = minecraft.getSoundHandler();
|
||||
soundHandler.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
}
|
||||
}
|
||||
@@ -86,4 +86,8 @@ public class ProxyCommon {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void playButtonClick() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package forestry.energy;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
@@ -14,7 +15,6 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
@@ -23,9 +23,9 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = "Tesla")
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = Constants.TESLA_MOD_ID)
|
||||
})
|
||||
public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaProducer, ITeslaHolder, IEnergyProvider, IStreamable {
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
@@ -259,13 +259,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return null;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
public static int sendEnergyTesla(TileEntity tile, EnumFacing side, int amount, boolean simulate) {
|
||||
ITeslaConsumer consumer = tile.getCapability(TESLA_CONSUMER, side);
|
||||
return (int) consumer.givePower(amount, simulate);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long givePower(long power, boolean simulated) {
|
||||
if (!canReceive()) {
|
||||
@@ -274,7 +274,7 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.receiveEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long takePower(long power, boolean simulated) {
|
||||
if (!canExtract()) {
|
||||
@@ -283,13 +283,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.extractEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getStoredPower() {
|
||||
return energyStorage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return energyStorage.getMaxEnergyStored();
|
||||
|
||||
@@ -14,7 +14,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.energy.EnergyManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
@@ -163,7 +162,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
FluidStack fuelFluidStack = fuelTank.getFluid();
|
||||
EngineBronzeFuel fuel = FuelManager.bronzeEngineFuel.get(fuelFluidStack.getFluid());
|
||||
if (fuel != null) {
|
||||
loss = loss * fuel.dissipationMultiplier;
|
||||
loss = loss * fuel.getDissipationMultiplier();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +196,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
*/
|
||||
private static int determineFuelValue(Fluid fluid) {
|
||||
if (FuelManager.bronzeEngineFuel.containsKey(fluid)) {
|
||||
return FuelManager.bronzeEngineFuel.get(fluid).powerPerCycle;
|
||||
return FuelManager.bronzeEngineFuel.get(fluid).getPowerPerCycle();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -208,7 +207,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
*/
|
||||
private static int determineBurnTime(Fluid fluid) {
|
||||
if (FuelManager.bronzeEngineFuel.containsKey(fluid)) {
|
||||
return FuelManager.bronzeEngineFuel.get(fluid).burnDuration;
|
||||
return FuelManager.bronzeEngineFuel.get(fluid).getBurnDuration();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -122,9 +122,10 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
|
||||
if (fuelSlot >= 0 && wasteSlot >= 0) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
burnTime = totalBurnTime = determineBurnDuration(inventory.getStackInSlot(fuelSlot));
|
||||
if (burnTime > 0) {
|
||||
fuelItem = inventory.getStackInSlot(fuelSlot).getItem();
|
||||
ItemStack fuelStack = inventory.getStackInSlot(fuelSlot);
|
||||
burnTime = totalBurnTime = determineBurnDuration(fuelStack);
|
||||
if (burnTime > 0 && fuelStack != null) {
|
||||
fuelItem = fuelStack.getItem();
|
||||
decrStackSize(fuelSlot, 1);
|
||||
}
|
||||
}
|
||||
@@ -179,10 +180,11 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
int wasteSlot = getFreeWasteSlot();
|
||||
if (wasteSlot >= 0) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.getStackInSlot(wasteSlot) == null) {
|
||||
ItemStack wasteStack = inventory.getStackInSlot(wasteSlot);
|
||||
if (wasteStack == null) {
|
||||
inventory.setInventorySlotContents(wasteSlot, PluginCore.items.ash.getItemStack());
|
||||
} else {
|
||||
inventory.getStackInSlot(wasteSlot).stackSize++;
|
||||
wasteStack.stackSize++;
|
||||
}
|
||||
}
|
||||
// Reset
|
||||
@@ -196,7 +198,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
*/
|
||||
private static int determineFuelValue(ItemStack fuel) {
|
||||
if (FuelManager.copperEngineFuel.containsKey(fuel)) {
|
||||
return FuelManager.copperEngineFuel.get(fuel).powerPerCycle;
|
||||
return FuelManager.copperEngineFuel.get(fuel).getPowerPerCycle();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -207,7 +209,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
*/
|
||||
private static int determineBurnDuration(ItemStack fuel) {
|
||||
if (FuelManager.copperEngineFuel.containsKey(fuel)) {
|
||||
return FuelManager.copperEngineFuel.get(fuel).burnDuration;
|
||||
return FuelManager.copperEngineFuel.get(fuel).getBurnDuration();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -142,13 +142,13 @@ public class TileEuGenerator extends TileBase implements ISidedInventory, ILiqui
|
||||
|
||||
if (resourceTank.getFluidAmount() > 0) {
|
||||
GeneratorFuel fuel = FuelManager.generatorFuel.get(resourceTank.getFluid().getFluid());
|
||||
if (resourceTank.canDrainFluidType(fuel.fuelConsumed) && ic2EnergySource.getFreeCapacity() >= fuel.eu) {
|
||||
ic2EnergySource.addEnergy(fuel.eu);
|
||||
if (resourceTank.canDrainFluidType(fuel.getFuelConsumed()) && ic2EnergySource.getFreeCapacity() >= fuel.getEu()) {
|
||||
ic2EnergySource.addEnergy(fuel.getEu());
|
||||
this.tickCount++;
|
||||
|
||||
if (tickCount >= fuel.rate) {
|
||||
if (tickCount >= fuel.getRate()) {
|
||||
tickCount = 0;
|
||||
resourceTank.drain(fuel.fuelConsumed.amount, true);
|
||||
resourceTank.drain(fuel.getFuelConsumed().amount, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.buttons.GuiBetterButton;
|
||||
@@ -23,6 +20,8 @@ import forestry.factory.gui.widgets.ClearWorktable;
|
||||
import forestry.factory.gui.widgets.MemorizedRecipeSlot;
|
||||
import forestry.factory.recipes.RecipeMemory;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWorktable> {
|
||||
private static final int SPACING = 18;
|
||||
@@ -71,5 +70,6 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
int id = 100 + button.id;
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(id, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.factory.gui.widgets;
|
||||
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
|
||||
public class ClearWorktable extends Widget {
|
||||
@@ -29,5 +30,6 @@ public class ClearWorktable extends Widget {
|
||||
@Override
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
ContainerWorktable.clearRecipe();
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ public class MemorizedRecipeSlot extends ItemStackWidgetBase {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
if (getItemStack() != null) {
|
||||
ContainerWorktable.sendRecipeClick(mouseButton, slotNumber);
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRecipeWrapper> {
|
||||
|
||||
@@ -75,7 +74,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRec
|
||||
guiItemStacks.set(resourceSlot, recipeWrapper.getFermentable());
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
fuels.add(fuel.item);
|
||||
fuels.add(fuel.getItem());
|
||||
}
|
||||
guiItemStacks.set(fuelSlot, fuels);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterReci
|
||||
public List getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
inputs.add(fuel.item);
|
||||
inputs.add(fuel.getItem());
|
||||
}
|
||||
inputs.add(fermentable);
|
||||
return inputs;
|
||||
|
||||
@@ -74,10 +74,10 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
MoistenerRecipeWrapper wrapper = (MoistenerRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(resourceSlot, wrapper.getRecipe().getResource());
|
||||
guiItemStacks.set(fuelItemSlot, wrapper.getFuel().item);
|
||||
guiItemStacks.set(fuelItemSlot, wrapper.getFuel().getItem());
|
||||
|
||||
guiItemStacks.set(productSlot, wrapper.getRecipe().getProduct());
|
||||
guiItemStacks.set(fuelProductSlot, wrapper.getFuel().product);
|
||||
guiItemStacks.set(fuelProductSlot, wrapper.getFuel().getProduct());
|
||||
|
||||
guiFluidStacks.set(inputTank, FluidRegistry.getFluidStack("water", 10000));
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MoistenerRecipeHandler implements IRecipeHandler<MoistenerRecipeWra
|
||||
if (recipe.getProduct() == null) {
|
||||
return false;
|
||||
}
|
||||
return wrapper.getFuel() != null || wrapper.getFuel().item != null || wrapper.getFuel().product != null;
|
||||
return wrapper.getFuel() != null || wrapper.getFuel().getItem() != null || wrapper.getFuel().getProduct() != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,8 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
|
||||
public List<ItemStack> getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
inputs.add(getRecipe().getResource());
|
||||
if (fuel.item != null) {
|
||||
inputs.add(fuel.item);
|
||||
if (fuel.getItem() != null) {
|
||||
inputs.add(fuel.getItem());
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
@@ -36,8 +36,8 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
|
||||
public List<ItemStack> getOutputs() {
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
outputs.add(getRecipe().getProduct());
|
||||
if (fuel.product != null) {
|
||||
outputs.add(fuel.product);
|
||||
if (fuel.getProduct() != null) {
|
||||
outputs.add(fuel.getProduct());
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
return;
|
||||
}
|
||||
|
||||
fuelBurnTime = fuelTotalTime = fermenterFuel.burnDuration;
|
||||
fuelCurrentFerment = fermenterFuel.fermentPerCycle;
|
||||
fuelBurnTime = fuelTotalTime = fermenterFuel.getBurnDuration();
|
||||
fuelCurrentFerment = fermenterFuel.getFermentPerCycle();
|
||||
|
||||
decrStackSize(InventoryFermenter.SLOT_FUEL, 1);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
|
||||
if (FuelManager.moistenerResource.containsKey(getStackInSlot(InventoryMoistener.SLOT_WORKING))) {
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(getStackInSlot(InventoryMoistener.SLOT_WORKING));
|
||||
burnTime = totalTime = res.moistenerValue;
|
||||
burnTime = totalTime = res.getMoistenerValue();
|
||||
}
|
||||
} else {
|
||||
rotateReservoir();
|
||||
@@ -302,8 +302,8 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
}
|
||||
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(slotStack);
|
||||
if (stage < 0 || res.stage < stage) {
|
||||
stage = res.stage;
|
||||
if (stage < 0 || res.getStage() < stage) {
|
||||
stage = res.getStage();
|
||||
resourceSlot = i;
|
||||
}
|
||||
}
|
||||
@@ -320,7 +320,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
ItemStack deposit;
|
||||
if (FuelManager.moistenerResource.containsKey(getStackInSlot(InventoryMoistener.SLOT_WORKING))) {
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(getStackInSlot(InventoryMoistener.SLOT_WORKING));
|
||||
deposit = res.product.copy();
|
||||
deposit = res.getProduct().copy();
|
||||
} else {
|
||||
deposit = getStackInSlot(InventoryMoistener.SLOT_WORKING).copy();
|
||||
}
|
||||
@@ -423,7 +423,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
}
|
||||
if (FuelManager.moistenerResource.containsKey(inventory.getStackInSlot(i))) {
|
||||
MoistenerFuel res = FuelManager.moistenerResource.get(inventory.getStackInSlot(i));
|
||||
if (res.item.isItemEqual(inventory.getStackInSlot(i))) {
|
||||
if (res.getItem().isItemEqual(inventory.getStackInSlot(i))) {
|
||||
max += 64;
|
||||
avail += inventory.getStackInSlot(i).stackSize;
|
||||
}
|
||||
|
||||
@@ -10,20 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableCollection;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
public class CropRubber extends CropDestroy {
|
||||
|
||||
public CropRubber(World world, IBlockState blockState, BlockPos position) {
|
||||
@@ -34,10 +39,44 @@ public class CropRubber extends CropDestroy {
|
||||
* Convert a "wet" rubber log blockstate into the dry version.
|
||||
* Total hack since we don't have access to the blockstates.
|
||||
*/
|
||||
private static IBlockState getReplantState(IBlockState sappyState) {
|
||||
Block block = sappyState.getBlock();
|
||||
int sappyMeta = block.getMetaFromState(sappyState);
|
||||
return block.getStateFromMeta(sappyMeta - 4);
|
||||
private static <T extends Comparable<T>> IBlockState getReplantState(IBlockState sappyState) {
|
||||
if (hasRubberToHarvest(sappyState)) {
|
||||
for (Map.Entry<IProperty<?>, Comparable<?>> wetPropertyEntry : sappyState.getProperties().entrySet()) {
|
||||
String valueWetString = wetPropertyEntry.getValue().toString();
|
||||
String valueDryString = valueWetString.replace("wet", "dry");
|
||||
IProperty<?> property = wetPropertyEntry.getKey();
|
||||
|
||||
IBlockState baseState = sappyState.getBlock().getBlockState().getBaseState();
|
||||
IBlockState dryState = getStateWithValue(baseState, property, valueDryString);
|
||||
if (dryState != null) {
|
||||
return dryState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sappyState.getBlock().getDefaultState();
|
||||
}
|
||||
|
||||
public static boolean hasRubberToHarvest(IBlockState blockState) {
|
||||
Block block = blockState.getBlock();
|
||||
if (ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
ImmutableCollection<Comparable<?>> propertyValues = blockState.getProperties().values();
|
||||
for (Comparable<?> propertyValue : propertyValues) {
|
||||
if (propertyValue.toString().contains("wet")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static <T extends Comparable<T>> IBlockState getStateWithValue(IBlockState baseState, IProperty<T> property, String valueString) {
|
||||
Optional<T> value = property.parseValue(valueString);
|
||||
if (value.isPresent()) {
|
||||
return baseState.withProperty(property, value.get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,27 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmLogicRubber extends FarmLogic {
|
||||
|
||||
@@ -114,63 +109,24 @@ public class FarmLogicRubber extends FarmLogic {
|
||||
}
|
||||
|
||||
private Collection<ICrop> getHarvestBlocks(World world, BlockPos position) {
|
||||
Set<BlockPos> seen = new HashSet<>();
|
||||
Stack<ICrop> crops = new Stack<>();
|
||||
|
||||
// Determine what type we want to harvest.
|
||||
IBlockState blockState = world.getBlockState(position);
|
||||
Block block = blockState.getBlock();
|
||||
if (!ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
return crops;
|
||||
}
|
||||
for (int j = 0; j < 10; j++) {
|
||||
BlockPos candidate = position.add(0, j, 0);
|
||||
|
||||
int meta = block.getMetaFromState(blockState);
|
||||
if (meta >= 7 && meta <= 10) {
|
||||
crops.push(new CropDestroy(world, blockState, position, null));
|
||||
}
|
||||
|
||||
List<BlockPos> candidates = processHarvestBlock(world, crops, seen, position);
|
||||
List<BlockPos> temp = new ArrayList<>();
|
||||
while (!candidates.isEmpty() && crops.size() < 100) {
|
||||
for (BlockPos candidate : candidates) {
|
||||
temp.addAll(processHarvestBlock(world, crops, seen, candidate));
|
||||
IBlockState blockState = world.getBlockState(candidate);
|
||||
Block block = blockState.getBlock();
|
||||
if (!ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (CropRubber.hasRubberToHarvest(blockState)) {
|
||||
crops.push(new CropRubber(world, blockState, candidate));
|
||||
break;
|
||||
}
|
||||
candidates.clear();
|
||||
candidates.addAll(temp);
|
||||
temp.clear();
|
||||
}
|
||||
|
||||
return crops;
|
||||
}
|
||||
|
||||
private List<BlockPos> processHarvestBlock(World world, Stack<ICrop> crops, Set<BlockPos> seen, BlockPos position) {
|
||||
List<BlockPos> candidates = new ArrayList<>();
|
||||
|
||||
// Get additional candidates to return
|
||||
for (int j = 0; j < 2; j++) {
|
||||
BlockPos candidate = position.add(0, j, 0);
|
||||
if (candidate.equals(position)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// See whether the given position has already been processed
|
||||
if (seen.contains(candidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IBlockState blockState = world.getBlockState(candidate);
|
||||
Block block = blockState.getBlock();
|
||||
if (ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
int meta = block.getMetaFromState(blockState);
|
||||
if (meta >= 7 && meta <= 10) {
|
||||
crops.push(new CropRubber(world, blockState, candidate));
|
||||
}
|
||||
candidates.add(candidate);
|
||||
seen.add(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class ButterflyMutation extends Mutation implements IButterflyMutation, I
|
||||
|
||||
@Override
|
||||
public float getChance(World world, IButterflyNursery housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float processedChance = super.getChance(world, housing.getCoordinates(), allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housing.getCoordinates(), allele0, allele1, genome0, genome1, housing);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class AddresseeSlot extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
if (!containerLetter.getLetter().isProcessed()) {
|
||||
containerLetter.advanceCarrierType();
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user