Update for 1.11. Missing assets, unstable.

This commit is contained in:
mezz committed 2016-12-22 16:47:56 -08:00
1 parent 30d7365518
commit 9611ae08ae
1145 files changed
+15561 -18107

No files matched your search

+14 -7
View File
@@ -10,8 +10,10 @@
******************************************************************************/
package forestry;
import javax.annotation.Nullable;
import java.io.File;
import com.google.common.base.Preconditions;
import forestry.api.core.ForestryAPI;
import forestry.core.EventHandlerCore;
import forestry.core.climate.ClimateEventHandler;
@@ -26,7 +28,6 @@ import forestry.core.network.PacketHandler;
import forestry.core.proxy.Proxies;
import forestry.core.worldgen.WorldGenerator;
import forestry.plugins.PluginManager;
import forestry.plugins.compat.PluginIC2;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
@@ -50,14 +51,16 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
name = "Forestry",
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
acceptedMinecraftVersions = "[1.10]",
dependencies = "required-after:Forge@[12.18.1.2080,);"
+ "after:JEI@[3.11.2.278,);"
+ "after:" + PluginIC2.modId + ";")
acceptedMinecraftVersions = "[1.11]",
dependencies = "required-after:forge@[13.19.1.2189,);"
+ "after:JEI@[4.1.1,);")
// + "after:" + PluginIC2.modId + ";")
public class Forestry {
@SuppressWarnings("NullableProblems")
@Mod.Instance(Constants.MOD_ID)
public static Forestry instance;
@Nullable
private File configFolder;
public Forestry() {
@@ -68,6 +71,7 @@ public class Forestry {
FluidRegistry.enableUniversalBucket();
}
@Nullable
public static PacketHandler packetHandler;
@EventHandler
@@ -85,10 +89,12 @@ public class Forestry {
PluginManager.runSetup(event);
ForestryAPI.activeMode = new GameMode(Config.gameMode);
String gameMode = Config.gameMode;
Preconditions.checkState(gameMode != null);
ForestryAPI.activeMode = new GameMode(gameMode);
PluginManager.runPreInit();
Proxies.render.registerModels();
}
@@ -122,6 +128,7 @@ public class Forestry {
PluginManager.serverStarting(event.getServer());
}
@Nullable
public File getConfigFolder() {
return configFolder;
}
@@ -14,7 +14,7 @@ public enum EnumBeeType implements ISpeciesType {
public static final EnumBeeType[] VALUES = values();
String name;
private final String name;
EnumBeeType() {
this.name = this.toString().toLowerCase(Locale.ENGLISH);
@@ -5,18 +5,16 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.Biome;
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.world.biome.Biome;
/**
* Other implementations than Forestry's default one are not supported.
@@ -28,7 +26,6 @@ public interface IBee extends IIndividualLiving {
/**
* @return Bee's genetic information.
*/
@Nonnull
@Override
IBeeGenome getGenome();
@@ -51,6 +48,7 @@ public interface IBee extends IIndividualLiving {
/**
* Set the natural flag on this bee.
*
* @param flag
*/
void setIsNatural(boolean flag);
@@ -66,6 +64,7 @@ public interface IBee extends IIndividualLiving {
/**
* Determines whether the queen can work.
*
* @param housing the {@link IBeeHousing} the bee currently resides in.
* @return an empty set if the queen can work, a set of error states if the queen can not work
*/
@@ -77,14 +76,16 @@ public interface IBee extends IIndividualLiving {
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(IBeeHousing housing);
List<ItemStack> produceStacks(IBeeHousing housing);
@Nullable
IBee spawnPrincess(IBeeHousing housing);
IBee[] spawnDrones(IBeeHousing housing);
void plantFlowerRandom(IBeeHousing housing);
@Nullable
IIndividual retrievePollen(IBeeHousing housing);
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
import net.minecraft.util.math.Vec3i;
import forestry.api.genetics.EnumTolerance;
@@ -22,11 +20,9 @@ import forestry.api.genetics.IGenome;
public interface IBeeGenome extends IGenome {
@Override
@Nonnull
IAlleleBeeSpecies getPrimary();
@Override
@Nonnull
IAlleleBeeSpecies getSecondary();
float getSpeed();
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nullable;
import com.mojang.authlib.GameProfile;
import forestry.api.climate.IClimateProvider;
import forestry.api.core.IErrorLogicSource;
@@ -38,6 +40,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvid
boolean isRaining();
@Nullable
GameProfile getOwner();
/**
@@ -6,7 +6,6 @@
package forestry.api.apiculture;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import com.mojang.authlib.GameProfile;
@@ -53,7 +52,7 @@ public interface IBeeRoot extends ISpeciesRoot {
* @return {@link IApiaristTracker} associated with the passed world.
*/
@Override
IApiaristTracker getBreedingTracker(World world, GameProfile player);
IApiaristTracker getBreedingTracker(World world, @Nullable GameProfile player);
/* BEE SPECIFIC */
@@ -75,8 +74,7 @@ public interface IBeeRoot extends ISpeciesRoot {
boolean isMated(ItemStack stack);
/**
* @param genome
* Valid {@link IBeeGenome}
* @param genome Valid {@link IBeeGenome}
* @return {@link IBee} from the passed genome
*/
IBee getBee(IBeeGenome genome);
@@ -84,17 +82,16 @@ public interface IBeeRoot extends ISpeciesRoot {
/**
* Creates an IBee suitable for a queen containing the necessary second genome for the mate.
*
* @param genome
* Valid {@link IBeeGenome}
* @param mate
* Valid {@link IBee} representing the mate.
* @param genome Valid {@link IBeeGenome}
* @param mate Valid {@link IBee} representing the mate.
* @return Mated {@link IBee} from the passed genomes.
*/
IBee getBee(World world, IBeeGenome genome, IBee mate);
/* TEMPLATES */
@Override
ArrayList<IBee> getIndividualTemplates();
List<IBee> getIndividualTemplates();
/* MUTATIONS */
@Override
@@ -103,10 +100,11 @@ public interface IBeeRoot extends ISpeciesRoot {
/* GAME MODE */
void resetBeekeepingMode();
ArrayList<IBeekeepingMode> getBeekeepingModes();
List<IBeekeepingMode> getBeekeepingModes();
IBeekeepingMode getBeekeepingMode(World world);
@Nullable
IBeekeepingMode getBeekeepingMode(String name);
void registerBeekeepingMode(IBeekeepingMode mode);
@@ -5,17 +5,15 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
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.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
/**
* Stores beekeeping logic for bee housings.
* Get one with BeeManager.beeRoot.createBeekeepingLogic(IBeeHousing housing)
@@ -27,6 +25,7 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
/**
* Checks that the bees can work, setting error conditions on the housing where needed
*
* @return true if no errors are present and doWork should be called
*/
boolean canWork();
@@ -75,6 +74,5 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
* Used by bee fx to direct bees to nearby flowers.
* These positions are synced to the client from the server.
*/
@Nonnull
List<BlockPos> getFlowerPositions();
}
@@ -5,7 +5,7 @@
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -20,7 +20,7 @@ public interface IBeekeepingMode {
/**
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
*/
ArrayList<String> getDescription();
List<String> getDescription();
/**
* @return Float used to modify the wear on comb frames.
@@ -47,7 +47,6 @@ public interface IBeekeepingMode {
boolean isOverworked(IBee queen, IBeeHousing housing);
/**
*
* @param queen
* @param offspring
* @param housing
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
public interface IHiveFrame {
@@ -18,6 +20,7 @@ public interface IHiveFrame {
* @param wear Integer denoting the amount worn out. The wear modifier of the current beekeeping mode has already been taken into account.
* @return ItemStack containing the actual frame with adjusted damage, or null if it has been broken.
*/
@Nullable
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
IBeeModifier getBeeModifier();
@@ -5,13 +5,11 @@
******************************************************************************/
package forestry.api.apiculture.hives;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Locale;
import net.minecraft.util.IStringSerializable;
import forestry.api.apiculture.IHiveDrop;
import net.minecraft.util.IStringSerializable;
public interface IHiveRegistry {
@@ -25,25 +23,23 @@ public interface IHiveRegistry {
SNOW("forestry:snow", "forestry.speciesWintry"),
SWAMP("forestry:swamp", "forestry.speciesMarshy"),
SWARM("forestry:swarm", "forestry.speciesForest");
public static final HiveType[] VALUES = values();
@Nonnull
private final String hiveUid;
@Nonnull
private final String speciesUid;
HiveType(@Nonnull String hiveUid, @Nonnull String speciesUid) {
HiveType(String hiveUid, String speciesUid) {
this.hiveUid = hiveUid;
this.speciesUid = speciesUid;
}
@Nonnull
public String getHiveUid() {
return hiveUid;
}
@Nonnull
public String getSpeciesUid() {
return speciesUid;
}
@@ -56,7 +52,6 @@ public interface IHiveRegistry {
public int getMeta() {
return ordinal();
}
}
/**
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "4.1.0", owner = "ForestryAPI|apiculture", provides = "ForestryAPI|hives")
package forestry.api.apiculture.hives;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
package forestry.api.apiculture;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import java.util.Locale;
import java.util.Random;
@@ -62,7 +61,7 @@ public enum EnumForestryWoodType implements IWoodType {
public float getHardness() {
return hardness;
}
public static EnumForestryWoodType getRandom(Random random) {
return VALUES[random.nextInt(VALUES.length)];
}
@@ -71,7 +70,7 @@ public enum EnumForestryWoodType implements IWoodType {
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
}
@Override
public String getName() {
return toString();
@@ -82,7 +81,6 @@ public enum EnumForestryWoodType implements IWoodType {
return ordinal();
}
@Nonnull
public static EnumForestryWoodType byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
@@ -94,14 +92,14 @@ public enum EnumForestryWoodType implements IWoodType {
public int getCarbonization() {
return carbonization;
}
@Override
public float getCharcoalChance(int numberOfCharcoal) {
if(numberOfCharcoal == 3){
if (numberOfCharcoal == 3) {
return 0.75F;
}else if(numberOfCharcoal == 4){
} else if (numberOfCharcoal == 4) {
return 0.5F;
}else if(numberOfCharcoal == 5){
} else if (numberOfCharcoal == 5) {
return 0.25F;
}
return 0.15F;
@@ -14,7 +14,8 @@ public enum EnumFruitFamily implements IFruitFamily {
PRUNES("prunes", "Prunus domestica"),
POMES("pomes", "Pomum"),
JUNGLE("jungle", "Tropicus"),
NUX("nuts", "Nux");
NUX("nuts", "Nux"),
NONE("none", "None");
private final String uid;
private final String scientific;
@@ -8,11 +8,9 @@ package forestry.api.arboriculture;
import java.util.Locale;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAllelePlantType;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFruitFamily;
import forestry.api.genetics.ISpeciesRoot;
@@ -25,12 +23,6 @@ public enum EnumTreeChromosome implements IChromosomeType {
* will actually yield fruit with this species. - Native {@link EnumPlantType} for this tree. Combines with the PLANT chromosome.
*/
SPECIES(IAlleleTreeSpecies.class),
/**
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
* @deprecated unused
*/
@Deprecated
GROWTH(IAlleleGrowth.class),
/**
* A float modifying the height of the tree. Taken into account at worldgen.
*/
@@ -47,22 +39,10 @@ public enum EnumTreeChromosome implements IChromosomeType {
* Chance for fruit leaves and/or drops.
*/
YIELD(IAlleleFloat.class),
/**
* May add additional tolerances for {@link EnumPlantType}.
* @deprecated this is tied to species directly
*/
@Deprecated
PLANT(IAllelePlantType.class),
/**
* Determines the speed at which fruit will ripen on this tree.
*/
SAPPINESS(IAlleleFloat.class),
/**
* Territory for leaf effects.
* @deprecated unused
*/
@Deprecated
TERRITORY(IAlleleArea.class),
/**
* Leaf effect. Unused.
*/
@@ -73,24 +53,12 @@ public enum EnumTreeChromosome implements IChromosomeType {
MATURATION(IAlleleInteger.class),
GIRTH(IAlleleInteger.class),
/**
* The combustibility of the wood, when it burn to charcoal and the combustibility of the charcoal.
* @deprecated this is tied to species directly
*/
@Deprecated
COMBUSTIBILITY(IAlleleInteger.class),
/**
* The amount of charcoal that a wood pile ash drop;
* @deprecated this is tied to species directly
*/
@Deprecated
CARBONIZATION(IAlleleInteger.class),
/**
* Determines if the tree can burn.
*/
FIREPROOF(IAlleleBoolean.class),;
Class<? extends IAllele> alleleClass;
private final Class<? extends IAllele> alleleClass;
EnumTreeChromosome(Class<? extends IAllele> alleleClass) {
this.alleleClass = alleleClass;
@@ -1,6 +1,5 @@
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import java.util.Locale;
import java.util.Random;
@@ -47,7 +46,6 @@ public enum EnumVanillaWoodType implements IWoodType {
return ordinal();
}
@Nonnull
public static EnumVanillaWoodType byMetadata(int meta) {
if (meta < 0 || meta >= VALUES.length) {
meta = 0;
@@ -64,14 +62,14 @@ public enum EnumVanillaWoodType implements IWoodType {
public int getCarbonization() {
return carbonization;
}
@Override
public float getCharcoalChance(int numberOfCharcoal) {
if(numberOfCharcoal == 3){
if (numberOfCharcoal == 3) {
return 0.75F;
}else if(numberOfCharcoal == 4){
} else if (numberOfCharcoal == 4) {
return 0.5F;
}else if(numberOfCharcoal == 5){
} else if (numberOfCharcoal == 5) {
return 0.25F;
}
return 0.15F;
@@ -79,7 +77,7 @@ public enum EnumVanillaWoodType implements IWoodType {
@Override
public String getPlankTexture() {
if(this == DARK_OAK){
if (this == DARK_OAK) {
return "blocks/planks_big_oak";
}
return "blocks/planks_" + getName();
@@ -87,7 +85,7 @@ public enum EnumVanillaWoodType implements IWoodType {
@Override
public String getDoorLowerTexture() {
if(this == OAK){
if (this == OAK) {
return "blocks/door_wood_lower";
}
return "blocks/door_wood_lower";
@@ -95,7 +93,7 @@ public enum EnumVanillaWoodType implements IWoodType {
@Override
public String getDoorUpperTexture() {
if(this == OAK){
if (this == OAK) {
return "blocks/door_wood_upper";
}
return "blocks/door_" + getName() + "_upper";
@@ -103,7 +101,7 @@ public enum EnumVanillaWoodType implements IWoodType {
@Override
public String getBarkTexture() {
if(this == DARK_OAK){
if (this == DARK_OAK) {
return "blocks/log_big_oak";
}
return "blocks/log_" + getName();
@@ -111,7 +109,7 @@ public enum EnumVanillaWoodType implements IWoodType {
@Override
public String getHeartTexture() {
if(this == DARK_OAK){
if (this == DARK_OAK) {
return "blocks/log_big_oak_top";
}
return "blocks/log_" + getName() + "_top";
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import forestry.api.genetics.IAlleleProperty;
@@ -15,13 +14,11 @@ import forestry.api.genetics.IAlleleProperty;
*/
public interface IAlleleFruit extends IAlleleProperty<IAlleleFruit> {
@Nonnull
IFruitProvider getProvider();
@Nullable
String getModelName();
@Nonnull
String getModID();
}
@@ -1,17 +0,0 @@
/*******************************************************************************
* 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.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IGrowthProvider}.
*/
public interface IAlleleGrowth extends IAllele {
IGrowthProvider getProvider();
}
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import java.util.Collection;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -21,47 +20,40 @@ import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IFruitFamily;
public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleTreeSpecies> {
@Nonnull
@Override
ITreeRoot getRoot();
/**
* @return Native plant type of this species.
*/
@Nonnull
EnumPlantType getPlantType();
/**
* @return List of all {@link IFruitFamily}s which can grow on leaves generated by this species.
*/
@Nonnull
Collection<IFruitFamily> getSuitableFruit();
/**
* @return Tree generator for this species.
*/
@Nonnull
ITreeGenerator getGenerator();
/**
* @return The modid from the mod of the species.
*/
@Nonnull
String getModID();
IWoodProvider getWoodProvider();
/* MODELS AND OVERRIDES */
@SideOnly(Side.CLIENT)
@Nonnull
ILeafSpriteProvider getLeafSpriteProvider();
@SideOnly(Side.CLIENT)
int getGermlingColour(EnumGermlingType type, int renderPass);
@SideOnly(Side.CLIENT)
@Nonnull
ModelResourceLocation getGermlingModel(EnumGermlingType type);
@SideOnly(Side.CLIENT)
@@ -5,13 +5,12 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@@ -23,7 +22,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.genetics.IFruitFamily;
public interface IFruitProvider {
IFruitFamily getFamily();
int getColour(ITreeGenome genome, IBlockAccess world, BlockPos pos, int ripeningTime);
@@ -36,15 +34,12 @@ public interface IFruitProvider {
int getRipeningPeriod();
// / Products, Chance
@Nonnull
Map<ItemStack, Float> getProducts();
// / Specialty, Chance
@Nonnull
Map<ItemStack, Float> getSpecialty();
@Nonnull
List<ItemStack> getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime);
NonNullList<ItemStack> getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime);
/**
* @return Short, human-readable identifier used in the treealyzer.
@@ -54,7 +49,6 @@ public interface IFruitProvider {
@Nullable
String getModelName();
@Nonnull
String getModID();
/* TEXTURE OVERLAY */
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
@@ -23,8 +21,7 @@ import forestry.api.core.IModelManager;
public interface IGermlingModelProvider {
@SideOnly(Side.CLIENT)
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
@Nonnull
ModelResourceLocation getModel(EnumGermlingType type);
/**
@@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nullable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* @deprecated this is being removed to simplify trees
*/
@Deprecated
public interface IGrowthProvider {
/**
* Check to see whether a sapling at the given location with the given genome can grow into a tree.
*
* @param genome Genome of the tree this is called for.
* @param world Minecraft world the tree will inhabit.
* @param pos Coordinates to attempt growth at.
* @param expectedGirth Trunk size of the tree to generate.
* @param expectedHeight Height of the tree to generate.
* @return position that the tree can grow, null otherwise.
*/
@Nullable
BlockPos canGrow(ITreeGenome genome, World world, BlockPos pos, int expectedGirth, int expectedHeight);
/**
* @return Short, human-readable identifier used in the treealyzer.
*/
String getDescription();
/**
* @return Detailed description of growth behaviour used in the treealyzer.
*/
String[] getInfo();
}
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import net.minecraft.util.ResourceLocation;
/**
@@ -17,7 +15,6 @@ import net.minecraft.util.ResourceLocation;
* Icon registration is not done here because these icons are heavily reused.
*/
public interface ILeafSpriteProvider {
@Nonnull
ResourceLocation getSprite(boolean pollinated, boolean fancy);
int getColor(boolean pollinated);
@@ -5,9 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import com.mojang.authlib.GameProfile;
@@ -15,6 +13,7 @@ import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
import forestry.api.world.ITreeGenData;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -28,10 +27,10 @@ public interface ITree extends IIndividual, ITreeGenData {
IEffectData[] doFX(IEffectData[] storedData, World world, BlockPos pos);
@Nonnull
@Override
ITreeGenome getGenome();
@Nullable
ITreeGenome getMate();
/**
@@ -40,15 +39,12 @@ public interface ITree extends IIndividual, ITreeGenData {
ITree[] getSaplings(World world, GameProfile playerProfile, BlockPos pos, float modifier);
// Products, Chance
@Nonnull
Map<ItemStack, Float> getProducts();
// Specialties, Chance
@Nonnull
Map<ItemStack, Float> getSpecialties();
@Nonnull
List<ItemStack> produceStacks(World world, BlockPos pos, int ripeningTime);
NonNullList<ItemStack> produceStacks(World world, BlockPos pos, int ripeningTime);
/**
* @return Boolean indicating whether a sapling can stay planted at the given position.
@@ -72,7 +68,7 @@ public interface ITree extends IIndividual, ITreeGenData {
* @return Integer denoting how resilient leaf blocks are against adverse influences (i.e. caterpillars).
*/
int getResilience();
/**
* @return Integer denoting the size of the tree trunk.
*/
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nullable;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -22,5 +24,5 @@ public interface ITreeGenerator {
boolean setLogBlock(ITreeGenome genome, World world, BlockPos pos, EnumFacing facing);
boolean setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos);
boolean setLeaves(ITreeGenome genome, World world, @Nullable GameProfile owner, BlockPos pos);
}
@@ -5,21 +5,16 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import forestry.api.genetics.IGenome;
public interface ITreeGenome extends IGenome {
@Override
@Nonnull
IAlleleTreeSpecies getPrimary();
@Override
@Nonnull
IAlleleTreeSpecies getSecondary();
@Nonnull
IFruitProvider getFruitProvider();
float getHeight();
@@ -5,9 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -48,12 +46,13 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
* @return {@link IArboristTracker} associated with the passed world.
*/
@Override
IArboristTracker getBreedingTracker(World world, GameProfile player);
IArboristTracker getBreedingTracker(World world, @Nullable GameProfile player);
/* TREE SPECIFIC */
/**
* Register a leaf tick handler.
*
* @param handler the {@link ILeafTickHandler} to register.
*/
void registerLeafTickHandler(ILeafTickHandler handler);
@@ -67,6 +66,7 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
@Override
EnumGermlingType getType(ItemStack stack);
@Nullable
ITree getTree(World world, BlockPos pos);
ITree getTree(World world, ITreeGenome genome);
@@ -79,7 +79,7 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
@Override
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
boolean setFruitBlock(@Nonnull World world, @Nonnull IAlleleFruit allele, float sappiness, BlockPos pos);
boolean setFruitBlock(World world, ITreeGenome genome, IAlleleFruit allele, float sappiness, BlockPos pos);
/* GAME MODE */
List<ITreekeepingMode> getTreekeepingModes();
@@ -93,8 +93,9 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
void setTreekeepingMode(World world, String name);
/* TEMPLATES */
@Override
ArrayList<ITree> getIndividualTemplates();
List<ITree> getIndividualTemplates();
/* MUTATIONS */
@Override
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import forestry.api.core.ITextureManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.Item;
@@ -19,13 +17,11 @@ public interface IWoodProvider {
void registerSprites(Item item, ITextureManager manager);
/**
*
* @return The texture sprite of the wood.
*/
@SideOnly(Side.CLIENT)
@Nonnull
TextureAtlasSprite getSprite(boolean isTop);
/**
* @return A stack of wood from the tree to craft wood pile's or other things.
*/
@@ -35,7 +31,7 @@ public interface IWoodProvider {
* The amount of charcoal dropped from a charcoal pile of this wood.
*/
int getCarbonization();
/**
* The chance that a pile has to drop a extra charcoal
*/
@@ -3,8 +3,8 @@ package forestry.api.arboriculture;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelProcessingHelper;
@@ -12,55 +12,55 @@ public enum WoodBlockKind {
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR(false);
public final boolean retextureItem;
private WoodBlockKind() {
WoodBlockKind() {
this(true);
}
private WoodBlockKind(boolean retextureItem) {
WoodBlockKind(boolean retextureItem) {
this.retextureItem = retextureItem;
}
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
}
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures){
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures) {
Map<String, String> textures = new HashMap<>();
switch (this) {
case SLAB:
case STAIRS:
String textureLocation = type.getPlankTexture();
textures.put("particle", textureLocation);
textures.put("side", textureLocation);
textures.put("top", textureLocation);
textures.put("bottom", textureLocation);
textures.put("all", textureLocation);
break;
case PLANKS:
textures.put("particle", type.getPlankTexture());
textures.put("all", type.getPlankTexture());
break;
case FENCE_GATE:
case FENCE:
textures.put("particle", type.getPlankTexture());
textures.put("side", type.getPlankTexture());
textures.put("texture", type.getPlankTexture());
break;
case DOOR:
textures.put("particle", type.getDoorLowerTexture());
textures.put("bottom", type.getDoorLowerTexture());
textures.put("top", type.getDoorUpperTexture());
break;
case LOG:
textures.put("particle", type.getBarkTexture());
textures.put("side", type.getBarkTexture());
textures.put("all", type.getBarkTexture());
textures.put("end", type.getHeartTexture());
break;
default:
break;
case SLAB:
case STAIRS:
String textureLocation = type.getPlankTexture();
textures.put("particle", textureLocation);
textures.put("side", textureLocation);
textures.put("top", textureLocation);
textures.put("bottom", textureLocation);
textures.put("all", textureLocation);
break;
case PLANKS:
textures.put("particle", type.getPlankTexture());
textures.put("all", type.getPlankTexture());
break;
case FENCE_GATE:
case FENCE:
textures.put("particle", type.getPlankTexture());
textures.put("side", type.getPlankTexture());
textures.put("texture", type.getPlankTexture());
break;
case DOOR:
textures.put("particle", type.getDoorLowerTexture());
textures.put("bottom", type.getDoorLowerTexture());
textures.put("top", type.getDoorUpperTexture());
break;
case LOG:
textures.put("particle", type.getBarkTexture());
textures.put("side", type.getBarkTexture());
textures.put("all", type.getBarkTexture());
textures.put("end", type.getHeartTexture());
break;
default:
break;
}
textures.putAll(customTextures);
return ModelProcessingHelper.retexture(model, new ImmutableMap.Builder<String, String>().putAll(textures).build());
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "4.2.1", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
package forestry.api.arboriculture;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.circuits;
import javax.annotation.Nonnull;
import java.util.List;
import forestry.api.core.INbtWritable;
@@ -26,13 +25,11 @@ public interface ICircuitBoard extends INbtWritable {
void onTick(Object tile);
@Nonnull
ICircuit[] getCircuits();
/**
* Specifies where a circuit can be used.
*/
@Nonnull
ICircuitSocketType getSocketType();
}
@@ -5,26 +5,20 @@
******************************************************************************/
package forestry.api.circuits;
import javax.annotation.Nonnull;
public interface ICircuitLayout {
/** unique ID for this circuit layout */
@Nonnull
String getUID();
/** localized name for this circuit layout */
@Nonnull
String getName();
/** localized string for how this circuit layout is used */
@Nonnull
String getUsage();
/**
* Specifies where a circuit layout is used.
*/
@Nonnull
ICircuitSocketType getSocketType();
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.circuits;
import javax.annotation.Nullable;
import java.util.Map;
import net.minecraft.item.ItemStack;
@@ -30,6 +31,7 @@ public interface ICircuitRegistry {
ICircuitLayout getDefaultLayout();
@Nullable
ICircuitBoard getCircuitBoard(ItemStack itemstack);
boolean isChipset(ItemStack itemstack);
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "3.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|circuits")
package forestry.api.circuits;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,39 +5,35 @@
******************************************************************************/
package forestry.api.climate;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IClimateManager {
float getTemperature(World world, BlockPos pos);
float getHumidity(World world, BlockPos pos);
@Nonnull
IClimateProvider getDefaultClimate(World world, BlockPos pos);
void addRegion(IClimateRegion region);
void removeRegion(IClimateRegion region);
void addSource(IClimateSourceProvider source);
void removeSource(IClimateSourceProvider source);
@Nullable
IClimatePosition getPosition(World world, BlockPos pos);
@Nullable
IClimateRegion getRegionForPos(World world, BlockPos pos);
@Nonnull
Map<Integer, List<IClimateRegion>> getRegions();
}
@@ -5,18 +5,14 @@
******************************************************************************/
package forestry.api.climate;
import javax.annotation.Nonnull;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.util.math.BlockPos;
public interface IClimatePosition extends INbtReadable, INbtWritable {
@Nonnull
IClimateRegion getClimateRegion();
@Nonnull
BlockPos getPos();
void setTemperature(float temperature);
@@ -8,38 +8,34 @@ package forestry.api.climate;
import java.util.Collection;
import java.util.Map;
import javax.annotation.Nonnull;
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 {
@Nonnull
World getWorld();
/**
* Update the climate in a region.
*/
void updateClimate(int ticks);
int getTicksPerUpdate();
@Nonnull
Map<BlockPos, IClimatePosition> getPositions();
void addSource(IClimateSource source);
void removeSource(IClimateSource source);
Collection<IClimateSource> getSources();
Collection<BlockPos> getOtherPositions();
float getTemperature();
float getHumidity();
}
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.climate;
import javax.annotation.Nullable;
/**
* A climate source is used to change the climate in a region.
*/
@@ -21,7 +23,8 @@ public interface IClimateSource {
* @return The ticks that are required for one change.
*/
int getTicksForChange(IClimateRegion region);
@Nullable
IClimateSourceProvider getProvider();
}
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
package forestry.api.climate;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -22,7 +22,7 @@ public class BiomeHelper {
return isBiomeHellishCache.get(biomeGen);
}
boolean isBiomeHellish = BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
boolean isBiomeHellish = BiomeDictionary.hasType(biomeGen, BiomeDictionary.Type.NETHER);
isBiomeHellishCache.put(biomeGen, isBiomeHellish);
return isBiomeHellish;
}
@@ -5,33 +5,33 @@
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nullable;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
public interface ICamouflageAccess {
/**
* Register a item camouflage handler for a type.
*
* @param type The camouflage type for of handler.
*
* @param itemHandler The handler that is to register.
*/
void registerCamouflageItemHandler(@Nonnull ICamouflageItemHandler itemHandler);
void registerCamouflageItemHandler(ICamouflageItemHandler itemHandler);
/**
* @return A list of all item camouflage handler's that are registered for that camouflage type.
*/
List<ICamouflageItemHandler> getCamouflageItemHandler(@Nonnull String type);
void addItemToBlackList(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
void addModIdToBlackList(@Nonnull String type, @Nonnull String modID);
boolean isItemBlackListed(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
@Nullable
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
void addItemToBlackList(String type, ItemStack camouflageBlock);
void addModIdToBlackList(String type, String modID);
boolean isItemBlackListed(String type, ItemStack camouflageBlock);
@Nullable
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
}
@@ -5,23 +5,22 @@
******************************************************************************/
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);
}
@@ -5,10 +5,10 @@
******************************************************************************/
package forestry.api.core;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.network.PacketBuffer;
/**
* Keeps track of all the IErrorStates for an object.
* Create a new IErrorLogic instance for your object with ForestryAPI.errorStateRegistry.createErrorLogic().
@@ -39,7 +39,7 @@ public interface IErrorLogic extends IErrorSource {
/**
* Network serialization for syncing errors to the client from the server.
*/
void writeData(DataOutputStream data) throws IOException;
void writeData(PacketBuffer data);
void readData(DataInputStream data) throws IOException;
void readData(PacketBuffer data);
}
@@ -1,11 +1,10 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -25,28 +24,28 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IModelBaker {
void setRenderBounds(@Nonnull AxisAlignedBB renderBounds);
void setRenderBounds(AxisAlignedBB renderBounds);
void setRenderBounds(double d, double e, double f, double g, double h, double i);
void setColorIndex(int color);
void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite[] sprites, int colorIndex);
void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite sprites, int colorIndex);
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite[] textures, int colorIndex);
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
void addBlockModel(Block block, AxisAlignedBB renderBounds, @Nullable BlockPos pos, TextureAtlasSprite[] sprites, int colorIndex);
void addBlockModel(Block block, AxisAlignedBB renderBounds, @Nullable BlockPos pos, TextureAtlasSprite sprites, int colorIndex);
void addModel(AxisAlignedBB renderBounds, TextureAtlasSprite[] textures, int colorIndex);
void addModel(AxisAlignedBB renderBounds, TextureAtlasSprite texture, int colorIndex);
void addBakedModel(@Nullable IBlockState state, IBakedModel model);
void addFace(EnumFacing facing, TextureAtlasSprite sprite);
void setModelState(@Nullable IModelState modelState);
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
void setParticleSprite(TextureAtlasSprite particleSprite);
IModelBakerModel bakeModel(boolean flip);
}
@@ -1,11 +1,10 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.block.model.BakedQuad;
@@ -18,23 +17,21 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IModelBakerModel extends IPerspectiveAwareModel {
void setGui3d(boolean gui3d);
void setAmbientOcclusion(boolean ambientOcclusion);
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
void addQuad(@Nullable EnumFacing facing, @Nonnull BakedQuad quad);
void setParticleSprite(TextureAtlasSprite particleSprite);
void addQuad(@Nullable EnumFacing facing, BakedQuad quad);
void setRotation(float[] rotation);
void setTranslation(float[] translation);
void setScale(float[] scale);
IModelState getModelState();
float[] getRotation();
float[] getTranslation();
@@ -12,43 +12,12 @@ package forestry.api.core;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Taken from BuildCraft 5.0.x
*/
public interface IToolPipette {
/**
* @param pipette
* ItemStack of the pipette.
* @return Capacity of the pipette.
*/
int getCapacity(ItemStack pipette);
/**
* @param pipette
* @return true if the pipette can pipette.
*/
boolean canPipette(ItemStack pipette);
/**
* Fills the pipette with the given liquid stack.
*
* @param pipette
* @param liquid
* @param doFill
* @return Amount of liquid used in filling the pipette.
*/
int fill(ItemStack pipette, FluidStack liquid, boolean doFill);
/**
* Drains liquid from the pipette
*
* @param pipette
* @param maxDrain
* @param doDrain
* @return Fluid stack representing the liquid and amount drained from the pipette.
*/
FluidStack drain(ItemStack pipette, int maxDrain, boolean doDrain);
}
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
package forestry.api.core;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -8,6 +8,7 @@ package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
/**
@@ -27,7 +28,7 @@ public class DefaultFarmListener implements IFarmListener {
}
@Override
public void hasCollected(Collection<ItemStack> collected, IFarmLogic logic) {
public void hasCollected(NonNullList<ItemStack> collected, IFarmLogic logic) {
}
@@ -23,7 +23,6 @@ public enum FarmDirection {
return forgeDirection;
}
@SuppressWarnings("incomplete-switch")
public static FarmDirection getFarmDirection(EnumFacing forgeDirection) {
switch (forgeDirection) {
case NORTH:
@@ -34,7 +33,8 @@ public enum FarmDirection {
return SOUTH;
case WEST:
return WEST;
default:
throw new IllegalArgumentException("Farm directios can only be NORTH, EAST, SOUTH, or WEST. Got: " + forgeDirection);
}
return null;
}
}
@@ -11,19 +11,16 @@ import com.google.common.collect.Multimap;
import net.minecraft.item.ItemStack;
import java.util.LinkedHashMap;
import javax.annotation.Nonnull;
import java.util.Map;
public class Farmables {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
*
* <p>
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
*/
@Nonnull
public static final Multimap<String, IFarmable> farmables = HashMultimap.create();
@Nonnull
public static final LinkedHashMap<ItemStack, Integer> fertilizers = new LinkedHashMap();
public static final Map<ItemStack, Integer> fertilizers = new LinkedHashMap<>();
}
@@ -5,11 +5,10 @@
******************************************************************************/
package forestry.api.farming;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
public interface ICrop {
@@ -17,11 +16,10 @@ public interface ICrop {
/**
* Harvests this crop. Performs the necessary manipulations to set the crop into a "harvested" state.
*
* @return Products harvested.
* @return Products harvested. Null if this crop cannot be harvested
*/
@Nullable
Collection<ItemStack> harvest();
NonNullList<ItemStack> harvest();
@Nonnull
BlockPos getPosition();
}
@@ -7,11 +7,12 @@ package forestry.api.farming;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public interface IFarmInventory {
boolean hasResources(ItemStack[] resources);
boolean hasResources(NonNullList<ItemStack> resources);
void removeResources(ItemStack[] resources);
void removeResources(NonNullList<ItemStack> resources);
boolean acceptsAsGermling(ItemStack itemstack);
@@ -8,6 +8,7 @@ package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
public interface IFarmListener {
@@ -33,7 +34,7 @@ public interface IFarmListener {
*
* @param collected Collection of collected stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
*/
void hasCollected(Collection<ItemStack> collected, IFarmLogic logic);
void hasCollected(NonNullList<ItemStack> collected, IFarmLogic logic);
/**
* Called after farmland has successfully been cultivated by a farm logic.
@@ -8,6 +8,7 @@ package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -25,7 +26,7 @@ public interface IFarmLogic {
boolean isAcceptedGermling(ItemStack itemstack);
Collection<ItemStack> collect(World world, IFarmHousing farmHousing);
NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing);
boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent);
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "2.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
package forestry.api.farming;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -6,7 +6,7 @@
package forestry.api.food;
public class BeverageManager {
public static IBeverageEffect[] effectList = new IBeverageEffect[128];
public static final IBeverageEffect[] effectList = new IBeverageEffect[128];
public static IInfuserManager infuserManager;
public static IIngredientManager ingredientManager;
@@ -6,19 +6,20 @@
package forestry.api.food;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public interface IInfuserManager {
void addMixture(int meta, ItemStack ingredient, IBeverageEffect effect);
void addMixture(int meta, ItemStack[] ingredients, IBeverageEffect effect);
void addMixture(int meta, NonNullList<ItemStack> ingredients, IBeverageEffect effect);
ItemStack getSeasoned(ItemStack base, ItemStack[] ingredients);
ItemStack getSeasoned(ItemStack base, NonNullList<ItemStack> ingredients);
boolean hasMixtures(ItemStack[] ingredients);
boolean hasMixtures(NonNullList<ItemStack> ingredients);
boolean isIngredient(ItemStack itemstack);
ItemStack[] getRequired(ItemStack[] ingredients);
NonNullList<ItemStack> getRequired(NonNullList<ItemStack> ingredients);
}
@@ -5,10 +5,13 @@
******************************************************************************/
package forestry.api.food;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
public interface IIngredientManager {
@Nullable
String getDescription(ItemStack itemstack);
void addIngredient(ItemStack ingredient, String description);
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "1.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|food")
package forestry.api.food;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.fuels;
import com.google.common.base.Preconditions;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
@@ -14,6 +15,10 @@ public class MoistenerFuel {
private final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
Preconditions.checkNotNull(item);
Preconditions.checkNotNull(product);
Preconditions.checkArgument(!item.isEmpty());
Preconditions.checkArgument(!product.isEmpty());
this.item = item;
this.product = product;
this.stage = stage;
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
package forestry.api.fuels;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -23,12 +23,12 @@ public class AlleleManager {
/**
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
*/
public static Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
public static final Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
/**
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public static Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
public static final Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
/**
* Queryable instance of an {@link IClimateHelper} for easier implementation.
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
/**
* Basic effect allele.
*/
@@ -1,16 +0,0 @@
/*******************************************************************************
* 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.EnumSet;
import net.minecraftforge.common.EnumPlantType;
public interface IAllelePlantType extends IAllele {
EnumSet<EnumPlantType> getPlantTypes();
}
@@ -1,13 +1,11 @@
package forestry.api.genetics;
import javax.annotation.Nonnull;
public interface IAlleleProperty<A extends IAlleleProperty<A>> extends IAllele, Comparable<A> {
/**
* To compare the allele for the properties
*/
@Override
int compareTo(@Nonnull A o);
int compareTo(A o);
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
@@ -39,6 +40,7 @@ public interface IAlleleRegistry {
* @param uid Unique id for the species class, i.e. "rootBees", "rootTrees", "rootButterflies".
* @return {@link ISpeciesRoot} if it exists, null otherwise.
*/
@Nullable
ISpeciesRoot getSpeciesRoot(String uid);
/**
@@ -46,6 +48,7 @@ public interface IAlleleRegistry {
* @param stack An itemstack possibly containing NBT data which can be converted by a species root.
* @return {@link ISpeciesRoot} if found, null otherwise.
*/
@Nullable
ISpeciesRoot getSpeciesRoot(ItemStack stack);
/**
@@ -53,8 +56,14 @@ public interface IAlleleRegistry {
* @param clz Class extending {@link IIndividual}.
* @return {@link ISpeciesRoot} if found, null otherwise.
*/
@Nullable
ISpeciesRoot getSpeciesRoot(Class<? extends IIndividual> clz);
/**
* Retrieve a matching {@link ISpeciesRoot} for the given {@link IIndividual}
*/
ISpeciesRoot getSpeciesRoot(IIndividual individual);
/* INDIVIDUAL */
/**
@@ -72,6 +81,7 @@ public interface IAlleleRegistry {
* Stack to retrieve genetic information for.
* @return IIndividual containing genetic information, null if none could be extracted.
*/
@Nullable
IIndividual getIndividual(ItemStack stack);
/* ALLELES */
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -20,6 +22,7 @@ public interface IBreedingTracker {
/**
* @return Name of the current {@link IBeekeepingMode}.
*/
@Nullable
String getModeName();
/**
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
/**
* Biological classifications from domain down to genus.
*
@@ -62,12 +64,12 @@ public interface IClassification {
/**
* A branch approximates a "genus" in real life. Real life examples: "Micrapis", "Megapis"
*
* @return flavour text (may be null)
* @return flavour text
*/
String getScientific();
/**
* @return Localized description of this branch. (May be null.)
* @return Localized description of this branch.
*/
String getDescription();
@@ -96,12 +98,11 @@ public interface IClassification {
/**
* @return Parent classification, null if this is root.
*/
@Nullable
IClassification getParent();
/**
* Only used internally by the AlleleRegistry if this classification has been added to another one.
*
* @param parent
*/
void setParent(IClassification parent);
}
@@ -16,13 +16,9 @@ import forestry.api.core.INbtWritable;
public interface IEffectData extends INbtWritable, INbtReadable {
void setInteger(int index, int val);
void setFloat(int index, float val);
void setBoolean(int index, boolean val);
int getInteger(int index);
float getFloat(int index);
boolean getBoolean(int index);
}
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -29,5 +31,5 @@ public interface IFlowerProvider {
* If this flowerProvider does not affect the products, it should return the products unchanged.
* @return Array of itemstacks being the (modified or unmodified) produce.
*/
ItemStack[] affectProducts(World world, IIndividual individual, BlockPos pos, ItemStack[] products);
List<ItemStack> affectProducts(World world, IIndividual individual, BlockPos pos, List<ItemStack> products);
}
@@ -5,17 +5,15 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nonnull;
import java.util.List;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeHousing;
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;
// 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.
@@ -43,6 +41,7 @@ public interface IFlowerRegistry {
* Registers custom logic for accepted flowers.
* These rules are inefficient compared to ones made with registerAcceptableFlower, but may be necessary for tile entity flowers.
* The flower types built into Forestry can not be used here.
*
* @since Forestry 4.0.8
*/
void registerAcceptableFlowerRule(IFlowerAcceptableRule flowerAcceptableRule, String... flowerTypes);
@@ -51,7 +50,7 @@ public interface IFlowerRegistry {
* Registers a plantable flower.
* The distribution is based on its own weight and the total number of plants for this flowerType.
*
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
* @param flowerTypes See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
*/
void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes);
@@ -63,12 +62,11 @@ public interface IFlowerRegistry {
/**
* @param beeHousing The bee housing that will help determine the size of the area to check.
* @param bee The bee that will help determine the size of the area to check.
* @param bee The bee that will help determine the size of the area to check.
* @param flowerType See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
* @param maxFlowers the largest number of flowers to check for before returning. Use 1 if you only need 1.
* @return the coordinates of nearby accepted flowers, with size from 0 to maxFlowers.
*/
@Nonnull
List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers);
/**
@@ -5,9 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
/**
* Can be implemented by tile entities which can bear fruit.
@@ -30,10 +29,10 @@ public interface IFruitBearer {
* Picks the fruits of this tile, resetting it to unripe fruits.
*
* @param tool
* Tool used in picking the fruits. May be null.
* Tool used in picking the fruits. May be empty.
* @return Picked fruits.
*/
Collection<ItemStack> pickFruit(ItemStack tool);
NonNullList<ItemStack> pickFruit(ItemStack tool);
/**
* @return float indicating the ripeness of the fruit with >= 1.0f indicating full ripeness.
@@ -5,34 +5,26 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nonnull;
import forestry.api.core.INbtWritable;
/**
* Holds the {@link IChromosome}s which comprise the traits of a given individual.
*
* <p>
* Only the default implementation is supported.
*/
public interface IGenome extends INbtWritable {
@Nonnull
IAlleleSpecies getPrimary();
@Nonnull
IAlleleSpecies getSecondary();
@Nonnull
IChromosome[] getChromosomes();
@Nonnull
IAllele getActiveAllele(IChromosomeType chromosomeType);
@Nonnull
IAllele getInactiveAllele(IChromosomeType chromosomeType);
boolean isGeneticEqual(IGenome other);
@Nonnull
ISpeciesRoot getSpeciesRoot();
}
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nonnull;
import java.util.List;
import forestry.api.core.INbtWritable;
@@ -35,7 +34,6 @@ public interface IIndividual extends INbtWritable {
boolean isSecret();
@Nonnull
IGenome getGenome();
/**
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.world.World;
public interface IIndividualLiving extends IIndividual {
@@ -12,6 +14,7 @@ public interface IIndividualLiving extends IIndividual {
/**
* @return Genetic information of the mate, null if unmated.
*/
@Nullable
IGenome getMate();
/**
@@ -6,7 +6,6 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -39,6 +38,7 @@ public interface ISpeciesRoot {
/**
* Used to check whether a given itemstack contains genetic data corresponding to an {@link IIndividual} of this class.
*
* @param stack itemstack to check.
* @return true if the itemstack contains an {@link IIndividual} of this class, false otherwise.
*/
@@ -46,14 +46,16 @@ public interface ISpeciesRoot {
/**
* Used to check whether a given itemstack contains genetic data corresponding to an {@link IIndividual} of this class and matches the given type.
*
* @param stack itemstack to check.
* @param type Integer denoting the type needed to match. (i.e. butterfly vs. butterfly serum; bee queens, princesses, drones; etc.)
* @param type Integer denoting the type needed to match. (i.e. butterfly vs. butterfly serum; bee queens, princesses, drones; etc.)
* @return true if the itemstack contains an {@link IIndividual} of this class, false otherwise.
*/
boolean isMember(ItemStack stack, ISpeciesType type);
/**
* Used to check whether the given {@link IIndividual} is member of this class.
*
* @param individual {@link IIndividual} to check.
* @return true if the individual is member of this class, false otherwise.
*/
@@ -66,13 +68,15 @@ public interface ISpeciesRoot {
@Nullable
ISpeciesType getType(ItemStack itemStack);
/** Species type used to represent this species in icons */
/**
* Species type used to represent this species in icons
*/
ISpeciesType getIconType();
ItemStack getMemberStack(IIndividual individual, ISpeciesType type);
/* BREEDING TRACKER */
IBreedingTracker getBreedingTracker(World world, GameProfile player);
IBreedingTracker getBreedingTracker(World world, @Nullable GameProfile player);
/* GENOME MANIPULATION */
IIndividual templateAsIndividual(IAllele[] template);
@@ -109,6 +113,7 @@ public interface ISpeciesRoot {
* @param identifier species UID
* @return Array of {@link IAllele} representing a genome.
*/
@Nullable
IAllele[] getTemplate(String identifier);
/**
@@ -124,7 +129,7 @@ public interface ISpeciesRoot {
Map<String, IAllele[]> getGenomeTemplates();
ArrayList<? extends IIndividual> getIndividualTemplates();
List<? extends IIndividual> getIndividualTemplates();
/* MUTATIONS */
@@ -147,8 +152,8 @@ public interface ISpeciesRoot {
List<? extends IMutation> getCombinations(IAllele other);
/**
* @since Forestry 3.7
* @return all possible mutations that result from breeding two species
* @since Forestry 3.7
*/
List<IMutation> getCombinations(IAlleleSpecies parentSpecies0, IAlleleSpecies parentSpecies1, boolean shuffle);
@@ -163,7 +168,8 @@ public interface ISpeciesRoot {
/**
* Sets an item stack as a valid (generic) research catalyst for this class.
* @param itemstack ItemStack to set as suitable.
*
* @param itemstack ItemStack to set as suitable.
* @param suitability Float between 0 and 1 to indicate suitability.
*/
void setResearchSuitability(ItemStack itemstack, float suitability);
@@ -1,5 +1,7 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import com.mojang.authlib.GameProfile;
import net.minecraft.util.math.BlockPos;
@@ -12,7 +14,8 @@ import net.minecraft.world.World;
public interface ISpeciesRootPollinatable extends ISpeciesRoot {
ICheckPollinatable createPollinatable(IIndividual individual);
IPollinatable tryConvertToPollinatable(GameProfile owner, World world, final BlockPos pos, final IIndividual pollen);
@Nullable
IPollinatable tryConvertToPollinatable(@Nullable GameProfile owner, World world, final BlockPos pos, final IIndividual pollen);
}
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "4.7.1", owner = "ForestryAPI|core", provides = "ForestryAPI|genetics")
package forestry.api.genetics;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,71 +5,64 @@
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraftforge.fml.common.eventhandler.Event;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedTile;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraftforge.fml.common.eventhandler.Event;
public class GreenhouseEvents extends Event {
@Nullable
public final IGreenhouseController controller;
public GreenhouseEvents(@Nullable IGreenhouseController state) {
this.controller = state;
}
public static class CamouflageChangeEvent extends GreenhouseEvents{
public static class CamouflageChangeEvent extends GreenhouseEvents {
@Nullable
public ICamouflagedTile camouflagedBlock;
@Nonnull
public ICamouflageHandler camouflageHandler;
@Nonnull
public final ICamouflagedTile camouflagedBlock;
public final ICamouflageHandler camouflageHandler;
public final String camouflageType;
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull String camouflageType) {
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, ICamouflageHandler camouflageHandler, String camouflageType) {
super(controller);
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
this.camouflageType = camouflageType;
}
}
public static class InternalBlockEvent extends GreenhouseEvents{
@Nonnull
public IInternalBlock internalBlock;
public InternalBlockEvent(IGreenhouseController controller, @Nonnull IInternalBlock internalBlock) {
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{
this.internalBlock = internalBlock;
}
}
public static class CreateInternalBlockEvent extends InternalBlockEvent {
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
super(controller, internalBlock);
}
}
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent{
@Nonnull
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent {
public final IInternalBlockFace face;
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, IInternalBlockFace face) {
super(controller, internalBlock);
this.face = face;
}
}
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nullable;
import java.util.List;
import forestry.api.multiblock.IGreenhouseController;
@@ -16,6 +17,7 @@ public interface IGreenhouseHelper {
/**
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
*/
@Nullable
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
void addGreenhouseLogic(Class<? extends IGreenhouseLogic> logic);
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
@@ -13,14 +12,12 @@ import java.util.Collection;
import net.minecraft.util.math.BlockPos;
public interface IInternalBlock {
@Nonnull
BlockPos getPos();
@Nullable
IInternalBlock getRoot();
@Nonnull
Collection<IInternalBlockFace> getFaces();
}
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
@@ -15,11 +13,9 @@ public interface IInternalBlockFace {
boolean isTested();
void setTested(boolean tested);
@Nonnull
EnumFacing getFace();
@Nonnull
BlockPos getPos();
}
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
package forestry.api.greenhouse;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -72,15 +72,15 @@ public enum EnumButterflyChromosome implements IChromosomeType {
COCOON(IAlleleButterflyCocoon.class);
Class<? extends IAllele> clss;
private final Class<? extends IAllele> alleleClass;
EnumButterflyChromosome(Class<? extends IAllele> clss) {
this.clss = clss;
EnumButterflyChromosome(Class<? extends IAllele> alleleClass) {
this.alleleClass = alleleClass;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return clss;
return alleleClass;
}
@Override
@@ -5,19 +5,17 @@
******************************************************************************/
package forestry.api.lepidopterology;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import forestry.api.genetics.IAlleleSpecies;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.genetics.IAlleleSpecies;
public interface IAlleleButterflySpecies extends IAlleleSpecies {
/**
* @return the IBeeRoot
*/
@@ -28,46 +26,46 @@ public interface IAlleleButterflySpecies extends IAlleleSpecies {
* @return Path of the texture to use for entity rendering.
*/
String getEntityTexture();
/**
* @return Path of the texture to use for item model.
*/
String getItemTexture();
/**
* Allows butterflies to restrict random spawns beyond the restrictions set by getTemperature() and getHumidity().
*
* @return EnumSet of biome tags this butterfly species can be spawned in.
*/
EnumSet<BiomeDictionary.Type> getSpawnBiomes();
Set<BiomeDictionary.Type> getSpawnBiomes();
/**
* @return true if a prospective spawn biome must not match a biome tag outside of getSpawnBiomes.
*/
boolean strictSpawnMatch();
/**
* @return Float between 0 and 1 representing the rarity of the species, will affect spawn rate.
*/
float getRarity();
/**
* @return Float representing the distance below which this butterfly will take flight if it detects a player which is not sneaking.
*/
float getFlightDistance();
/**
* @return true if this species is only active at night.
*/
boolean isNocturnal();
Map<ItemStack, Float> getButterflyLoot();
Map<ItemStack, Float> getCaterpillarLoot();
@SideOnly(Side.CLIENT)
void registerSprites();
/**
* @return The modid from the mod of the species.
*/
@@ -5,16 +5,15 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import forestry.api.genetics.IIndividualLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
public interface IButterfly extends IIndividualLiving {
@Nonnull
@Override
IButterflyGenome getGenome();
@@ -28,7 +27,7 @@ public interface IButterfly extends IIndividualLiving {
* @return Physical size of the butterfly.
*/
float getSize();
/**
* @param world
* @param x
@@ -60,30 +59,31 @@ public interface IButterfly extends IIndividualLiving {
* @param world
* @return create a caterpillar with the two genome's from the nursery.
*/
@Nullable
IButterfly spawnCaterpillar(World world, IButterflyNursery nursery);
/**
* @param entity
* @param playerKill Whether or not the butterfly was killed by a player.
* @param lootLevel Loot level according to the weapon used to kill the butterfly.
* @param lootLevel Loot level according to the weapon used to kill the butterfly.
* @return Array of itemstacks to drop on death of the given entity.
*/
ItemStack[] getLootDrop(IEntityButterfly entity, boolean playerKill, int lootLevel);
NonNullList<ItemStack> getLootDrop(IEntityButterfly entity, boolean playerKill, int lootLevel);
/**
* @param nursery
* @param playerKill Whether or not the nursery was broken by a player.
* @param lootLevel Fortune level.
* @param lootLevel Fortune level.
* @return Array of itemstacks to drop on breaking of the nursery.
*/
ItemStack[] getCaterpillarDrop(IButterflyNursery nursery, boolean playerKill, int lootLevel);
NonNullList<ItemStack> getCaterpillarDrop(IButterflyNursery nursery, boolean playerKill, int lootLevel);
/**
* @param cocoon
* @return Array of itemstacks to drop on breaking of the cocoon.
*/
ItemStack[] getCocoonDrop(IButterflyCocoon cocoon);
NonNullList<ItemStack> getCocoonDrop(IButterflyCocoon cocoon);
/**
* Create an exact copy of this butterfly.
*/
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nullable;
import forestry.api.genetics.IHousing;
public interface IButterflyCocoon extends IHousing{
@@ -17,7 +19,8 @@ public interface IButterflyCocoon extends IHousing{
IButterfly getCaterpillar();
void setCaterpillar(IButterfly butterfly);
@Nullable
IButterflyNursery getNursery();
void setNursery(IButterflyNursery nursery);
@@ -5,20 +5,16 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nonnull;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IGenome;
public interface IButterflyGenome extends IGenome {
@Override
@Nonnull
IAlleleButterflySpecies getPrimary();
@Override
@Nonnull
IAlleleButterflySpecies getSecondary();
float getSize();
@@ -26,7 +22,7 @@ public interface IButterflyGenome extends IGenome {
int getLifespan();
int getMetabolism();
int getFertility();
float getSpeed();
@@ -44,7 +40,7 @@ public interface IButterflyGenome extends IGenome {
IFlowerProvider getFlowerProvider();
IAlleleButterflyEffect getEffect();
IAlleleButterflyCocoon getCocoon();
}
@@ -5,17 +5,19 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nullable;
import forestry.api.climate.IClimateProvider;
import forestry.api.genetics.IHousing;
import forestry.api.genetics.IIndividual;
public interface IButterflyNursery extends IHousing, IClimateProvider {
@Nullable
IButterfly getCaterpillar();
IIndividual getNanny();
void setCaterpillar(IButterfly butterfly);
void setCaterpillar(@Nullable IButterfly butterfly);
boolean canNurse(IButterfly butterfly);
@@ -6,7 +6,6 @@
package forestry.api.lepidopterology;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import com.mojang.authlib.GameProfile;
@@ -43,15 +42,16 @@ public interface IButterflyRoot extends ISpeciesRoot {
/* BUTTERFLY SPECIFIC */
@Override
ILepidopteristTracker getBreedingTracker(World world, GameProfile player);
ILepidopteristTracker getBreedingTracker(World world, @Nullable GameProfile player);
/**
* Spawns the given butterfly in the world.
*
* @param butterfly
* @return butterfly entity on success, null otherwise.
*/
EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z);
boolean plantCocoon(World world, IButterflyNursery nursery, GameProfile owner, int age);
/**
@@ -61,7 +61,7 @@ public interface IButterflyRoot extends ISpeciesRoot {
/* TEMPLATES */
@Override
ArrayList<IButterfly> getIndividualTemplates();
List<IButterfly> getIndividualTemplates();
/* MUTATIONS */
@Override
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.lepidopterology;
import javax.annotation.Nullable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.passive.IAnimals;
@@ -23,9 +25,10 @@ public interface IEntityButterfly extends IAnimals {
*/
EntityCreature getEntity();
@Nullable
IIndividual getPollen();
void setPollen(IIndividual pollen);
void setPollen(@Nullable IIndividual pollen);
boolean canMateWith(IEntityButterfly butterfly);
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "1.3.0", owner = "ForestryAPI|core", provides = "ForestryAPI|lepidopterology")
package forestry.api.lepidopterology;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -5,11 +5,13 @@
******************************************************************************/
package forestry.api.mail;
import javax.annotation.Nullable;
import java.util.Locale;
public enum EnumAddressee {
PLAYER, TRADER;
@Nullable
public static EnumAddressee fromString(String ident) {
ident = ident.toLowerCase(Locale.ENGLISH);
for (EnumAddressee addr : values()) {
@@ -5,8 +5,6 @@
******************************************************************************/
package forestry.api.mail;
import javax.annotation.Nonnull;
import net.minecraft.util.text.translation.I18n;
public enum EnumTradeStationState implements IPostalState {
@@ -19,7 +17,7 @@ public enum EnumTradeStationState implements IPostalState {
private final String unlocalizedDescription;
EnumTradeStationState(@Nonnull String unlocalizedDescription) {
EnumTradeStationState(String unlocalizedDescription) {
this.unlocalizedDescription = unlocalizedDescription;
}
+8 -5
View File
@@ -5,16 +5,18 @@
******************************************************************************/
package forestry.api.mail;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import forestry.api.core.INbtWritable;
import net.minecraft.util.NonNullList;
public interface ILetter extends IInventory, INbtWritable {
ItemStack[] getPostage();
NonNullList<ItemStack> getPostage();
void setProcessed(boolean flag);
@@ -28,9 +30,10 @@ public interface ILetter extends IInventory, INbtWritable {
boolean hasRecipient();
void setRecipient(IMailAddress address);
void setRecipient(@Nullable IMailAddress address);
IMailAddress[] getRecipients();
@Nullable
IMailAddress getRecipient();
String getRecipientString();
@@ -46,11 +49,11 @@ public interface ILetter extends IInventory, INbtWritable {
void invalidatePostage();
ItemStack[] getAttachments();
NonNullList<ItemStack> getAttachments();
void addAttachment(ItemStack itemstack);
void addAttachments(ItemStack[] itemstacks);
void addAttachments(NonNullList<ItemStack> itemstacks);
int countAttachments();
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.mail;
import javax.annotation.Nullable;
import com.mojang.authlib.GameProfile;
import forestry.api.core.INbtWritable;
@@ -17,5 +19,6 @@ public interface IMailAddress extends INbtWritable {
boolean isValid();
@Nullable
GameProfile getPlayerProfile();
}
@@ -8,11 +8,12 @@ package forestry.api.mail;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
public interface IPostOffice {
void collectPostage(ItemStack[] stamps);
void collectPostage(NonNullList<ItemStack> stamps);
IPostalState lodgeLetter(World world, ItemStack itemstack, boolean doLodge);
@@ -5,30 +5,29 @@
******************************************************************************/
package forestry.api.mail;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Map;
import com.mojang.authlib.GameProfile;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
public interface IPostRegistry {
/* POST OFFICE */
IPostOffice getPostOffice(World world);
/* MAIL ADDRESSES */
@Nonnull
IMailAddress getMailAddress(@Nonnull GameProfile gameProfile);
IMailAddress getMailAddress(@Nonnull String traderName);
IMailAddress getMailAddress(GameProfile gameProfile);
IMailAddress getMailAddress(String traderName);
/* LETTERS */
boolean isLetter(ItemStack itemstack);
ILetter createLetter(IMailAddress sender, IMailAddress recipient);
@Nullable
ILetter getLetter(ItemStack itemstack);
ItemStack createLetterStack(ILetter letter);
@@ -37,10 +36,12 @@ public interface IPostRegistry {
/**
* Registers a new {@link IPostalCarrier}. See {@link IPostalCarrier} for details.
*
* @param carrier {@link IPostalCarrier} to register.
*/
void registerCarrier(IPostalCarrier carrier);
@Nullable
IPostalCarrier getCarrier(EnumAddressee uid);
Map<EnumAddressee, IPostalCarrier> getRegisteredCarriers();
@@ -50,6 +51,7 @@ public interface IPostRegistry {
ITradeStation getOrCreateTradeStation(World world, GameProfile owner, IMailAddress address);
@Nullable
ITradeStation getTradeStation(World world, IMailAddress address);
boolean isAvailableTradeAddress(World world, IMailAddress address);
@@ -8,6 +8,7 @@ package forestry.api.mail;
import net.minecraft.item.ItemStack;
import com.mojang.authlib.GameProfile;
import net.minecraft.util.NonNullList;
public interface ITradeStationInfo {
IMailAddress getAddress();
@@ -16,7 +17,7 @@ public interface ITradeStationInfo {
ItemStack getTradegood();
ItemStack[] getRequired();
NonNullList<ItemStack> getRequired();
EnumTradeStationState getState();
}
@@ -3,7 +3,12 @@
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "3.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|mail")
package forestry.api.mail;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
Loaded 100 of 1145 files, more files were not shown because too many files have changed in this diff. Show more