mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0a0ab5594 | ||
|
|
29d96db1e8 | ||
|
|
3769ec42d2 | ||
|
|
d0c1133304 | ||
|
|
c3ff59fbfb | ||
|
|
aa52b063b7 | ||
|
|
a74b3c87c4 | ||
|
|
6c38a6a28e | ||
|
|
db49d305f4 | ||
|
|
5df7b9252b | ||
|
|
f4d0979bb1 | ||
|
|
199200cb01 | ||
|
|
419cebef33 | ||
|
|
716167e3ec | ||
|
|
60debc45f3 | ||
|
|
2c04d42717 | ||
|
|
9e21ed9670 | ||
|
|
095e710bec | ||
|
|
888c5268d5 | ||
|
|
1180c16f45 | ||
|
|
dea1fb144a | ||
|
|
a01190a242 | ||
|
|
ab4489c5aa | ||
|
|
d2ea1d820c | ||
|
|
4d0dfd837e | ||
|
|
e07f10d981 | ||
|
|
d48e9484b8 | ||
|
|
3aa328a522 | ||
|
|
2b0f5bfdf4 | ||
|
|
bbe6f919c4 | ||
|
|
4441d78eb2 | ||
|
|
6d774de5a6 | ||
|
|
0a2ca1febc | ||
|
|
6d3ff67efd | ||
|
|
d37a52dcf4 | ||
|
|
c03fa0e955 | ||
|
|
66f0da433e | ||
|
|
d8c8aec2ee | ||
|
|
38189388f6 | ||
|
|
8bb1b74b1c | ||
|
|
465d32af25 | ||
|
|
13b8a023a3 | ||
|
|
54ca3488df | ||
|
|
26bf69effc | ||
|
|
8f29faa28a | ||
|
|
1e6716f8ec | ||
|
|
787395494c | ||
|
|
b0b6ffb963 | ||
|
|
d3d57ab0df | ||
|
|
375515937d | ||
|
|
6c869cab98 | ||
|
|
212f857692 | ||
|
|
c40adda51c | ||
|
|
35f7ba6153 | ||
|
|
327b7bba87 | ||
|
|
694cd8103a | ||
|
|
f50e7281c5 | ||
|
|
1034111985 | ||
|
|
0c27bf850c | ||
|
|
78489a6146 | ||
|
|
b4db0f32e4 | ||
|
|
8ad42a8918 | ||
|
|
96ed44a186 | ||
|
|
4e17804997 | ||
|
|
e391d06f32 | ||
|
|
353fcb1ba7 | ||
|
|
322327e1f4 | ||
|
|
c2ca77ecae | ||
|
|
441f57d027 | ||
|
|
2e0bb5a3b2 |
No files matched your search
@@ -161,7 +161,6 @@ curseforge {
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'beta'
|
||||
addGameVersion '1.12'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+7
-7
@@ -1,14 +1,14 @@
|
||||
mcversion=1.12.1
|
||||
forgeversion=14.22.0.2469
|
||||
mcp_mappings=snapshot_20170904
|
||||
mcversion=1.12.2
|
||||
forgeversion=14.23.0.2501
|
||||
mcp_mappings=snapshot_20170918
|
||||
curse_project_id=59751
|
||||
|
||||
tesla_version=1.0.60
|
||||
tesla_mcversion=1.12
|
||||
jei_version=4.7.8.92
|
||||
jei_mcversion=1.12.1
|
||||
jei_version=4.8.0.103
|
||||
jei_mcversion=1.12.2
|
||||
ic2_version=2.8.24-ex112
|
||||
|
||||
version_major=5
|
||||
version_minor=5
|
||||
version_patch=3
|
||||
version_minor=6
|
||||
version_patch=0
|
||||
+1
-1
Submodule lang updated: 192d6f8584...c3244f4499.
@@ -15,7 +15,6 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import forestry.plugins.compat.PluginNatura;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
@@ -33,8 +32,9 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.GameMode;
|
||||
@@ -47,6 +47,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import forestry.plugins.compat.PluginNatura;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -58,11 +59,12 @@ import forestry.plugins.compat.PluginIC2;
|
||||
name = Constants.MOD_NAME,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.12, 1.12.1]",
|
||||
dependencies = "required-after:forge@[14.21.1.2395,);"
|
||||
acceptedMinecraftVersions = "[1.12.2,1.13.0)",
|
||||
dependencies = "required-after:forge@[14.23.0.2500,);"
|
||||
+ "after:jei@[4.7.8.91,);"
|
||||
+ "after:" + PluginIC2.modId + ";"
|
||||
+ "after:" + PluginNatura.modId + ";")
|
||||
+ "after:" + PluginNatura.modId + ";"
|
||||
+ "after:toughasnails;")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -75,6 +77,7 @@ public class Forestry {
|
||||
ForestryAPI.instance = this;
|
||||
ForestryAPI.forestryConstants = new Constants();
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
ForestryAPI.states = ClimateStates.INSTANCE;
|
||||
EnumErrorCode.init();
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
@@ -96,12 +99,14 @@ public class Forestry {
|
||||
EventHandlerCore eventHandlerCore = new EventHandlerCore();
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ClimateEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(Config.class);
|
||||
Proxies.common.registerEventHandlers();
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
|
||||
Config.load(event.getSide());
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new ForestryEvent.PreInit(this, event));
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
String gameMode = Config.gameMode;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
@@ -9,15 +9,19 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Other implementations than Forestry's default one are not supported.
|
||||
@@ -85,8 +89,27 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
List<IBee> spawnDrones(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.5.4. Use {@link #plantFlowerRandom(IBeeHousing, List)}
|
||||
*/
|
||||
@Deprecated
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* Plants a random flower from the given list near the housing
|
||||
*
|
||||
* @param housing the location the bee is living
|
||||
* @param potentialFlowers the flowers to choose from
|
||||
* @return the position of the planted flower, or null of none were planted
|
||||
* @since Forestry 5.5.4
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPos plantFlowerRandom(IBeeHousing housing, List<IBlockState> potentialFlowers) {
|
||||
//noinspection deprecation
|
||||
plantFlowerRandom(housing);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ public interface IBeeFactory {
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleBeeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param modId The modId of the mod that is creating the species
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
|
||||
@@ -24,8 +25,9 @@ public interface IBeeFactory {
|
||||
* @param primaryColor The outline color of this species
|
||||
* @param secondaryColor The body color of this species
|
||||
* @return a new bee species allele.
|
||||
* @since Forestry 5.6.0.
|
||||
*/
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String modId, String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
|
||||
/**
|
||||
* Creates a new bee branch.
|
||||
@@ -36,4 +38,10 @@ public interface IBeeFactory {
|
||||
* @return a new bee branch
|
||||
*/
|
||||
IClassification createBranch(String uid, String scientific);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, boolean, String, String, String, IClassification, String, int, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
}
|
||||
@@ -8,16 +8,18 @@ package forestry.api.apiculture;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* Stores beekeeping logic for bee housings.
|
||||
* Get one with BeeManager.beeRoot.createBeekeepingLogic(IBeeHousing housing)
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
|
||||
public class ArboricultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorNaturalist}.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
@@ -5,32 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface ITreeFactory {
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleTreeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
|
||||
* @param unlocalizedDescription Unlocalized description for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
* @param branch Classification of this species
|
||||
* @param binomial Binomial name of the species sans genus. "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
|
||||
* @param modID The modID from the mod of the species
|
||||
* @param leafSpriteProvider The leaf sprite provider for this species
|
||||
* @param germlingModelProvider The germling model provider for this species
|
||||
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
|
||||
* @param generator The tree generator
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
|
||||
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
@@ -48,10 +28,18 @@ public interface ITreeFactory {
|
||||
* @param germlingModelProvider The germling model provider for this species
|
||||
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
|
||||
* @param generator The tree generator
|
||||
* @param leafProvider The leaf provider
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, ILeafProvider leafProvider);
|
||||
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, @Nullable ILeafProvider leafProvider);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, String, String, boolean, IClassification, String, String, ILeafSpriteProvider, IGermlingModelProvider, IWoodProvider, ITreeGenerator, ILeafProvider)}
|
||||
*/
|
||||
@Deprecated
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
|
||||
|
||||
|
||||
/**
|
||||
* Get one of the built-in Forestry leaf types. Default type is deciduous.
|
||||
*/
|
||||
|
||||
@@ -9,16 +9,18 @@ import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@@ -8,6 +8,7 @@ package forestry.api.circuits;
|
||||
public enum CircuitSocketType implements ICircuitSocketType {
|
||||
NONE("none"),
|
||||
FARM("forestry.farm"),
|
||||
GREENHOUSE_CLIMATISER("forestry.greenhouse.climatiser"),
|
||||
ELECTRIC_ENGINE("forestry.electric.engine"),
|
||||
MACHINE("forestry.machine");
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public enum ClimateStateType {
|
||||
DEFAULT(0.0F, 2.0F),
|
||||
EXTENDED(-3.0F, 3.0F);
|
||||
|
||||
public final float boundDown, boundUp;
|
||||
|
||||
ClimateStateType(Float boundDown, Float boundUp) {
|
||||
this.boundDown = boundDown;
|
||||
this.boundUp = boundUp;
|
||||
}
|
||||
|
||||
public float clamp(float value) {
|
||||
return MathHelper.clamp(value, boundDown, boundUp);
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -5,14 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimatiserDefinition {
|
||||
import java.util.Locale;
|
||||
|
||||
float getChange();
|
||||
|
||||
float getRange();
|
||||
|
||||
EnumClimatiserModes getMode();
|
||||
|
||||
EnumClimatiserTypes getType();
|
||||
public enum ClimateType {
|
||||
TEMPERATURE, HUMIDITY;
|
||||
|
||||
public String getName(){
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserModes {
|
||||
|
||||
POSITIVE, NEGATIVE, BOTH
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserTypes {
|
||||
|
||||
TEMPERATURE, HUMIDITY, BOTH
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimateControl {
|
||||
|
||||
IClimateInfo getControlClimate();
|
||||
|
||||
void setControlClimate(IClimateInfo climateInfo);
|
||||
|
||||
float getControlTemperature();
|
||||
|
||||
float getControlHumidity();
|
||||
|
||||
void setControlTemperature(float temperature);
|
||||
|
||||
void setControlHumidity(float humidity);
|
||||
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
/**
|
||||
* @deprecated Use IClimateState
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IClimateInfo {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
}
|
||||
@@ -5,37 +5,37 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IClimateStates#create(float, float)}
|
||||
*/
|
||||
@Deprecated
|
||||
IClimateInfo createInfo(float temperature, float humidity);
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getClimateState(World, BlockPos)}
|
||||
*/
|
||||
@Deprecated
|
||||
IClimateInfo getInfo(World world, BlockPos pos);
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
|
||||
void removeRegion(IClimateRegion region);
|
||||
|
||||
void addSource(IClimateSourceProvider source);
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
void onWorldUnload(World world);
|
||||
/**
|
||||
* Gets the current state of a container at this position or setSettings one with the datas from the biome.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
IClimateState getClimateState(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
|
||||
Map<World, List<IClimateRegion>> getRegions();
|
||||
/**
|
||||
* Creates a climate state with the help of the biome on this position.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
IClimateState getBiomeState(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return Create a climate manager.
|
||||
*/
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* A IClimatePosition contains the climate infos (temperature and humidity) of one position.
|
||||
*/
|
||||
public interface IClimatePosition extends INbtReadable, INbtWritable {
|
||||
|
||||
IClimateRegion getClimateRegion();
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
void setTemperature(float temperature);
|
||||
|
||||
void addTemperature(float temperature);
|
||||
|
||||
float getTemperature();
|
||||
|
||||
void setHumidity(float humidity);
|
||||
|
||||
void addHumidity(float humidity);
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateInfo getInfo();
|
||||
|
||||
}
|
||||
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateRegion extends INbtReadable, INbtWritable {
|
||||
|
||||
World getWorld();
|
||||
|
||||
int getTicksPerUpdate();
|
||||
|
||||
void setPosition(BlockPos pos, float temperature, float humidity);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(BlockPos pos);
|
||||
|
||||
Collection<IClimatePosition> getPositions();
|
||||
|
||||
void addSource(IClimateSource source);
|
||||
|
||||
void removeSource(IClimateSource source);
|
||||
|
||||
Collection<IClimateSource> getSources();
|
||||
|
||||
void calculateAverageClimate();
|
||||
|
||||
float getAverageTemperature();
|
||||
|
||||
float getAverageHumidity();
|
||||
|
||||
/**
|
||||
* Update the climate in a region.
|
||||
*/
|
||||
void updateClimate(int ticks);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
*/
|
||||
public interface IClimateSource {
|
||||
|
||||
/**
|
||||
* @param tickCount The current tick count.
|
||||
* @param region The climate region, in that the source stands.
|
||||
* @return Return true if the the climate has changed.
|
||||
*/
|
||||
boolean changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
/**
|
||||
* @return The ticks that are required for one change.
|
||||
*/
|
||||
int getTicksForChange(IClimateRegion region);
|
||||
|
||||
@Nullable
|
||||
IClimateSourceProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* A {@link IClimateState} is used to store and handle temperature and humidity.
|
||||
*
|
||||
* The values are oriented on the values of {@link Biome#getTemperature()} and {@link Biome#getRainfall()}.
|
||||
*/
|
||||
public interface IClimateState extends INbtWritable {
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
IClimateState addTemperature(float temperature);
|
||||
|
||||
IClimateState addHumidity(float humidity);
|
||||
|
||||
IClimateState add(IClimateState state);
|
||||
|
||||
IClimateState scale(double factor);
|
||||
|
||||
IClimateState remove(IClimateState state);
|
||||
|
||||
default float get(ClimateType type){
|
||||
return type == ClimateType.HUMIDITY ? getHumidity() : getTemperature();
|
||||
}
|
||||
|
||||
IClimateState copy(ClimateStateType type);
|
||||
|
||||
IClimateState copy();
|
||||
|
||||
boolean isPresent();
|
||||
|
||||
ClimateStateType getType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface IClimateStates {
|
||||
|
||||
IClimateState create(NBTTagCompound compound);
|
||||
|
||||
IClimateState create(NBTTagCompound compound, ClimateStateType type);
|
||||
|
||||
IClimateState create(float temperature, float humidity, ClimateStateType type);
|
||||
|
||||
IClimateState create(IClimateState climateState, ClimateStateType type);
|
||||
|
||||
IClimateState absent();
|
||||
|
||||
IClimateState min();
|
||||
|
||||
IClimateState max();
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
@API(apiVersion = "5.0.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -9,12 +9,4 @@ public class CamouflageManager {
|
||||
|
||||
public static ICamouflageAccess camouflageAccess;
|
||||
|
||||
public static final String BLOCK = "block";
|
||||
|
||||
public static final String GLASS = "glass";
|
||||
|
||||
public static final String DOOR = "door";
|
||||
|
||||
public static final String NONE = "none";
|
||||
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public enum EnumHumidity {
|
||||
*/
|
||||
DAMP("Damp");
|
||||
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
EnumHumidity(String name) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -73,7 +74,8 @@ public enum EnumTemperature {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = ForestryAPI.climateManager.getInfo(world, pos).getTemperature();
|
||||
IClimateState state = ForestryAPI.climateManager.getClimateState(world, pos);
|
||||
float temperature = state.getTemperature();
|
||||
return getFromValue(temperature);
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,14 @@ package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateStates;
|
||||
import forestry.greenhouse.api.climate.IClimateFactory;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
@@ -48,6 +51,14 @@ public class ForestryAPI {
|
||||
public static IModelManager modelManager;
|
||||
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
/**
|
||||
* A factory to create climate related things.
|
||||
* @since 5.3.4
|
||||
*/
|
||||
public static IClimateFactory climateFactory;
|
||||
|
||||
public static IClimateStates states;
|
||||
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
|
||||
|
||||
@@ -5,13 +5,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public abstract class ForestryEvent extends Event {
|
||||
|
||||
@@ -53,6 +57,21 @@ public abstract class ForestryEvent extends Event {
|
||||
this.tracker = tracker;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Posted before forestry registers all items and blocks.
|
||||
*/
|
||||
public static class PreInit extends ForestryEvent{
|
||||
/**
|
||||
* The main mod instance for Forestry.
|
||||
*/
|
||||
public Object instance;
|
||||
public final FMLPreInitializationEvent event;
|
||||
|
||||
public PreInit(Object instance, FMLPreInitializationEvent event) {
|
||||
this.instance = instance;
|
||||
this.event = event;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ package forestry.api.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICamouflageAccess {
|
||||
@@ -16,21 +18,20 @@ public interface ICamouflageAccess {
|
||||
*
|
||||
* @param itemHandler The handler that is to register.
|
||||
*/
|
||||
void registerCamouflageItemHandler(ICamouflageItemHandler itemHandler);
|
||||
void registerItemHandler(ICamouflageItemHandler itemHandler);
|
||||
|
||||
/**
|
||||
* @return A list of all item camouflage handler's that are registered for that camouflage type.
|
||||
*/
|
||||
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
|
||||
List<ICamouflageItemHandler> getItemHandlers();
|
||||
|
||||
void addItemToBlackList(String type, ItemStack camouflageBlock);
|
||||
void addItemToBlackList(ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(String type, String modID);
|
||||
void addModIdToBlackList(String modID);
|
||||
|
||||
boolean isItemBlackListed(String type, ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getNoneItemHandler();
|
||||
boolean isItemBlackListed(ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
|
||||
@Nullable
|
||||
ICamouflageItemHandler getHandler(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -12,22 +12,17 @@ public interface ICamouflageHandler extends ILocatable {
|
||||
/**
|
||||
* @return The item of the block that is the camouflage of this handler for the type.
|
||||
*/
|
||||
ItemStack getCamouflageBlock(String type);
|
||||
ItemStack getCamouflageBlock();
|
||||
|
||||
/**
|
||||
* @return The default camouflage block item for the type.
|
||||
*/
|
||||
ItemStack getDefaultCamouflageBlock(String type);
|
||||
|
||||
/**
|
||||
* @return True if the handler can handle this type of camouflage.
|
||||
*/
|
||||
boolean canHandleType(String type);
|
||||
ItemStack getDefaultCamouflageBlock();
|
||||
|
||||
/**
|
||||
* Set the camouflage block item for the type.
|
||||
*
|
||||
* @return True if the block has chanced.
|
||||
*/
|
||||
boolean setCamouflageBlock(String type, ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
}
|
||||
@@ -5,22 +5,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public interface ICamouflageItemHandler {
|
||||
|
||||
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
String getType();
|
||||
|
||||
float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -5,12 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface ICamouflagedTile {
|
||||
|
||||
String getCamouflageType();
|
||||
|
||||
BlockPos getCoordinates();
|
||||
public interface ICamouflagedTile extends ILocatable {
|
||||
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Interface for things, that have a location.
|
||||
* Must not be named "getWorld" and "getPos" to avoid
|
||||
* SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
World getWorldObj();
|
||||
}
|
||||
@@ -34,6 +34,8 @@ public interface IModelBaker {
|
||||
|
||||
void addBakedModel(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addBakedModelPost(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addFace(EnumFacing facing, TextureAtlasSprite sprite);
|
||||
|
||||
void setModelState(@Nullable IModelState modelState);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
@API(apiVersion = "5.2.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,7 +30,10 @@ public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*
|
||||
* @return Null if the farming plugin is not active.
|
||||
*/
|
||||
@Nullable
|
||||
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,14 @@ public interface IAllele {
|
||||
*/
|
||||
String getUID();
|
||||
|
||||
/**
|
||||
* @return modId of the mod that created this allele
|
||||
* @since Forestry 5.6.0
|
||||
*/
|
||||
default String getModID() {
|
||||
return "forestry";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the allele is dominant, false otherwise.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
public interface IAlleleProperty<A extends IAlleleProperty<A>> extends IAllele, Comparable<A> {
|
||||
|
||||
@@ -207,7 +207,7 @@ public interface IAlleleRegistry {
|
||||
* @param handler IAlleleHandler to register.
|
||||
*/
|
||||
void registerAlleleHandler(IAlleleHandler handler);
|
||||
|
||||
|
||||
/* BLACKLIST */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -13,6 +16,20 @@ public interface IFlowerGrowthHelper {
|
||||
* Plants a random flower from flowerType at the specified position.
|
||||
*
|
||||
* @return true if successful, false if it could not be planted.
|
||||
* @deprecated since Forestry 5.5.4. Use {@link #plantRandomFlower(String, World, BlockPos, Collection)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean plantRandomFlower(String flowerType, World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Plants a random flower from flowerType at the specified position.
|
||||
*
|
||||
* @param flowerType the flower type that can be planted
|
||||
* @param world the world to plant flowers in
|
||||
* @param pos the position to plant the flowers
|
||||
* @param potentialFlowers the potential flowers that can be planted
|
||||
* @return true if a flower was planted, false otherwise
|
||||
* @since Forestry 5.5.4
|
||||
*/
|
||||
boolean plantRandomFlower(String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers);
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -18,6 +21,20 @@ public interface IFlowerGrowthRule {
|
||||
* For implementers, you can plant a random flower using IFlowerGrowthHelper.plantRandomFlower
|
||||
*
|
||||
* @since Forestry 4.0.8
|
||||
* @deprecated since Forestry 5.5.4. Use {@link #growFlower(IFlowerGrowthHelper, String, World, BlockPos, Collection)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Checks a position for suitability, and then plants a flower there.
|
||||
* Returns true on success.
|
||||
* For implementers, you can plant a random flower using IFlowerGrowthHelper.plantRandomFlower
|
||||
*
|
||||
* @since Forestry 5.5.4
|
||||
*/
|
||||
default boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
//noinspection deprecation
|
||||
return growFlower(helper, flowerType, world, pos);
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
|
||||
// See {@link forestry.api.apiculture.FlowerManager}.FlowerType___ for basic Forestry flower types.
|
||||
// Each IFlowerProvider has one flower type, and multiple IFlowerProviders may share one type.
|
||||
// "Acceptable flowers" allow nearby bees to do work.
|
||||
@@ -59,8 +61,9 @@ public interface IFlowerRegistry {
|
||||
|
||||
/**
|
||||
* Calls the appropriate IFlowerGrowthRule to grow a flower at a specified position.
|
||||
* @since Forestry 5.5.4
|
||||
*/
|
||||
boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos);
|
||||
boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos, Collection<IBlockState> potentialFlowers);
|
||||
|
||||
/**
|
||||
* Gets an iterator over the area a bee can travel from its beeHousing.
|
||||
@@ -96,4 +99,12 @@ public interface IFlowerRegistry {
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isAcceptedFlower(String flowerType, World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Calls the appropriate IFlowerGrowthRule to grow a flower at a specified position.
|
||||
*
|
||||
* @deprecated since Forestry 5.5.4. Use {@link #growFlower(String, World, IIndividual, BlockPos, Collection)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos);
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* @author Nedelosk
|
||||
* @since 5.12.16
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class GreenhouseEvents extends Event {
|
||||
|
||||
public final IGreenhouseController controller;
|
||||
|
||||
public GreenhouseEvents(IGreenhouseController state) {
|
||||
this.controller = state;
|
||||
}
|
||||
|
||||
public static class InternalBlockEvent extends GreenhouseEvents {
|
||||
public final IInternalBlock internalBlock;
|
||||
|
||||
public InternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller);
|
||||
|
||||
this.internalBlock = internalBlock;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CreateInternalBlockEvent extends InternalBlockEvent {
|
||||
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller, internalBlock);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent {
|
||||
public final IInternalBlockFace face;
|
||||
|
||||
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, IInternalBlockFace face) {
|
||||
super(controller, internalBlock);
|
||||
|
||||
this.face = face;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
public interface IClimateHousing {
|
||||
|
||||
/**
|
||||
* @return The size of the region in blocks.
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
void onUpdateClimate();
|
||||
|
||||
/**
|
||||
* @return The default climate state. It is calculated out of all biomedata that this region contains.
|
||||
*/
|
||||
IClimateState getDefaultClimate();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The position at that the housing is.
|
||||
*/
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The world in that the housing is.
|
||||
*/
|
||||
World getWorldObj();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseHelper {
|
||||
|
||||
/**
|
||||
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -8,23 +8,26 @@ package forestry.api.greenhouse;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseHousing extends IErrorLogicSource {
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
float getExactTemperature();
|
||||
|
||||
float getExactHumidity();
|
||||
|
||||
public interface IGreenhouseHousing extends IErrorLogicSource, IClimateHousing{
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
*
|
||||
* @return The world in that the housing is.
|
||||
* @return The current tempreture as an enum.
|
||||
*/
|
||||
World getWorldObj();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
/**
|
||||
* @return The current humidity as an enum.
|
||||
*/
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
/**
|
||||
* @return The current tempreture as an float. Range: 0.0F ~ 2.0F
|
||||
*/
|
||||
float getExactTemperature();
|
||||
|
||||
/**
|
||||
* @return The current humidity as an float. Range: 0.0F ~ 2.0F
|
||||
*/
|
||||
float getExactHumidity();
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import forestry.api.multiblock.IGreenhouseController;
|
||||
public interface IGreenhouseListener {
|
||||
|
||||
/**
|
||||
* Called before the greenhouse update the climate system.
|
||||
* Called before the greenhouse updates the climate system.
|
||||
*
|
||||
* @param greenhouse The greenhouse of the listener.
|
||||
* @param canWork The actual {@link Boolean} value.
|
||||
|
||||
@@ -10,5 +10,6 @@ package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
|
||||
@@ -5,14 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateSourceProvider;
|
||||
import forestry.api.climate.IClimatiserDefinition;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> extends IMultiblockComponent {
|
||||
@Override
|
||||
@@ -21,22 +14,7 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
interface Listener extends IGreenhouseComponent {
|
||||
IGreenhouseListener getGreenhouseListener();
|
||||
}
|
||||
|
||||
interface ClimateControl extends IGreenhouseComponent, IClimateControlProvider {
|
||||
|
||||
}
|
||||
|
||||
interface Door extends IGreenhouseComponent {
|
||||
}
|
||||
|
||||
interface Climatiser extends IGreenhouseComponent, IClimateSourceProvider {
|
||||
IClimatiserDefinition getDefinition();
|
||||
}
|
||||
|
||||
interface Nursery extends IGreenhouseComponent, IButterflyNursery {
|
||||
void addCocoonLoot(IButterflyCocoon cocoon, NonNullList<ItemStack> loot);
|
||||
}
|
||||
|
||||
|
||||
interface Active extends IGreenhouseComponent {
|
||||
void updateServer(int tickCount);
|
||||
|
||||
|
||||
@@ -5,35 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import java.util.Set;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateRegion;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler {
|
||||
|
||||
/**
|
||||
* @return All internal blocks of the greenhouse.
|
||||
*
|
||||
* @return the position of the block at the top of the greenhouse structure that shows the state of the greenhouse.
|
||||
*/
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
BlockPos getCenterCoordinates();
|
||||
|
||||
/**
|
||||
* spawns a butterfly in a greenhouse
|
||||
* @return true if it has spawned it, and false if it has not
|
||||
*/
|
||||
boolean spawnButterfly(IGreenhouseComponent.Nursery nursery);
|
||||
void setCenterCoordinates(BlockPos coordinates);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawnButterfly(IButterflyCocoon)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean spawnButterfly(IButterfly butterfly);
|
||||
|
||||
IClimateRegion getRegion();
|
||||
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
|
||||
@@ -49,4 +49,33 @@ public interface IFermenterManager extends ICraftingProvider<IFermenterRecipe> {
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
|
||||
|
||||
/**
|
||||
* Add a recipe to the fermenter
|
||||
*
|
||||
* @param resource String representing the resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
* @param fermentationValue Value of the given resource, i.e. how much needs
|
||||
* to be fermented for the output to be deposited into the product tank.
|
||||
* @param modifier Modifies the amount of liquid output per work cycle.
|
||||
* (water = 1.0f, honey = 1.5f)
|
||||
* @param output LiquidStack representing output liquid. Amount is
|
||||
* determined by fermentationValue*modifier.
|
||||
* @param liquid LiquidStack representing resource liquid and amount.
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(String resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid);
|
||||
|
||||
/**
|
||||
* Add a recipe to the fermenter. Defaults to water as input liquid.
|
||||
*
|
||||
* @param resource String representing the resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
* @param modifier Modifies the amount of liquid output per work cycle.
|
||||
* (water = 1.0f, honey = 1.5f)
|
||||
* @param fermentationValue Value of the given resource, i.e. how much needs
|
||||
* to be fermented for the output to be deposited into the product tank.
|
||||
* @param output LiquidStack representing output liquid. Amount is
|
||||
* determined by fermentationValue*modifier.
|
||||
* @throws NullPointerException if resource, output or liquid is null
|
||||
*/
|
||||
void addRecipe(String resource, int fermentationValue, float modifier, FluidStack output);
|
||||
}
|
||||
@@ -5,16 +5,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IFermenterRecipe extends IForestryRecipe {
|
||||
public interface IFermenterRecipe extends IForestryRecipe, Comparable<IFermenterRecipe> {
|
||||
|
||||
/**
|
||||
* @return ItemStack representing the input resource.
|
||||
*/
|
||||
ItemStack getResource();
|
||||
|
||||
/**
|
||||
* @return String representing the input resource as a {@link net.minecraftforge.oredict.OreDictionary} name.
|
||||
*/
|
||||
@Nullable
|
||||
String getResourceOreName();
|
||||
|
||||
/**
|
||||
* @return FluidStack representing the input fluid resource.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -19,7 +21,21 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -40,18 +56,6 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@@ -202,11 +206,13 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
if (this.queenStack != queenStack) {
|
||||
if (!queenStack.isEmpty()) {
|
||||
this.queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
if (this.queen != null) {
|
||||
hasFlowersCache.onNewQueen(queen, housing);
|
||||
}
|
||||
} else {
|
||||
this.queen = null;
|
||||
}
|
||||
this.queenStack = queenStack;
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
}
|
||||
|
||||
@@ -250,9 +256,11 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
if (queen != null) {
|
||||
hasFlowersCache.forceLookForFlowers(queen, housing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,14 +280,21 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
queenWorkCycleThrottle = 0;
|
||||
|
||||
doProduction(queen, housing, beeListener);
|
||||
queen.plantFlowerRandom(housing);
|
||||
World world = housing.getWorldObj();
|
||||
List<IBlockState> flowers = hasFlowersCache.getFlowers(world);
|
||||
if (flowers.size() < PluginApiculture.maxFlowersSpawnedPerHive) {
|
||||
BlockPos blockPos = queen.plantFlowerRandom(housing, flowers);
|
||||
if (blockPos != null) {
|
||||
hasFlowersCache.addFlowerPos(blockPos);
|
||||
}
|
||||
}
|
||||
pollenHandler.doPollination(queen, housing, beeListener);
|
||||
|
||||
// Age the queen
|
||||
IBeeGenome mate = queen.getMate();
|
||||
Preconditions.checkState(mate != null);
|
||||
float lifespanModifier = beeModifier.getLifespanModifier(queen.getGenome(), mate, 1.0f);
|
||||
queen.age(housing.getWorldObj(), lifespanModifier);
|
||||
queen.age(world, lifespanModifier);
|
||||
|
||||
// Write the changed queen back into the item stack.
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
@@ -17,19 +17,23 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.IBlockPosPredicate;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.utils.TickHelper;
|
||||
|
||||
public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
private static final String NBT_KEY = "hasFlowerCache";
|
||||
private static final String NBT_KEY_FLOWERS = "flowers";
|
||||
@@ -40,17 +44,20 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
@Nullable
|
||||
private FlowerData flowerData;
|
||||
private final List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
private final List<IBlockState> flowers = new ArrayList<>();
|
||||
|
||||
private boolean needsSync = false;
|
||||
|
||||
private static class FlowerData {
|
||||
public final String flowerType;
|
||||
public final Vec3i territory;
|
||||
public final IBlockPosPredicate flowerPredicate;
|
||||
public Iterator<BlockPos.MutableBlockPos> areaIterator;
|
||||
|
||||
public FlowerData(IBee queen, IBeeHousing beeHousing) {
|
||||
IFlowerProvider flowerProvider = queen.getGenome().getFlowerProvider();
|
||||
this.flowerType = flowerProvider.getFlowerType();
|
||||
this.territory = queen.getGenome().getTerritory();
|
||||
this.flowerPredicate = FlowerManager.flowerRegistry.createAcceptedFlowerPredicate(flowerType);
|
||||
this.areaIterator = FlowerManager.flowerRegistry.getAreaIterator(beeHousing, queen);
|
||||
}
|
||||
@@ -64,6 +71,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
if (flowerData == null) {
|
||||
this.flowerData = new FlowerData(queen, beeHousing);
|
||||
this.flowerCoords.clear();
|
||||
this.flowers.clear();
|
||||
}
|
||||
World world = beeHousing.getWorldObj();
|
||||
tickHelper.onTick();
|
||||
@@ -74,6 +82,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
BlockPos flowerPos = iterator.next();
|
||||
if (!flowerData.flowerPredicate.test(world, flowerPos) && world.isBlockLoaded(flowerPos)) {
|
||||
iterator.remove();
|
||||
flowers.clear();
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
@@ -86,8 +95,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
if (flowerData.areaIterator.hasNext()) {
|
||||
BlockPos.MutableBlockPos blockPos = flowerData.areaIterator.next();
|
||||
if (flowerData.flowerPredicate.test(world, blockPos)) {
|
||||
flowerCoords.add(blockPos.toImmutable());
|
||||
needsSync = true;
|
||||
addFlowerPos(blockPos.toImmutable());
|
||||
}
|
||||
} else {
|
||||
flowerData.resetIterator(queen, beeHousing);
|
||||
@@ -105,15 +113,55 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
flowerCoords.clear();
|
||||
flowerData = null;
|
||||
public void onNewQueen(IBee queen, IBeeHousing housing) {
|
||||
if (this.flowerData != null) {
|
||||
IBeeGenome genome = queen.getGenome();
|
||||
String flowerType = genome.getFlowerProvider().getFlowerType();
|
||||
if (!this.flowerData.flowerType.equals(flowerType)
|
||||
|| !this.flowerData.territory.equals(genome.getTerritory())) {
|
||||
flowerData = new FlowerData(queen, housing);
|
||||
flowerCoords.clear();
|
||||
flowers.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<BlockPos> getFlowerCoords() {
|
||||
return Collections.unmodifiableList(flowerCoords);
|
||||
}
|
||||
|
||||
public List<IBlockState> getFlowers(World world) {
|
||||
if (flowers.isEmpty() && !flowerCoords.isEmpty()) {
|
||||
flowers.clear();
|
||||
for (BlockPos flowerCoord : flowerCoords) {
|
||||
IBlockState blockState = world.getBlockState(flowerCoord);
|
||||
flowers.add(blockState);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(flowers);
|
||||
}
|
||||
|
||||
public void addFlowerPos(BlockPos blockPos) {
|
||||
flowerCoords.add(blockPos);
|
||||
flowers.clear();
|
||||
needsSync = true;
|
||||
}
|
||||
|
||||
public void forceLookForFlowers(IBee queen, IBeeHousing housing) {
|
||||
if (flowerData != null) {
|
||||
flowerCoords.clear();
|
||||
flowers.clear();
|
||||
flowerData.resetIterator(queen, housing);
|
||||
World world = housing.getWorldObj();
|
||||
while (flowerData.areaIterator.hasNext()) {
|
||||
BlockPos.MutableBlockPos blockPos = flowerData.areaIterator.next();
|
||||
if (flowerData.flowerPredicate.test(world, blockPos)) {
|
||||
addFlowerPos(blockPos.toImmutable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
if (!nbttagcompound.hasKey(NBT_KEY)) {
|
||||
@@ -133,6 +181,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
flowers.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,6 +219,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
|
||||
public void readData(PacketBuffer data) throws IOException {
|
||||
flowerCoords.clear();
|
||||
flowers.clear();
|
||||
|
||||
int size = data.readVarInt();
|
||||
while (size > 0) {
|
||||
|
||||
@@ -134,7 +134,7 @@ import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description", lootTable = "apiculture")
|
||||
public class PluginApiculture extends BlankForestryPlugin {
|
||||
private static final String CONFIG_CATEGORY = "apiculture";
|
||||
private static float secondPrincessChance = 0;
|
||||
@@ -151,6 +151,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
public static String beekeepingMode = "NORMAL";
|
||||
public static final int ticksPerBeeWorkCycle = 550;
|
||||
public static int maxFlowersSpawnedPerHive = 20;
|
||||
@Nullable
|
||||
public static VillagerRegistry.VillagerProfession villagerApiarist;
|
||||
|
||||
@@ -261,6 +262,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
|
||||
|
||||
maxFlowersSpawnedPerHive = config.getIntLocalized("beekeeping", "flowers.spawn", 20, 0, 1000);
|
||||
|
||||
String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
|
||||
parseBeeBlacklist(blacklist);
|
||||
|
||||
|
||||
@@ -13,6 +13,16 @@ package forestry.apiculture;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
@@ -20,14 +30,6 @@ import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.TickHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WorldgenBeekeepingLogic implements IBeekeepingLogic {
|
||||
private final TileHive housing;
|
||||
@@ -116,10 +118,7 @@ public class WorldgenBeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
canWork();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* CLIENT */
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
@@ -35,6 +36,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -56,6 +58,7 @@ import forestry.core.blocks.BlockStructure;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ItemTooltipUtil;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
@@ -262,7 +265,11 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
tooltip.add(Translator.translateToLocal("tile.for.alveary.tooltip"));
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
|
||||
if(GuiScreen.isShiftKeyDown()){
|
||||
tooltip.add(Translator.translateToLocal("tile.for.alveary.tooltip"));
|
||||
}else{
|
||||
ItemTooltipUtil.addShiftInformation(stack, world, tooltip, flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -36,12 +46,7 @@ import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.BlockStateSet;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.core.utils.WeightedCollection;
|
||||
|
||||
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules;
|
||||
@@ -50,7 +55,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
private final HashMultimap<String, Flower> plantableFlowers;
|
||||
|
||||
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
|
||||
private final Map<String, TreeMap<Double, Flower>> chances;
|
||||
private final Map<String, WeightedCollection<Flower>> chances;
|
||||
|
||||
public FlowerRegistry() {
|
||||
this.registeredRules = HashMultimap.create();
|
||||
@@ -197,6 +202,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos) {
|
||||
if (!this.growthRules.containsKey(flowerType)) {
|
||||
return false;
|
||||
@@ -211,6 +217,23 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
if (!this.growthRules.containsKey(flowerType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<IFlowerGrowthRule> growthRules = this.growthRules.get(flowerType);
|
||||
Collections.shuffle(growthRules);
|
||||
for (IFlowerGrowthRule rule : growthRules) {
|
||||
if (rule.growFlower(this, flowerType, world, pos, potentialFlowers)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGrowthRule(IFlowerGrowthRule rule, String... flowerTypes) {
|
||||
Preconditions.checkNotNull(rule);
|
||||
@@ -220,20 +243,18 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Flower getRandomPlantableFlower(String flowerType, Random rand) {
|
||||
TreeMap<Double, Flower> chancesMap = getChancesMap(flowerType);
|
||||
double maxKey = chancesMap.lastKey() + 1.0;
|
||||
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
|
||||
WeightedCollection<Flower> chancesMap = getFlowerChances(flowerType);
|
||||
return chancesMap.getRandom(rand);
|
||||
}
|
||||
|
||||
private TreeMap<Double, Flower> getChancesMap(String flowerType) {
|
||||
private WeightedCollection<Flower> getFlowerChances(String flowerType) {
|
||||
if (!this.chances.containsKey(flowerType)) {
|
||||
TreeMap<Double, Flower> flowerChances = new TreeMap<>();
|
||||
double count = 0.0;
|
||||
WeightedCollection<Flower> flowerChances = new WeightedCollection<>();
|
||||
for (Flower flower : this.plantableFlowers.get(flowerType)) {
|
||||
if (flower.isPlantable()) {
|
||||
flowerChances.put(count, flower);
|
||||
count += flower.getWeight();
|
||||
flowerChances.put(flower.getWeight(), flower);
|
||||
}
|
||||
}
|
||||
this.chances.put(flowerType, flowerChances);
|
||||
@@ -253,7 +274,24 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
@Override
|
||||
public boolean plantRandomFlower(String flowerType, World world, BlockPos pos) {
|
||||
Flower flower = getRandomPlantableFlower(flowerType, world.rand);
|
||||
return world.setBlockState(pos, flower.getBlockState());
|
||||
return flower != null && world.setBlockState(pos, flower.getBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantRandomFlower(String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
WeightedCollection<Flower> chances = getFlowerChances(flowerType);
|
||||
WeightedCollection<IBlockState> potentialChances = new WeightedCollection<>();
|
||||
|
||||
for (Map.Entry<Double, Flower> entry : chances.entrySet()) {
|
||||
Flower flower = entry.getValue();
|
||||
IBlockState blockState = flower.getBlockState();
|
||||
if (potentialFlowers.contains(blockState)) {
|
||||
potentialChances.put(entry.getKey(), blockState);
|
||||
}
|
||||
}
|
||||
|
||||
final IBlockState blockState = potentialChances.getRandom(world.rand);
|
||||
return blockState != null && world.setBlockState(pos, blockState);
|
||||
}
|
||||
|
||||
private static class AcceptedFlowerPredicate implements IBlockPosPredicate {
|
||||
|
||||
@@ -10,24 +10,38 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos, potentialFlowers);
|
||||
}
|
||||
|
||||
private boolean isValidSpot(World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos) || !world.isAirBlock(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
|
||||
return (ground == Blocks.DIRT || ground == Blocks.GRASS) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
return (ground == Blocks.DIRT || ground == Blocks.GRASS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,15 +11,17 @@
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleFertilize implements IFlowerGrowthRule {
|
||||
|
||||
private final List<Block> allowedItems;
|
||||
@@ -33,6 +35,11 @@ public class GrowthRuleFertilize implements IFlowerGrowthRule {
|
||||
return growFlower(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
return growFlower(world, pos);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos)) {
|
||||
return false;
|
||||
|
||||
@@ -10,24 +10,39 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleMycelium implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos, potentialFlowers);
|
||||
}
|
||||
|
||||
private boolean isValidSpot(World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos) || !world.isAirBlock(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
|
||||
return ground == Blocks.MYCELIUM &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
return ground == Blocks.MYCELIUM;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,11 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleNone implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
@@ -22,4 +26,8 @@ public class GrowthRuleNone implements IFlowerGrowthRule {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -10,24 +10,38 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleSnow implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) {
|
||||
return isValidSpot(world, pos) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos, potentialFlowers);
|
||||
}
|
||||
|
||||
private boolean isValidSpot(World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos) || world.getBlockState(pos).getBlock() != Blocks.SNOW) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
|
||||
return (ground == Blocks.DIRT || ground == Blocks.GRASS) &&
|
||||
helper.plantRandomFlower(flowerType, world, pos);
|
||||
return (ground == Blocks.DIRT || ground == Blocks.GRASS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -735,7 +736,11 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@Override
|
||||
public void plantFlowerRandom(IBeeHousing housing) {
|
||||
plantFlowerRandom(housing, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos plantFlowerRandom(IBeeHousing housing, @Nullable List<IBlockState> potentialFlowers) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
@@ -745,9 +750,8 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// Correct speed
|
||||
if (random.nextInt(100) >= chance) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Gather required info
|
||||
IFlowerProvider provider = genome.getFlowerProvider();
|
||||
Vec3i area = getArea(genome, beeModifier);
|
||||
@@ -758,10 +762,18 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
BlockPos randomPos = VectUtil.getRandomPositionInArea(random, area);
|
||||
BlockPos posBlock = VectUtil.add(housingPos, randomPos, offset);
|
||||
|
||||
if (FlowerManager.flowerRegistry.growFlower(provider.getFlowerType(), world, this, posBlock)) {
|
||||
break;
|
||||
if (potentialFlowers != null) {
|
||||
if (FlowerManager.flowerRegistry.growFlower(provider.getFlowerType(), world, this, posBlock, potentialFlowers)) {
|
||||
return posBlock;
|
||||
}
|
||||
} else { // legacy
|
||||
//noinspection deprecation
|
||||
if (FlowerManager.flowerRegistry.growFlower(provider.getFlowerType(), world, this, posBlock)) {
|
||||
return posBlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Vec3i getArea(IBeeGenome genome, IBeeModifier beeModifier) {
|
||||
|
||||
@@ -16,6 +16,14 @@ import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -36,11 +44,6 @@ import forestry.core.PluginCore;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
public enum BeeDefinition implements IBeeDefinition {
|
||||
/* HONEY BRANCH */
|
||||
@@ -991,12 +994,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
String lowercaseName = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
String species = "species" + WordUtils.capitalize(lowercaseName);
|
||||
|
||||
String uid = Constants.MOD_ID + '.' + species;
|
||||
String modId = Constants.MOD_ID;
|
||||
String uid = modId + '.' + species;
|
||||
String description = "for.description." + species;
|
||||
String name = "for.bees.species." + lowercaseName;
|
||||
|
||||
this.branch = branch;
|
||||
IAlleleBeeSpeciesBuilder speciesBuilder = BeeManager.beeFactory.createSpecies(uid, dominant, "Sengir", name, description, branch.getBranch(), binomial, primary.getRGB(), secondary.getRGB());
|
||||
IAlleleBeeSpeciesBuilder speciesBuilder = BeeManager.beeFactory.createSpecies(modId, uid, dominant, "Sengir", name, description, branch.getBranch(), binomial, primary.getRGB(), secondary.getRGB());
|
||||
if (isSecret()) {
|
||||
speciesBuilder.setIsSecret();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ import forestry.api.genetics.IClassification;
|
||||
import forestry.apiculture.genetics.alleles.AlleleBeeSpecies;
|
||||
|
||||
public class BeeFactory implements IBeeFactory {
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesBuilder createSpecies(
|
||||
String modId,
|
||||
String uid,
|
||||
boolean dominant,
|
||||
String authority,
|
||||
@@ -35,11 +37,17 @@ public class BeeFactory implements IBeeFactory {
|
||||
Preconditions.checkNotNull(branch);
|
||||
Preconditions.checkNotNull(binomial);
|
||||
|
||||
return new AlleleBeeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
return new AlleleBeeSpecies(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification createBranch(String uid, String scientific) {
|
||||
return new BranchBees(uid, scientific);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
return createSpecies("forestry", uid, dominant, authority, unlocalizedName, unlocalizedDescription, branch, binomial, primaryColor, secondaryColor);
|
||||
}
|
||||
}
|
||||
@@ -51,8 +51,8 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
private IJubilanceProvider jubilanceProvider;
|
||||
private boolean nocturnal = false;
|
||||
|
||||
public AlleleBeeSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial);
|
||||
public AlleleBeeSpecies(String modId, String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
super(modId, uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial);
|
||||
|
||||
beeModelProvider = DefaultBeeModelProvider.instance;
|
||||
beeSpriteColourProvider = new DefaultBeeSpriteColourProvider(primaryColor, secondaryColor);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.apiculture.blocks.BlockHoneyComb;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockHoneyComb extends ItemBlockForestry<BlockHoneyComb> implements IColoredItem {
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@ import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
import forestry.api.climate.IClimatePosition;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.AlvearyBeeModifier;
|
||||
@@ -429,10 +427,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
data.writeVarInt(beekeepingLogic.getBeeProgressPercent());
|
||||
data.writeVarInt(Math.round(tempChange * 100));
|
||||
data.writeVarInt(Math.round(humidChange * 100));
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(world, getReferenceCoord());
|
||||
if (position != null) {
|
||||
ClimateUtil.writePositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -440,9 +434,5 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
breedingProgressPercent = data.readVarInt();
|
||||
tempChange = data.readVarInt() / 100.0F;
|
||||
humidChange = data.readVarInt() / 100.0F;
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(world, getReferenceCoord());
|
||||
if (position != null) {
|
||||
ClimateUtil.readPositionData(position, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,22 @@ package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
@@ -24,20 +40,8 @@ import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.recipes.HygroregulatorRecipe;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IAlvearyComponent.Climatiser {
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
@@ -186,18 +190,4 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
public Container getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerAlvearyHygroregulator(player.inventory, this);
|
||||
}
|
||||
|
||||
private static class HygroregulatorRecipe {
|
||||
public final FluidStack liquid;
|
||||
public final int transferTime;
|
||||
public final float humidChange;
|
||||
public final float tempChange;
|
||||
|
||||
public HygroregulatorRecipe(FluidStack liquid, int transferTime, float humidChange, float tempChange) {
|
||||
this.liquid = liquid;
|
||||
this.transferTime = transferTime;
|
||||
this.humidChange = humidChange;
|
||||
this.tempChange = tempChange;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,8 @@ import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.climate.IClimatePosition;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.apiculture.gui.IGuiBeeHousingDelegate;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
@@ -162,19 +160,11 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
@Override
|
||||
public void writeGuiData(PacketBufferForestry data) {
|
||||
data.writeVarInt(beeLogic.getBeeProgressPercent());
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(world, getPos());
|
||||
if (position != null) {
|
||||
ClimateUtil.writePositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(PacketBufferForestry data) throws IOException {
|
||||
breedingProgressPercent = data.readVarInt();
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(world, getPos());
|
||||
if (position != null) {
|
||||
ClimateUtil.readPositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
// / IBEEHOUSING
|
||||
|
||||
@@ -33,9 +33,10 @@ import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -286,7 +287,9 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
Flower flower = flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
|
||||
setBlockState(world, flower.getBlockState(), j, i, k, box);
|
||||
if (flower != null) {
|
||||
setBlockState(world, flower.getBlockState(), j, i, k, box);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.arboriculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockModelShapes;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.arboriculture.items.ItemBlockWoodDoor;
|
||||
|
||||
public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemBlockWoodDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return CamouflageManager.DOOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler) {
|
||||
return 0F;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile) {
|
||||
Preconditions.checkArgument(!stack.isEmpty(), "Stack must not be empty");
|
||||
Preconditions.checkArgument(stack.getItem() instanceof ItemBlockWoodDoor, "Item must be ItemBlockWoodDoor");
|
||||
|
||||
World world = camouflageHandler.getWorldObj();
|
||||
BlockPos pos = camouflageTile.getCoordinates();
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
IBlockState currentState = blockState.getActualState(world, pos);
|
||||
|
||||
ItemBlockWoodDoor itemDoor = (ItemBlockWoodDoor) stack.getItem();
|
||||
|
||||
IBlockState doorState = itemDoor.getBlock().getDefaultState()
|
||||
.withProperty(BlockDoor.FACING, currentState.getValue(BlockDoor.FACING))
|
||||
.withProperty(BlockDoor.HINGE, currentState.getValue(BlockDoor.HINGE))
|
||||
.withProperty(BlockDoor.OPEN, currentState.getValue(BlockDoor.OPEN))
|
||||
.withProperty(BlockDoor.POWERED, currentState.getValue(BlockDoor.POWERED))
|
||||
.withProperty(BlockDoor.HALF, currentState.getValue(BlockDoor.HALF));
|
||||
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
|
||||
return Pair.of(doorState, modelShapes.getModelForState(doorState));
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 501 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user