Test with stuff + Forestry potential support
This commit is contained in:
parent
5b05cf651b
commit
bd26e441cb
174 changed files with 5602 additions and 0 deletions
34
BM_src/forestry/api/core/BlockInterface.java
Normal file
34
BM_src/forestry/api/core/BlockInterface.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class BlockInterface {
|
||||
/**
|
||||
* Rather limited function to retrieve block ids.
|
||||
*
|
||||
* @param ident
|
||||
* @return ItemStack representing the block.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ItemStack getBlock(String ident) {
|
||||
ItemStack item = null;
|
||||
|
||||
try {
|
||||
String pack = ItemInterface.class.getPackage().getName();
|
||||
pack = pack.substring(0, pack.lastIndexOf('.'));
|
||||
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryBlock";
|
||||
Object obj = Class.forName(itemClass).getField(ident).get(null);
|
||||
if (obj instanceof Block)
|
||||
item = new ItemStack((Block) obj);
|
||||
else if (obj instanceof ItemStack)
|
||||
item = (ItemStack) obj;
|
||||
} catch (Exception ex) {
|
||||
FMLLog.warning("Could not retrieve Forestry block identified by: " + ident);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
72
BM_src/forestry/api/core/EnumHumidity.java
Normal file
72
BM_src/forestry/api/core/EnumHumidity.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
|
||||
*
|
||||
* This enum concerns humidity.
|
||||
*/
|
||||
public enum EnumHumidity {
|
||||
ARID("Arid"), NORMAL("Normal"), DAMP("Damp");
|
||||
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> aridBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> dampBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional normal biomes here.
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> getBiomeIds(EnumHumidity humidity) {
|
||||
switch (humidity) {
|
||||
case ARID:
|
||||
return aridBiomeIds;
|
||||
case DAMP:
|
||||
return dampBiomeIds;
|
||||
case NORMAL:
|
||||
default:
|
||||
return normalBiomeIds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the EnumHumidity given a floating point representation of Minecraft Rainfall
|
||||
* @param rawHumidity raw rainfall value
|
||||
* @return EnumHumidity corresponding to rainfall value
|
||||
*/
|
||||
public static EnumHumidity getFromValue(float rawHumidity) {
|
||||
EnumHumidity value = EnumHumidity.ARID;
|
||||
|
||||
if (rawHumidity >= 0.9f) {
|
||||
value = EnumHumidity.DAMP;
|
||||
}
|
||||
else if (rawHumidity >= 0.3f) {
|
||||
value = EnumHumidity.NORMAL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
142
BM_src/forestry/api/core/EnumTemperature.java
Normal file
142
BM_src/forestry/api/core/EnumTemperature.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
|
||||
*
|
||||
* This enum concerns temperature.
|
||||
*/
|
||||
public enum EnumTemperature {
|
||||
NONE("None", "habitats/ocean"), ICY("Icy", "habitats/snow"), COLD("Cold", "habitats/taiga"),
|
||||
NORMAL("Normal", "habitats/plains"), WARM("Warm", "habitats/jungle"), HOT("Hot", "habitats/desert"), HELLISH("Hellish", "habitats/nether");
|
||||
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional icy/snow biomes here. (ex. snow plains)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> icyBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> coldBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> warmBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> hotBiomeIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether)
|
||||
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> hellishBiomeIds = new ArrayList<Integer>();
|
||||
|
||||
public final String name;
|
||||
public final String iconIndex;
|
||||
|
||||
private EnumTemperature(String name, String iconIndex) {
|
||||
this.name = name;
|
||||
this.iconIndex = iconIndex;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon() {
|
||||
return ForestryAPI.textureManager.getDefault(iconIndex);
|
||||
}
|
||||
/**
|
||||
* @deprecated Switching most internals to use getFromValue to not rely on cached values.
|
||||
*/
|
||||
public static ArrayList<Integer> getBiomeIds(EnumTemperature temperature) {
|
||||
|
||||
switch (temperature) {
|
||||
case ICY:
|
||||
return icyBiomeIds;
|
||||
case COLD:
|
||||
return coldBiomeIds;
|
||||
case WARM:
|
||||
return warmBiomeIds;
|
||||
case HOT:
|
||||
return hotBiomeIds;
|
||||
case HELLISH:
|
||||
return hellishBiomeIds;
|
||||
case NORMAL:
|
||||
default:
|
||||
return normalBiomeIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given BiomeGenBase is of HELLISH temperature, since it is treated seperatly from actual temperature values.
|
||||
* Uses the BiomeDictionary.
|
||||
* @param biomeGen BiomeGenBase of the biome in question
|
||||
* @return true, if the BiomeGenBase is a Nether-type biome; false otherwise.
|
||||
*/
|
||||
public static boolean isBiomeHellish(BiomeGenBase biomeGen) {
|
||||
return BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given biomeID is of HELLISH temperature, since it is treated seperatly from actual temperature values.
|
||||
* Uses the BiomeDictionary.
|
||||
* @param biomeID ID of the BiomeGenBase in question
|
||||
* @return true, if the biomeID is a Nether-type biome; false otherwise.
|
||||
*/
|
||||
public static boolean isBiomeHellish(int biomeID) {
|
||||
return BiomeDictionary.isBiomeRegistered(biomeID) && BiomeDictionary.isBiomeOfType(BiomeGenBase.biomeList[biomeID], BiomeDictionary.Type.NETHER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the EnumTemperature given a floating point representation of
|
||||
* Minecraft temperature. Hellish biomes are handled based on their biome
|
||||
* type - check isBiomeHellish.
|
||||
* @param rawTemp raw temperature value
|
||||
* @return EnumTemperature corresponding to value of rawTemp
|
||||
*/
|
||||
public static EnumTemperature getFromValue(float rawTemp) {
|
||||
EnumTemperature value = EnumTemperature.ICY;
|
||||
|
||||
if (rawTemp >= 2.0f) {
|
||||
value = EnumTemperature.HOT;
|
||||
}
|
||||
else if (rawTemp >= 1.2f) {
|
||||
value = EnumTemperature.WARM;
|
||||
}
|
||||
else if (rawTemp >= 0.2f) {
|
||||
value = EnumTemperature.NORMAL;
|
||||
}
|
||||
else if (rawTemp >= 0.05f) {
|
||||
value = EnumTemperature.COLD;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
47
BM_src/forestry/api/core/ForestryAPI.java
Normal file
47
BM_src/forestry/api/core/ForestryAPI.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
*
|
||||
* If you need to distribute API files, try to only include the parts you are actually
|
||||
* using to minimize conflicts due to API changes.
|
||||
*
|
||||
* .core - Miscallenous base classes and interfaces as well as some basics for tools, armor, game modes and stuff needed by biome mods.
|
||||
* .fuels - Managers and classes to facilitate adding fuels to various engines and machines.
|
||||
* .recipes - Managers and helpers to facilitate adding new recipes to various machines.
|
||||
* .storage - Managers, events and interfaces for defining new backpacks and handling backpack behaviour.
|
||||
* .mail - Anything related to handling letters and adding new mail carrier systems.
|
||||
* .genetics - Shared code for all genetic subclasses.
|
||||
* \ .apiculture - Bees.
|
||||
* \ .arboriculture - Trees.
|
||||
* \ .lepidopterology - Butterflies.
|
||||
*
|
||||
* Note that if Forestry is not present, all these references will be null.
|
||||
*/
|
||||
public class ForestryAPI {
|
||||
|
||||
/**
|
||||
* The main mod instance for Forestry.
|
||||
*/
|
||||
public static Object instance;
|
||||
|
||||
/**
|
||||
* A {@link ITextureManager} needed for some things in the API.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static ITextureManager textureManager;
|
||||
|
||||
/**
|
||||
* The currently active {@link IGameMode}.
|
||||
*/
|
||||
public static IGameMode activeMode;
|
||||
|
||||
/**
|
||||
* Provides information on certain Forestry constants (Villager IDs, Chest gen keys, etc)
|
||||
*/
|
||||
public static IForestryConstants forestryConstants;
|
||||
|
||||
}
|
51
BM_src/forestry/api/core/ForestryEvent.java
Normal file
51
BM_src/forestry/api/core/ForestryEvent.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Event;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public abstract class ForestryEvent extends Event {
|
||||
|
||||
private static abstract class BreedingEvent extends ForestryEvent {
|
||||
public final ISpeciesRoot root;
|
||||
public final IBreedingTracker tracker;
|
||||
public final String username;
|
||||
|
||||
private BreedingEvent(ISpeciesRoot root, String username, IBreedingTracker tracker) {
|
||||
super();
|
||||
this.root = root;
|
||||
this.username = username;
|
||||
this.tracker = tracker;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpeciesDiscovered extends BreedingEvent {
|
||||
public final IAlleleSpecies species;
|
||||
public SpeciesDiscovered(ISpeciesRoot root, String username, IAlleleSpecies species, IBreedingTracker tracker) {
|
||||
super(root, username, tracker);
|
||||
this.species = species;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MutationDiscovered extends BreedingEvent {
|
||||
public final IMutation allele;
|
||||
public MutationDiscovered(ISpeciesRoot root, String username, IMutation allele, IBreedingTracker tracker) {
|
||||
super(root, username, tracker);
|
||||
this.allele = allele;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SyncedBreedingTracker extends ForestryEvent {
|
||||
public final IBreedingTracker tracker;
|
||||
public final EntityPlayer player;
|
||||
public SyncedBreedingTracker(IBreedingTracker tracker, EntityPlayer player) {
|
||||
super();
|
||||
this.tracker = tracker;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
35
BM_src/forestry/api/core/GlobalManager.java
Normal file
35
BM_src/forestry/api/core/GlobalManager.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Used mostly by hives to determine whether they can spawn at a certain
|
||||
* position. Rather limited and hackish.
|
||||
* @depreciated there are better ways now
|
||||
*/
|
||||
@Deprecated
|
||||
public class GlobalManager {
|
||||
|
||||
/**
|
||||
* @deprecated use Block.isGenMineableReplaceable(), anything that accepts
|
||||
* dirt will be accepted
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> dirtBlockIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* @deprecated use Block.isGenMineableReplaceable(), anything that accepts
|
||||
* sand will be accepted
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> sandBlockIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* @deprecated why is this needed?
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> snowBlockIds = new ArrayList<Integer>();
|
||||
/**
|
||||
* @deprecated Ensure your block's isLeaves function returns true instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<Integer> leafBlockIds = new ArrayList<Integer>();
|
||||
}
|
20
BM_src/forestry/api/core/IArmorNaturalist.java
Normal file
20
BM_src/forestry/api/core/IArmorNaturalist.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IArmorNaturalist {
|
||||
|
||||
/**
|
||||
* Called when the naturalist's armor acts as spectacles for seeing pollinated tree leaves/flowers.
|
||||
*
|
||||
* @param player
|
||||
* Player doing the viewing
|
||||
* @param armor
|
||||
* Armor item
|
||||
* @param doSee
|
||||
* Whether or not to actually do the side effects of viewing
|
||||
* @return true if the armor actually allows the player to see pollination.
|
||||
*/
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
|
||||
}
|
19
BM_src/forestry/api/core/IForestryConstants.java
Normal file
19
BM_src/forestry/api/core/IForestryConstants.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package forestry.api.core;
|
||||
|
||||
public interface IForestryConstants {
|
||||
|
||||
/**
|
||||
* @return The villager ID for the Apiarist Villager.
|
||||
*/
|
||||
public int getApicultureVillagerID();
|
||||
|
||||
/**
|
||||
* @return The villager ID for the Arborist Villager.
|
||||
*/
|
||||
public int getArboricultureVillagerID();
|
||||
|
||||
/**
|
||||
* @return The ChestGenHooks key for adding items to the Forestry Villager chest.
|
||||
*/
|
||||
public String getVillagerChestGenKey();
|
||||
}
|
36
BM_src/forestry/api/core/IGameMode.java
Normal file
36
BM_src/forestry/api/core/IGameMode.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IGameMode {
|
||||
|
||||
/**
|
||||
* @return Human-readable identifier for the game mode. (i.e. 'EASY', 'NORMAL', 'HARD')
|
||||
*/
|
||||
String getIdentifier();
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, false if unknown setting.
|
||||
*/
|
||||
boolean getBooleanSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, 0 if unknown setting.
|
||||
*/
|
||||
int getIntegerSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, 0 if unknown setting.
|
||||
*/
|
||||
float getFloatSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, an itemstack containing an apple if unknown setting.
|
||||
*/
|
||||
ItemStack getStackSetting(String ident);
|
||||
|
||||
}
|
19
BM_src/forestry/api/core/IIconProvider.java
Normal file
19
BM_src/forestry/api/core/IIconProvider.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Provides icons, needed in some interfaces, most notably for bees and trees.
|
||||
*/
|
||||
public interface IIconProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Icon getIcon(short texUID);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IconRegister register);
|
||||
|
||||
}
|
9
BM_src/forestry/api/core/INBTTagable.java
Normal file
9
BM_src/forestry/api/core/INBTTagable.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface INBTTagable {
|
||||
void readFromNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
}
|
32
BM_src/forestry/api/core/IPlugin.java
Normal file
32
BM_src/forestry/api/core/IPlugin.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* Optional way to hook into Forestry.
|
||||
*
|
||||
* Plugin classes can reside in any package, their class name however has to start with 'Plugin', i.e. 'PluginMyStuff'.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IPlugin {
|
||||
|
||||
/**
|
||||
* @return true if the plugin is to be loaded.
|
||||
*/
|
||||
public boolean isAvailable();
|
||||
|
||||
/**
|
||||
* Called during Forestry's @PreInit.
|
||||
*/
|
||||
public void preInit();
|
||||
|
||||
/**
|
||||
* Called at the start of Forestry's @PostInit.
|
||||
*/
|
||||
public void doInit();
|
||||
|
||||
/**
|
||||
* Called at the end of Forestry's @PostInit.
|
||||
*/
|
||||
public void postInit();
|
||||
|
||||
}
|
15
BM_src/forestry/api/core/IStructureLogic.java
Normal file
15
BM_src/forestry/api/core/IStructureLogic.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package forestry.api.core;
|
||||
|
||||
public interface IStructureLogic extends INBTTagable {
|
||||
|
||||
/**
|
||||
* @return String unique to the type of structure controlled by this structure logic.
|
||||
*/
|
||||
String getTypeUID();
|
||||
|
||||
/**
|
||||
* Called by {@link ITileStructure}'s validateStructure().
|
||||
*/
|
||||
void validateStructure();
|
||||
|
||||
}
|
15
BM_src/forestry/api/core/ITextureManager.java
Normal file
15
BM_src/forestry/api/core/ITextureManager.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface ITextureManager {
|
||||
|
||||
void registerIconProvider(IIconProvider provider);
|
||||
|
||||
Icon getIcon(short texUID);
|
||||
|
||||
Icon getDefault(String ident);
|
||||
}
|
58
BM_src/forestry/api/core/ITileStructure.java
Normal file
58
BM_src/forestry/api/core/ITileStructure.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* The basis for multiblock components.
|
||||
*/
|
||||
public interface ITileStructure {
|
||||
|
||||
/**
|
||||
* @return String unique to the type of structure controlled by this structure logic. Should map to {@link IStructureLogic}
|
||||
*/
|
||||
String getTypeUID();
|
||||
|
||||
/**
|
||||
* Should map to {@link IStructureLogic}
|
||||
*/
|
||||
void validateStructure();
|
||||
|
||||
/**
|
||||
* Called when the structure resets.
|
||||
*/
|
||||
void onStructureReset();
|
||||
|
||||
/**
|
||||
* @return TileEntity that is the master in this structure, null if no structure exists.
|
||||
*/
|
||||
ITileStructure getCentralTE();
|
||||
|
||||
/**
|
||||
* Called to set the master TileEntity. Implementing TileEntity should keep track of the master's coordinates, not refer to the TE object itself.
|
||||
*
|
||||
* @param tile
|
||||
*/
|
||||
void setCentralTE(TileEntity tile);
|
||||
|
||||
/**
|
||||
* @return IInventory representing the TE's inventory.
|
||||
*/
|
||||
IInventory getInventory();
|
||||
|
||||
/**
|
||||
* Only called on Forestry's own blocks.
|
||||
*/
|
||||
void makeMaster();
|
||||
|
||||
/**
|
||||
* @return true if this TE is the master in a structure, false otherwise.
|
||||
*/
|
||||
boolean isMaster();
|
||||
|
||||
/**
|
||||
* @return true if the TE is master or has a master.
|
||||
*/
|
||||
boolean isIntegratedIntoStructure();
|
||||
|
||||
}
|
8
BM_src/forestry/api/core/IToolScoop.java
Normal file
8
BM_src/forestry/api/core/IToolScoop.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* Marks a tool as a scoop.
|
||||
*/
|
||||
public interface IToolScoop {
|
||||
|
||||
}
|
42
BM_src/forestry/api/core/ItemInterface.java
Normal file
42
BM_src/forestry/api/core/ItemInterface.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* This is going away someday, use FML's GameRegistry instead.
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class ItemInterface {
|
||||
|
||||
/**
|
||||
* Get items here!
|
||||
*
|
||||
* Blocks currently not supported.
|
||||
*
|
||||
* @param ident
|
||||
* @return ItemStack representing the item, null if not found.
|
||||
*/
|
||||
public static ItemStack getItem(String ident) {
|
||||
ItemStack item = null;
|
||||
|
||||
try {
|
||||
String pack = ItemInterface.class.getPackage().getName();
|
||||
pack = pack.substring(0, pack.lastIndexOf('.'));
|
||||
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryItem";
|
||||
Object[] enums = Class.forName(itemClass).getEnumConstants();
|
||||
for (Object e : enums) {
|
||||
if (e.toString().equals(ident)) {
|
||||
Method m = e.getClass().getMethod("getItemStack");
|
||||
return (ItemStack) m.invoke(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
FMLLog.warning("Could not retrieve Forestry item identified by: " + ident);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
49
BM_src/forestry/api/core/PluginInfo.java
Normal file
49
BM_src/forestry/api/core/PluginInfo.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PluginInfo {
|
||||
|
||||
/**
|
||||
* @return Unique identifier for the plugin, no spaces!
|
||||
*/
|
||||
String pluginID();
|
||||
|
||||
/**
|
||||
* @return Nice and readable plugin name.
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* @return Plugin author's name.
|
||||
*/
|
||||
String author() default "";
|
||||
|
||||
/**
|
||||
* @return URL of plugin homepage.
|
||||
*/
|
||||
String url() default "";
|
||||
|
||||
/**
|
||||
* @return Version of the plugin, if any.
|
||||
*/
|
||||
String version() default "";
|
||||
|
||||
/**
|
||||
* @return Short description what the plugin does.
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
/**
|
||||
* @return Not used (yet?).
|
||||
*/
|
||||
String help() default "";
|
||||
|
||||
}
|
14
BM_src/forestry/api/core/Tabs.java
Normal file
14
BM_src/forestry/api/core/Tabs.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
||||
/**
|
||||
* References to the specialised tabs added by Forestry to creative inventory.
|
||||
*/
|
||||
public class Tabs {
|
||||
|
||||
public static CreativeTabs tabApiculture;
|
||||
public static CreativeTabs tabArboriculture;
|
||||
public static CreativeTabs tabLepidopterology;
|
||||
|
||||
}
|
3
BM_src/forestry/api/core/package-info.java
Normal file
3
BM_src/forestry/api/core/package-info.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
@API(apiVersion="1.0", owner="Forestry", provides="ForestryAPI|core")
|
||||
package forestry.api.core;
|
||||
import cpw.mods.fml.common.API;
|
Loading…
Add table
Add a link
Reference in a new issue