ic2 api update, fix recipes.

This commit is contained in:
fewizz committed 2015-12-06 20:46:22 +03:00
1 parent b5349fccbe
commit 0f669ce9fd
14 files changed
+52 -16

No files matched your search

Binary file not shown.
+17 -13
View File
@@ -37,13 +37,16 @@ public abstract class CropCard {
/**
* Determine the mod id owning this crop.
*
* It's recommended to hard code this to your mod id.
* The owner serves as a name space. With every mod using a different owner, a mod only has to
* make sure it doesn't have conflicts with name() in itself.
* It's recommended to hard code this to your mod id as specified in the @Mod annotation.
* Do not use IC2's mod id here.
*
* @note changing name or owner will cause existing crops in users' worlds to disappear.
*
* @return Mod id.
*/
public String owner() {
public String owner() { // TODO: make abstract
return modId;
}
@@ -100,7 +103,7 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return roots lengt use in isBlockBelow
*/
public int getrootslength(ICropTile crop) {
public int getrootslength(ICropTile crop) { // TODO: camel case
return 1;
}
@@ -126,7 +129,7 @@ public abstract class CropCard {
* @param n index of the requested stat
* @return The requested value of the stats
*/
public abstract int stat(int n);
public abstract int stat(int n); // TODO: change to fixed property object or builder with other attributes like tier
/**
* Additional attributes of the plant, also influencing breeding.
@@ -134,7 +137,7 @@ public abstract class CropCard {
*
* @return Attributes as an array of strings
*/
public abstract String[] attributes();
public abstract String[] attributes(); // TODO: default to none
/**
* Determine the max crop size.
@@ -212,7 +215,7 @@ public abstract class CropCard {
* @return 0-30
*/
public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) {
return (int) (humidity+nutrients+air);
return (int) (humidity + nutrients + air);
}
/**
@@ -247,7 +250,7 @@ public abstract class CropCard {
* @return need crop size for best output.
*/
public abstract int getOptimalHavestSize(ICropTile crop);
public abstract int getOptimalHavestSize(ICropTile crop); // TODO: default to maxSize
/**
* Check whether the crop can be harvested.
@@ -255,7 +258,7 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return Whether the crop can be harvested in its current state.
*/
public abstract boolean canBeHarvested(ICropTile crop);
public abstract boolean canBeHarvested(ICropTile crop); // TODO: default to maxSize check
/**
* Base chance for dropping the plant's gains, specify values greater than 1 for multiple drops.
@@ -282,20 +285,20 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return Plant size after harvesting
*/
public byte getSizeAfterHarvest(ICropTile crop) {return 1;}
public byte getSizeAfterHarvest(ICropTile crop) {return 1;} // TODO: change to int
/**
* Called when the plant is leftclicked by a player.
* Called when the plant is left clicked by a player.
* Default action is picking the plant.
*
* Only called Serverside.
* Only called server side.
*
* @param crop reference to ICropTile
* @param player player leftclicked the crop
* @param player player left clicked the crop
* @return Whether the plant has changed
*/
public boolean leftclick(ICropTile crop, EntityPlayer player) {
public boolean leftclick(ICropTile crop, EntityPlayer player) { // TODO: camel case
return crop.pick(true);
}
@@ -428,4 +431,5 @@ public abstract class CropCard {
protected IIcon textures[];
private final String modId; // TODO: make owner abstract, remove modId auto detection
// TODO: add a clean way to obtain world reference and position
}
Binary file not shown.
@@ -260,6 +260,15 @@ public interface ICropTile {
*/
public boolean isBlockBelow(Block block);
/**
* Check if a block is under the farmland containing the crop.
* Searches up to 2 blocks below the farmland or an air space, whichever appears first.
*
* @param oreDictionaryName blocks to search
* @return Whether the blocks were found
*/
public boolean isBlockBelow(String oreDictionaryName);
/**
* Generate plant seeds with the given parameters.
*
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7
View File
@@ -1,5 +1,6 @@
package ic2.api.info;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import cpw.mods.fml.common.Loader;
@@ -16,6 +17,12 @@ public class Info {
*/
public static DamageSource DMG_ELECTRIC, DMG_NUKE_EXPLOSION, DMG_RADIATION;
/**
* Potions used by IC2.
* Getting assigned in preload.
*/
public static Potion POTION_RADIATION;
public static boolean isIc2Available() {
if (ic2Available != null) return ic2Available;
+3 -1
View File
@@ -39,7 +39,9 @@ public interface IElectricItem {
/**
* Get the item's tier, lower tiers can't send energy to higher ones.
* Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3.
*
* Batteries are Tier 1, Advanced Batteries are Tier 2, Energy Crystals are Tier 3, Lapotron
* Crystals are Tier 4.
*
* @return Item's tier
*/
@@ -6,12 +6,26 @@ import net.minecraftforge.fluids.Fluid;
public interface ILiquidHeatExchangerManager extends ILiquidAcceptManager {
/**
* Add a new fluid heatup/cooldown recipe.
*
* @param fluidName the fluid to heat up/cool down
* @param fluidOutput the fluid the above fluid turns into
* @param huPerMB the Thermal Energy difference in hU for the conversion of one mB fluid
*/
void addFluid(String fluidName, String fluidOutput, int huPerMB);
HeatExchangeProperty getHeatExchangeProperty(Fluid fluid);
Map<String, HeatExchangeProperty> getHeatExchangeProperties();
/**
* This returns an ILiquidAcceptManager that only accepts fluids, that can be heated up / cooled down, but not both.
* You can basically use this to check if the liquid resulting from this conversion can be reprocessed into the first one.
* @return Returns the SingleDirectionManager.
*/
ILiquidAcceptManager getSingleDirectionLiquidManager();
public static class HeatExchangeProperty {
public HeatExchangeProperty(Fluid outputFluid, int huPerMB) {
this.outputFluid = outputFluid;