maven based systems wont package api's storedd in this manner

This commit is contained in:
Progwml6 committed 2013-11-22 05:42:24 -05:00
1 parent 0e7c20308d
commit ac77676a85
53 files changed

No files matched your search

@@ -0,0 +1,52 @@
package cofh.api.energy;
import net.minecraft.item.ItemStack;
/**
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
*
* A reference implementation is provided {@link ItemEnergyContainer}.
*
* @author King Lemming
*
*/
public interface IEnergyContainerItem
{
/**
* Adds energy to an item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
*
* @param container
* ItemStack to be charged.
* @param maxReceive
* Maximum amount of energy to be sent into the item.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received by the item.
*/
int receiveEnergy (ItemStack container, int maxReceive, boolean simulate);
/**
* Removes energy from an item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally discharged.
*
* @param container
* ItemStack to be discharged.
* @param maxExtract
* Maximum amount of energy to be extracted from the item.
* @param simulate
* If TRUE, the discharge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
*/
int extractEnergy (ItemStack container, int maxExtract, boolean simulate);
/**
* Get the amount of energy currently stored in the item.
*/
int getEnergyStored (ItemStack container);
/**
* Get the max amount of energy that can be stored in the item.
*/
int getMaxEnergyStored (ItemStack container);
}
+14
View File
@@ -0,0 +1,14 @@
package ic2.api.item;
import net.minecraft.item.ItemStack;
public interface IBoxable
{
/**
* Determine whether an item can be stored in a toolbox or not.
*
* @param itemstack item to be stored
* @return Whether to store the item in the toolbox or not
*/
public abstract boolean canBeStoredInToolbox (ItemStack itemstack);
}
@@ -0,0 +1,68 @@
package ic2.api.item;
import net.minecraft.item.ItemStack;
/**
* Provides the ability to store energy on the implementing item.
*
* This interface is a special version of IElectricItem which delegates the implementation of
* charge(), discharge() and canUse() to the implementing Item.
*
* The default implementation (when not using ICustomElectricItem) does the following:
* - store and retrieve the charge
* - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account
* - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId())
* - update and manage the damage value for the visual charge indicator
*
* @note ICustomElectricItem must not call the ElectricItem methods charge, discharge or canUse
*
* @deprecated Use ISpecialElectricItem instead.
*/
@Deprecated
public interface ICustomElectricItem extends IElectricItem
{
/**
* Charge an item with a specified amount of energy
*
* @param itemStack electric item's stack
* @param amount amount of energy to charge in EU
* @param tier tier of the charging device, has to be at least as high as the item to charge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
* @param simulate don't actually change the item, just determine the return value
* @return Energy transferred into the electric item
*/
public int charge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate);
/**
* Discharge an item by a specified amount of energy
*
* @param itemStack electric item's stack
* @param amount amount of energy to charge in EU
* @param tier tier of the discharging device, has to be at least as high as the item to discharge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
* @param simulate don't actually discharge the item, just determine the return value
* @return Energy retrieved from the electric item
*/
public int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate);
/**
* Determine if the specified electric item has at least a specific amount of EU.
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
* BatPacks are not taken into account.
*
* @param itemStack electric item's stack
* @param amount minimum amount of energy required
* @return true if there's enough energy
*/
public boolean canUse (ItemStack itemStack, int amount);
/**
* Determine whether to show the charge tool tip with NEI or other means.
*
* Return false if IC2's handler is incompatible, you want to implement your own or you don't
* want to display the charge at all.
*
* @return true to show the tool tip (x/y EU)
*/
public boolean canShowChargeToolTip (ItemStack itemStack);
}
@@ -0,0 +1,54 @@
package ic2.api.item;
import net.minecraft.item.ItemStack;
/**
* Provides the ability to store energy on the implementing item.
*
* The item should have a maximum damage of 13.
*/
public interface IElectricItem
{
/**
* Determine if the item can be used in a machine or as an armor part to supply energy.
*
* @return Whether the item can supply energy
*/
boolean canProvideEnergy (ItemStack itemStack);
/**
* Get the item ID to use for a charge energy greater than 0.
*
* @return Item ID to use
*/
int getChargedItemId (ItemStack itemStack);
/**
* Get the item ID to use for a charge energy of 0.
*
* @return Item ID to use
*/
int getEmptyItemId (ItemStack itemStack);
/**
* Get the item's maximum charge energy in EU.
*
* @return Maximum charge energy
*/
int getMaxCharge (ItemStack itemStack);
/**
* 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.
*
* @return Item's tier
*/
int getTier (ItemStack itemStack);
/**
* Get the item's transfer limit in EU per transfer operation.
*
* @return Transfer limit
*/
int getTransferLimit (ItemStack itemStack);
}
@@ -0,0 +1,93 @@
package ic2.api.item;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
* This interface specifies a manager to handle the various tasks for electric items.
*
* The default implementation does the following:
* - store and retrieve the charge
* - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account
* - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId())
* - update and manage the damage value for the visual charge indicator
*
* @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the
* default implementations through ElectricItem.rawManager. The default implementation is designed
* to minimize its dependency on its own constraints/structure and delegates most work back to the
* more atomic features in the gateway manager.
*/
public interface IElectricItemManager
{
/**
* Charge an item with a specified amount of energy
*
* @param itemStack electric item's stack
* @param amount amount of energy to charge in EU
* @param tier tier of the charging device, has to be at least as high as the item to charge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
* @param simulate don't actually change the item, just determine the return value
* @return Energy transferred into the electric item
*/
int charge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate);
/**
* Discharge an item by a specified amount of energy
*
* @param itemStack electric item's stack
* @param amount amount of energy to charge in EU
* @param tier tier of the discharging device, has to be at least as high as the item to discharge
* @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit()
* @param simulate don't actually discharge the item, just determine the return value
* @return Energy retrieved from the electric item
*/
int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate);
/**
* Determine the charge level for the specified item
*
* @param itemStack ItemStack containing the electric item
* @return charge level in EU
*/
int getCharge (ItemStack itemStack);
/**
* Determine if the specified electric item has at least a specific amount of EU.
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
* BatPacks are not taken into account.
*
* @param itemStack electric item's stack
* @param amount minimum amount of energy required
* @return true if there's enough energy
*/
boolean canUse (ItemStack itemStack, int amount);
/**
* Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack.
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
*
* @param itemStack electric item's stack
* @param amount amount of energy to discharge in EU
* @param entity entity holding the item
* @return true if the operation succeeded
*/
boolean use (ItemStack itemStack, int amount, EntityLivingBase entity);
/**
* Charge an item from the BatPack a player is wearing.
* This is supposed to be used in the item code during operation, for example if you want to implement your own electric item.
* use() already contains this functionality.
*
* @param itemStack electric item's stack
* @param entity entity holding the item
*/
void chargeFromArmor (ItemStack itemStack, EntityLivingBase entity);
/**
* Get the tool tip to display for electric items.
*
* @param itemStack ItemStack to determine the tooltip for
* @return tool tip string or null for none
*/
String getToolTip (ItemStack itemStack);
}
@@ -0,0 +1,14 @@
package ic2.api.item;
import net.minecraft.item.ItemStack;
public interface ISpecialElectricItem extends IElectricItem
{
/**
* Supply a custom IElectricItemManager.
*
* @param itemStack ItemStack to get the manager for
* @return IElectricItemManager instance
*/
IElectricItemManager getManager (ItemStack itemStack);
}
+609
View File
@@ -0,0 +1,609 @@
package ic2.api.item;
import net.minecraft.item.ItemStack;
/**
* Provides access to IC2 blocks and items.
*
* Some items can be acquired through the ore dictionary which is the recommended way.
* The items are initialized while IC2 is being loaded - try to use ModsLoaded() or load your mod after IC2.
* Some blocks/items can be disabled by a config setting, so it's recommended to check if they're null first.
*
* Getting the associated Block/Item for an ItemStack x:
* Blocks: Block.blocksList[x.itemID]
* Items: x.getItem()
*/
public final class Items
{
/**
* Get an ItemStack for a specific item name, example: Items.getItem("resin")
* See the list below for item names.
* Make sure to copy() the ItemStack if you want to modify it.
*
* @param name item name
* @return The item or null if the item does not exist or an error occurred
*/
public static ItemStack getItem (String name)
{
try
{
if (Ic2Items == null)
Ic2Items = Class.forName(getPackage() + ".core.Ic2Items");
Object ret = Ic2Items.getField(name).get(null);
if (ret instanceof ItemStack)
{
return (ItemStack) ret;
}
else
{
return null;
}
}
catch (Exception e)
{
System.out.println("IC2 API: Call getItem failed for " + name);
return null;
}
}
/* Possible values:
// ores
copperOre; // Copper Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreCopper, null with enableWorldGenOreCopper=false
tinOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreTin, null with enableWorldGenOreTin=false
uraniumOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreUranium, null with enableWorldGenOreUranium=false
leadOre; // Lead Ore Block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreLead, null with enableWorldGenOreLead=false
// rubber related
Rubber wood block, meta reflects the state, meta in ItemStack set to 0, ore dictionary: woodRubber (with meta 0), null with enableWorldGenTreeRubber=false
dropped (as an item) -> metadata 0
block, no resin spot -> metadata 0 or 1
block, wet resin spot -> metadata 2-5 (according to the side)
block, dry resin spot -> metadata 8-11 (wet state + 6)
rubberWood;
rubberLeaves; // Rubber Leaves block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false
rubberSapling; // Rubber Sapling block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false
resinSheet; // Resin Sheet block, currently not meta sensitive
rubberTrampoline; // Rubber Trampoline block, meta reflects internal state, meta in ItemStack set to 0
// building/storage
ironFence; // Iron Fence block, currently not meta sensitive
reinforcedStone; // Reinforced Stone block, currently not meta sensitive
reinforcedGlass; // Reinforced Glass block, currently not meta sensitive
reinforcedDoorBlock; // Reinforced Door block, meta reflects the state (see vanilla doors), meta in ItemStack set to 0
constructionreinforcedFoam; // Construction Reinforced Foam block, currently not meta sensitive
constructionFoam; // Construction Foam block, currently not meta sensitive
constructionFoamWall; // Construction Foam Wall block, meta = color, implements IPaintableBlock
scaffold; // Scaffold block, meta reflects internal physical model data
ironScaffold; // Scaffold block, meta reflects internal physical model data
bronzeBlock; // Bronze block, meta sensitive
copperBlock; // Copper block, meta sensitive
tinBlock; // Tin block, meta sensitive
uraniumBlock; // Uranium block, meta sensitive
leadBlock; // Uranium block, meta sensitive
// cables (when placed as a block, inventory items are different; TE implements IEnergyConductor)
copperCableBlock; // Copper Cable block, meta sensitive
insulatedCopperCableBlock; // Insulated Copper Cable block, meta sensitive
goldCableBlock; // Gold Cable block, meta sensitive
insulatedGoldCableBlock; // Insulated Gold Cable block, meta sensitive
doubleInsulatedGoldCableBlock; // Double Insulated Gold Cable block, meta sensitive
ironCableBlock; // Iron Cable block, meta sensitive
insulatedIronCableBlock; // Insulated Iron Cable block, meta sensitive
doubleInsulatedIronCableBlock; // Double Insulated Iron Cable block, meta sensitive
trippleInsulatedIronCableBlock; // Tripple Insulated Iron Cable block, meta sensitive
glassFiberCableBlock; // Glass Fiber Cable block, meta sensitive
tinCableBlock; // Tin Cable block, meta sensitive
insulatedtinCableBlock; // Insulated Tin Cable item, meta sensitive
detectorCableBlock; // Detector Cable block, meta sensitive
splitterCableBlock; // Splitter Cable block, meta sensitive
// generators + related (TE implements IEnergySource ex. reactorChamber)
generator; // Generator block, meta sensitive
geothermalGenerator; // Geothermal Generator block, meta sensitive
waterMill; // Water Mill block, meta sensitive
solarPanel; // Solar Panel block, meta sensitive
windMill; // Wind Mill block, meta sensitive
nuclearReactor; // Nuclear Reactor block, meta sensitive
reactorChamber; // Reactor Chamber block, currently not meta sensitive
RTGenerator; // Radioisotope Thermoelectric Generator block, meta sensitive
semifluidGenerator; // Semifluid Generator block, meta sensitive
// energy storages (TE implements IEnergySource and IEnergyConductor)
batBox; // BatBox block, meta sensitive
cesuUnit; // CESU Unit block, meta sensitive
mfeUnit; // MFE Unit block, meta sensitive
mfsUnit; // MFS Unit block, meta sensitive
// transformers (TE implements IEnergySource and IEnergyConductor)
lvTransformer; // LV Transformer block, meta sensitive
mvTransformer; // MV Transformer block, meta sensitive
hvTransformer; // HV Transformer block, meta sensitive
evTransformer; // EV Transformer block, meta sensitive
// machines + related (TE implements IEnergySink ex. machine, miningPipe, miningPipeTip)
machine; // Machine block, meta sensitive
advancedMachine; // Advanced Machine block, meta sensitive
ironFurnace; // Iron Furnace block, meta sensitive
electroFurnace; // Electro Furnace block, meta sensitive
macerator; // Macerator block, meta sensitive
extractor; // Extractor block, meta sensitive
compressor; // Compressor block, meta sensitive
canner; // Canner block, meta sensitive
miner; // Miner block, meta sensitive
pump; // Pump block, meta sensitive
magnetizer; // Magnetizer block, meta sensitive
electrolyzer; // Electrolyzer block, meta sensitive
recycler; // Recycler block, meta sensitive
inductionFurnace; // Induction Furnace block, meta sensitive
massFabricator; // Mass Fabricator block, meta sensitive
terraformer; // Terraformer block, meta sensitive
teleporter; // Teleporter block, meta sensitive
teslaCoil; // Tesla Coil block, meta sensitive
luminator; // Passive (dark) Luminator block, meta = facing
activeLuminator; // Active (bright) Luminator block, meta = facing
centrifuge; // Centrifuge block, meta sensitive
metalformer; // MetalFormer block ,meta sensitive
orewashingplant; // Ore Wasching Plant,Meta sensitive
patternstorage; // Pattern Storage,Meta sensitive
scanner; // Scanner,Meta sensitive
replicator; // Replicator,Meta sensitive
miningPipe; // Mining Pipe block, currently not meta sensitive, meta in ItemStack set to 0
miningPipeTip; // Mining Pipe Tip block, currently not meta sensitive, meta in ItemStack set to 0
// personal blocks
personalSafe; // Personal Safe block, meta sensitive
tradeOMat; // Trade-O-Mat block, meta sensitive
energyOMat; // Energy-O-Mat block, meta sensitive
// explosives
industrialTnt; // Industrial TNT block, currently not meta sensitive
nuke; // Nuke block, currently not meta sensitive
dynamiteStick; // Dynamite Stick block, meta = placement, meta in ItemStack set to 0
dynamiteStickWithRemote; // Dynamite Stick with Remote block, meta = placement, meta in ItemStack set to 0
// Agriculture Stuff
crop; // Crop Block, empty, not meta sensitive
cropmatron; // Cropmatron machien block, meta sensititve
// ----- items -----
// rubber + related
resin; // Resin item, currently not meta sensitive
rubber; // Rubber item, currently not meta sensitive, ore dictionary: itemRubber
FluidCell;
// Lithium -> Tritium
reactorLithiumCell; // LithiumCell use in Reaktor, , meta = damage value
TritiumCell; // Tritium, currently not meta sensitive
// Nuclear Fuel
UranFuel; // , currently not meta sensitive
MOXFuel; // , currently not meta sensitive
Plutonium; // , currently not meta sensitive
smallPlutonium; // , currently not meta sensitive
Uran235; // , currently not meta sensitive
smallUran235; // , currently not meta sensitive
Uran238; // , currently not meta sensitive
reactorDepletedUraniumSimple; // Depleted Uranium Cell items, currently not meta sensitive
reactorDepletedUraniumDual;
reactorDepletedUraniumQuad;
reactorDepletedMOXSimple; // Depleted MOX Cell items, currently not meta sensitive
reactorDepletedMOXDual;
reactorDepletedMOXQuad;
reactorMOXSimple; // Depleted MOX Cell items, currently not meta sensitive
reactorMOXDual;
reactorMOXQuad;
RTGPellets;
// Recipe Parts
coil; // Coil, meta sensitive
elemotor; // electric motor, meta sensitive
powerunit; // Item Power Unit, meta sensitive
powerunitsmall; // Item Power Unit, meta sensitive
// ItemCasing
casingcopper; // Copper ItemCasing, meta sensitive
casingtin; // Tin ItemCasing, meta sensitive
casingbronze; // Bronze ItemCasing, meta sensitive
casinggold; // Gold ItemCasing, meta sensitive
casingiron; // Iron ItemCasing, meta sensitive
@Deprecated
casingadviron; // Refined Iron ItemCasing, meta sensitive
casinglead; // Lead ItemCasing, meta sensitive
// Crushed Ore
crushedIronOre; // Crushed Iron Ore, meta sensitive
crushedCopperOre; // Crushed Copper Ore, meta sensitive
crushedGoldOre; // Crushed Gold Ore, meta sensitive
crushedTinOre; // Crushed Tin Ore, meta sensitive
crushedUraniumOre; // Crushed Uranium Ore, meta sensitive
crushedSilverOre; // Crushed Silver Ore, meta sensitive
crushedLeadOre; // Crushed Lead Ore, meta sensitive
//Purify Crushed Ore
purifiedCrushedIronOre; // Purify Crushed Iron Ore, meta sensitive
purifiedCrushedCopperOre; // Purify Crushed Copper Ore, meta sensitive
purifiedCrushedGoldOre; // Purify Crushed Gold Ore, meta sensitive
purifiedCrushedTinOre; // Purify Crushed Tin Ore, meta sensitive
purifiedCrushedUraniumOre; // Purify Crushed Uranium Ore, meta sensitive
purifiedCrushedSilverOre; // Purify Crushed Silver Ore, meta sensitive
purifiedCrushedLeadOre; // Purify Crushed Lead Ore, meta sensitive
// dusts
stoneDust;
bronzeDust; // Bronze Dust item, meta sensitive, ore dictionary: dustBronze
clayDust; // Clay Dust item, meta sensitive, ore dictionary: dustClay
coalDust; // Coal Dust item, meta sensitive, ore dictionary: dustCoal
copperDust; // Copper Dust item, meta sensitive, ore dictionary: dustCopper
goldDust; // Gold Dust item, meta sensitive, ore dictionary: dustGold
ironDust; // Iron Dust item, meta sensitive, ore dictionary: dustIron
silverDust; // Silver Dust item, meta sensitive, ore dictionary: dustSilver
tinDust; // Tin Dust item, meta sensitive, ore dictionary: dustTin
hydratedCoalDust; // Hydrated Coal Dust item, meta sensitive
leadDust; // Lead Dust item, meta sensitive, ore dictionary: dustLead
obsidianDust; // Obsidian Dust item, meta sensitive, ore dictionary: dustObsidian
lapiDust; // Lapi Dust item, meta sensitive, ore dictionary: dustLapi
sulfurDust; // Sulfur Dust item, meta sensitive, ore dictionary: dustSulfur
lithiumDust; // Lithium dust, meta sensitive, ore dictionary: dustLithium
// small dusts
smallIronDust; // Small Iron Dust item, meta sensitive
smallCopperDust; // Small Copper Dust item, meta sensitive
smallGoldDust; // Small Gold Dust item, meta sensitive
smallTinDust; // Small Tin Dust item, meta sensitive
smallSilverDust; // Small Silver Dust item, meta sensitive
smallLeadDust; // Small Lead Dust item, meta sensitive
smallSulfurDust; // Small Sulfur Dust item, meta sensitive
smallLithiumDust; // Small Lithium Dust item, meta sensitive
// ingots
@Deprecated
refinedIronIngot; // Refined Iron Ingot item, currently not meta sensitive, ore dictionary: ingotRefinedIron
copperIngot; // Copper Ingot item, currently not meta sensitive, ore dictionary: ingotCopper
tinIngot; // Tin Ingot item, currently not meta sensitive, ore dictionary: ingotTin
bronzeIngot; // Bronze Ingot item, currently not meta sensitive, ore dictionary: ingotBronze
mixedMetalIngot; // Mixed Metal Ingot item, currently not meta sensitive
leadIngot; // Lead Ingot item, currently not meta sensitive
// tools/weapons (without electric tools)
treetap; // Treetap item, meta = damage value
wrench; // Wrench item, meta = damage value
cutter; // Insulation Cutter item, meta = damage value
constructionFoamSprayer; // Construction Foam Sprayer item, meta = charges (as of v1.45)
bronzePickaxe; // Bronze Pickaxe item, meta = damage value
bronzeAxe; // Bronze Axe item, meta = damage value
bronzeSword; // Bronze Sword item, meta = damage value
bronzeShovel; // Bronze Shovel item, meta = damage value
bronzeHoe; // Bronze Hoe item, meta = damage value
ForgeHammer; // Refine Iron Hammer item, meta = damage value
// el. tools/devices/weapons
miningDrill; // Mining Drill item, meta = damage value for charge level
diamondDrill; // Diamond Tipped Mining Drill item, meta = damage value for charge level
chainsaw; // Chainsaw item, meta = damage value for charge level
electricWrench; // Electric Wrench item, meta = damage value for charge level
electricTreetap; // Electric Treetap item, meta = damage value for charge level
miningLaser; // Mining Laser item, meta = damage value for charge level
ecMeter; // EC-Mater item, meta = itemdata db index (as of v1.45)
odScanner; // Ore Density Scanner item, meta = damage value for charge level
ovScanner; // Ore Value Scanner item, meta = damage value for charge level
obscurator; // Obscurator item, meta = damage value for charge level
frequencyTransmitter; // Frequency Transmitter item, meta = itemdata db index (as of v1.45)
nanoSaber; // Idle Nano Saber item, meta = damage value for charge level
enabledNanoSaber; // Enabled Nano Saber item, meta = damage value for charge level
toolbox; // Open/Empty toolbox, meta = Open (0) / Closed (1)
// armor/wearable
hazmatHelmet; // Hazmat Helmet item, meta = damage value
hazmatChestplate; // Hazmat Chestplate item, meta = damage value
hazmatLeggings; // Hazmat Leggings item, meta = damage value
hazmatBoots; // Hazmat Boots item, meta = damage value
bronzeHelmet; // Bronze Helmet Armor item, meta = damage value
bronzeChestplate; // Bronze Chestplate Armor item, meta = damage value
bronzeLeggings; // Bronze Leggings Armor item, meta = damage value
bronzeBoots; // Bronze Boots Armor item, meta = damage value
compositeArmor; // Composite Armor item, meta = damage value for charge level
nanoHelmet; // Nano Helmet Armor item, meta = damage value for charge level
nanoBodyarmor; // Nano Bodyarmor item, meta = damage value for charge level
nanoLeggings; // Nano Leggings Armor item, meta = damage value for charge level
nanoBoots; // Nano Boots Armor item, meta = damage value for charge level
quantumHelmet; // Quantum Helmet Armor item, meta = damage value for charge level
quantumBodyarmor; // Quantum Bodyarmor item, meta = damage value for charge level
quantumLeggings; // Quantum Leggings Armor item, meta = damage value for charge level
quantumBoots; // Quantum Boots Armor item, meta = damage value for charge level
jetpack; // Jetpack item, meta = damage value for fuel level
electricJetpack; // Electric Jetpack item, meta = damage value for charge level
batPack; // BatPack item, meta = damage value for charge level
advbatPack; // Adv.BatPack item, meta = damage value for charge level
lapPack; // LapPack item, meta = damage value for charge level
energyPack; // EnergyPack item, meta = damage value for charge level
cfPack; // CF Pack item, meta = charges (as of v1.45)
solarHelmet; // Solar Helmet, currently not meta sensitive
staticBoots; // Static Boots, currently not meta sensitive
nightvisionGoggles; // Nightvision Goggles, meta = damage value for charge level
// batteries
reBattery; // Empty RE Battery item, currently not meta sensitive
chargedReBattery; // RE Battery item, meta = damage value for charge level
advBattery; // Adv Batteryitem, meta = damage value for charge level
energyCrystal; // Energy Crystal item, meta = damage value for charge level
lapotronCrystal; // Lapotron Crystal item, meta = damage value for charge level
suBattery; // SU Battery item, meta = damage value for charge level
// cables
copperCableItem; // Copper Cable item, meta sensitive
insulatedCopperCableItem; // Insulated Copper Cable item, meta sensitive
goldCableItem; // Gold Cable item, meta sensitive
insulatedGoldCableItem; // Insulated Gold Cable item, meta sensitive
@Deprecated
doubleInsulatedGoldCableItem; // Double Insulated Gold Cable item, meta sensitive
ironCableItem; // Iron Cable item, meta sensitive
insulatedIronCableItem; // Insulated Iron Cable item, meta sensitive
@Deprecated
doubleInsulatedIronCableItem; // Double Insulated Iron Cable item, meta sensitive
@Deprecated
trippleInsulatedIronCableItem; // Tripple Insulated Iron Cable item, meta sensitive
insulatedTinCableItem;
glassFiberCableItem; // Glass Fiber Cable item, meta sensitive
tinCableItem; // Tin Cable item, meta sensitive
detectorCableItem; // Detector Cable item, meta sensitive
splitterCableItem; // Splitter Cable item, meta sensitive
// cells/containers (without reactor components)
cell; // Empty Cell item, meta sensitive
lavaCell; // Lava Cell item, meta sensitive
waterCell; // Water Cell item, meta sensitive
UuMatterCell; // UUMatter Cell item, meta sensitive
CFCell; // constructionFoam Cell item, meta sensitive
fuelRod; // Empy Fuel Rod item, currently not meta sensitive
hydratedCoalCell; // Hydrated Coal Cell item, currently not meta sensitive
bioCell; // Bio Cell item, currently not meta sensitive
coalfuelCell; // Coalfuel Cell item, currently not meta sensitive
biofuelCell; // Biofuel Cell item, currently not meta sensitive
electrolyzedWaterCell; // Electrolyzed Water Cell item, currently not meta sensitive
airCell; // Compressed Air item, currently not meta sensitive
fuelCan; // Empty Fuel Can item, currently not meta sensitive
filledFuelCan; // Fuel Can item, meta = fuel value (as of v1.45)
tinCan; // Empty Tin Can item, currently not meta sensitive
filledTinCan; // Filled Tin Can item, currently not meta sensitive
// reactor components
reactorUraniumSimple; // Uranium Cell items, meta = consumed uranium ticks
reactorUraniumDual;
reactorUraniumQuad;
reactorCoolantSimple;
reactorCoolantTriple ; // Coolant Cell item, NBT for heat-storage, meta is 0-10000 for display
reactorCoolantSix;
reactorPlating; // Integrated Reactor Plating item, currently not meta sensitive
reactorPlatingHeat;
reactorPlatingExplosive;
reactorHeatSwitch; // Integrated Heat Disperser item, NBT for heat-storage, meta is 0-10000 for display
reactorHeatSwitchCore;
reactorHeatSwitchSpread;
reactorHeatSwitchDiamond;
reactorVent; // Heat Venting component, NBT for heat-storage, meta is 0-10000 for display
reactorVentCore;
reactorVentGold;
reactorVentSpread;// Special: Does not store heat
reactorVentDiamond;
reactorReflector; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display
reactorReflectorThick; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display
reactorCondensator; // Consumes redstone to absorb heat, NBT for storage, meta is 0-10000 for display
reactorCondensatorLap; // Consumes redstone/lapis to absorb heat, mNBT for storage, meta is 0-10000 for display
// terraformer blueprints
terraformerBlueprint; // Empty Terraformer Blueprint item, currently not meta sensitive
cultivationTerraformerBlueprint; // Cultivation Terraformer Blueprint item, currently not meta sensitive
irrigationTerraformerBlueprint; // Irrigation Terraformer Blueprint item, currently not meta sensitive
chillingTerraformerBlueprint; // Chilling Terraformer Blueprint item, currently not meta sensitive
desertificationTerraformerBlueprint; // Desertification Terraformer Blueprint item, currently not meta sensitive
flatificatorTerraformerBlueprint; // Flatificator Terraformer Blueprint item, currently not meta sensitive
mushroomTerraformerBlueprint; // Mushroom Terraformer Blueprint item, currently not meta sensitive
// diamond chain
coalBall; // Coal Ball item, currently not meta sensitive
compressedCoalBall; // Compressed Coal Ball item, currently not meta sensitive
coalChunk; // Coal Chunk item, currently not meta sensitive
industrialDiamond; // Industrial Diamond item, currently not meta sensitive, DEPRECATED
// recycler chain
scrap; // Scrap item, currently not meta sensitive
scrapBox; // Scrap Box item, currently not meta sensitive
// fuel production chain
hydratedCoalClump; // Hydrated Coal Clump item, currently not meta sensitive
plantBall; // Plant Ball item, currently not meta sensitive
compressedPlantBall; // Compressed Plant Ball item, currently not meta sensitive
// painting
painter; // Painter item, currently not meta sensitive
blackPainter; // Black Painter item, meta = damage value
redPainter; // Red Painter item, meta = damage value
greenPainter; // Green Painter item, meta = damage value
brownPainter; // Brown Painter item, meta = damage value
bluePainter; // Blue Painter item, meta = damage value
purplePainter; // Purple Painter item, meta = damage value
cyanPainter; // Cyan Painter item, meta = damage value
lightGreyPainter; // Light Grey Painter item, meta = damage value
darkGreyPainter; // Dark Grey Painter item, meta = damage value
pinkPainter; // Pink Painter item, meta = damage value
limePainter; // Lime Painter item, meta = damage value
yellowPainter; // Yellow Painter item, meta = damage value
cloudPainter; // Cloud Painter item, meta = damage value
magentaPainter; // Magenta Painter item, meta = damage value
orangePainter; // Orange Painter item, meta = damage value
whitePainter; // White Painter item, meta = damage value
// explosives + related
dynamite; // Throwable Dynamite item, currently not meta sensitive
stickyDynamite; // Throwable Sticky Dynamite item, currently not meta sensitive
remote; // Dynamite Remote item, currently not meta sensitive
// misc intermediate recipe ingredients
electronicCircuit; // Electronic Circuit item, currently not meta sensitive
advancedCircuit; // Advanced Circuit item, currently not meta sensitive
advancedAlloy; // Advanced Alloy item, currently not meta sensitive
carbonFiber; // Raw Carbon Fiber item, currently not meta sensitive
carbonMesh; // Raw Carbon Mesh item, currently not meta sensitive
carbonPlate; // Carbon Plate item, currently not meta sensitive
matter; // UUA item, currently not meta sensitive
iridiumOre; // Iridium Ore item, currently not meta sensitive
iridiumPlate; // Iridium Plate item, currently not meta sensitive
// Metal Plates
platecopper; // Metal plate item, meta sensitive
platetin; // Metal plate item, meta sensitive
platebronze; // Metal plate item, meta sensitive
plategold; // Metal plate item, meta sensitive
plateiron; // Metal plate item, meta sensitive
platelead; // Metal plate item, meta sensitive
platelapi; // Metal plate item, meta sensitive
plateobsidian; // Metal plate item, meta sensitive
plateadviron; // Metal plate item, meta sensitive
// Metal Dense Plates
denseplatecopper; // Metal dense plate item, meta sensitive
denseplatetin; // Metal dense plate item, meta sensitive
denseplatebronze; // Metal dense plate item, meta sensitive
denseplategold; // Metal dense plate item, meta sensitive
denseplateiron; // Metal dense plate item, meta sensitive
@Deprecated
denseplateadviron; // Metal dense plate item, meta sensitive
denseplatelead; // Metal dense plate item, meta sensitive
denseplatelapi; // Metal dense plate item, meta sensitive
denseplateobsidian; // Metal dense plate item, meta sensitive
// upgrade modules
overclockerUpgrade; // overclocker upgrade item, meta sensitive
transformerUpgrade; // transformer upgrade item, meta sensitive
energyStorageUpgrade; // energy storage upgrade item, meta sensitive
ejectorUpgrade; // ejector upgrade item, meta sensitive
// misc
coin; // Coin item, currently not meta sensitive
reinforcedDoor; // Reinforced Door item, currently not meta sensitive
constructionFoamPowder; // Construction Foam Powder item, currently not meta sensitive
grinPowder; // Poisonous ingrident, currently not meta sensitive
debug; // Debug item, currently not meta sensitive
boatCarbon; // Carbon Fiber Canoe item, meta sensitive
boatRubber; // Rubber Dinghy item, meta sensitive
boatRubberBroken; // Damaged Rubber Dinghy item, meta sensitive
boatElectric; // Electric Boat item, meta sensitive
//Agriculture
cropSeed; // Crop seeds, stuff stored in NBT, don't use for crafting recipes!
cropnalyzer; // Cropnalyzer handheld device
fertilizer; // Basic IC2Item, used to provide nutrients toCropBlocks
hydratingCell; // Cell used to hydrate Crops, meta = Content, 0= Full, 9999 = Near empty
electricHoe; // Electric Hoe, Metadata indicates charge level
terraWart; // Mystic opposite of NEtherWart, cures StatusEffects, simply consumeable
weedEx; // Spraying can of WEED-EX, meta indicates usages left
//Boozeception
mugEmpty; // Simple stone mug
coffeeBeans; // Harvested CoffeeBeans
coffeePowder; // Processed Coffee Beans, used to craft drinkable Coffee
mugCoffee; // Mug of Coffee, Meta indicates status 0 = cold, 1 = Normal, 2 = Sugar'd
hops; // Hops, harvested freshly from crop
barrel; // Carried Barrel, metadata encrypts the information about the liquid inside
blockBarrel; // Unobtainable "placed barrel", TileEntity controlling the Fermentation process
mugBooze; // Mug filled with booze, metadata encrypts the information about the liquid inside
*/
/**
* Get the base IC2 package name, used internally.
*
* @return IC2 package name, if unable to be determined defaults to ic2
*/
private static String getPackage ()
{
Package pkg = Items.class.getPackage();
if (pkg != null)
{
String packageName = pkg.getName();
return packageName.substring(0, packageName.length() - ".api.item".length());
}
return "ic2";
}
private static Class<?> Ic2Items;
}
@@ -0,0 +1,39 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public interface IWailaBlock
{
/*
* Use this method to return an item stack in case the default lookup system fails.
* Return null if you want to use the default lookup system.
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
*/
ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config);
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
* body to where you mostly want to put informations, and I reserve the tail for modname display
*/
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
* currenttip represents the current list of text lines in the tooltip zone.
* For example, getWailaHead() will have the current item name as currenttip.
* You can modify the tips, add more, remove some, etc.
* When you are done, just returns the currenttip and it will display in Waila.
*
* Always return the currenttip is you don't want to modify the current zone.
*/
List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
}
@@ -0,0 +1,27 @@
package mcp.mobius.waila.api;
import java.util.HashMap;
import java.util.Set;
public interface IWailaConfigHandler
{
/* Returns a set of all the currently loaded modules in the config handler */
public Set<String> getModuleNames ();
/* Returns all the currently available options for a given module */
public HashMap<String, String> getConfigKeys (String modName);
/* Add a new option to a given module
*
* modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc)
* key is the config key (ie : bc.tankcontent, ic2.inputvalue)
* name is the human readable name of the option (ie : "Tank content", "Max EU Input")
* */
//public void addConfig(String modName, String key, String name);
/* Returns the current value of an option (true/false) with a default value defvalue if not set*/
public boolean getConfig (String key, boolean defvalue);
/* Returns the current value of an option (true/false) with a default value true if not set*/
public boolean getConfig (String key);
}
@@ -0,0 +1,32 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public interface IWailaDataAccessor
{
World getWorld ();
EntityPlayer getPlayer ();
Block getBlock ();
int getBlockID ();
int getMetadata ();
TileEntity getTileEntity ();
MovingObjectPosition getPosition ();
NBTTagCompound getNBTData ();
int getNBTInteger (NBTTagCompound tag, String keyname);
}
@@ -0,0 +1,5 @@
package mcp.mobius.waila.api;
public interface IWailaDataProvider extends IWailaBlock
{
}
@@ -0,0 +1,22 @@
package mcp.mobius.waila.api;
public interface IWailaRegistrar
{
/* Add a config option in the section modname with displayed text configtext and access key keyname */
public void addConfig (String modname, String keyname, String configtext);
public void addConfigRemote (String modname, String keyname, String configtext);
/* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */
public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID);
public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID);
/* Register a stack overrider for the given blockID */
public void registerStackProvider (IWailaDataProvider dataProvider, int blockID);
/* Same thing, but works on a class hierarchy instead */
public void registerHeadProvider (IWailaDataProvider dataProvider, Class block);
public void registerBodyProvider (IWailaDataProvider dataProvider, Class block);
}
@@ -0,0 +1,31 @@
package mods.battlegear2.api;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
//This is a tempory fix until we get the heradry system up and running
public interface IDyable {
/**
* Return whether the specified armor ItemStack has a color.
*/
public boolean hasColor(ItemStack par1ItemStack);
/**
* Return the color for the specified armor ItemStack.
*/
public int getColor(ItemStack par1ItemStack);
public void setColor(ItemStack dyable, int rgb);
/**
* Remove the color from the specified armor ItemStack.
*/
public void removeColor(ItemStack par1ItemStack);
public int getDefaultColor(ItemStack par1ItemStack);
}
@@ -0,0 +1,54 @@
package mods.battlegear2.api;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
public interface IShield {
/**
* Gets the decay rate for the stamina bar when the shield is in use.
* The value should be between 0 and 1. The duration of maximum blocking can be calculated
* by 1/decayRate/20.
*
* @param shield The {@link #ItemStack} representing the shield
* @return a value between 0 & 1 representing the decay rate per tick
*/
public float getDecayRate(ItemStack shield);
/**
* Returns true if the current shield can and should block the given damage source
*
* @param shield The {@link #ItemStack} representing the shield
* @param source The {@link #DamageSource} representing the current damage
* @return true if the shield can block the given damage type
*/
public boolean canBlock(ItemStack shield, DamageSource source);
/**
* Gets the extra decay rate to the stamina bar when the shield is damaged
*
* @param shield The {@link #ItemStack} representing the shield
* @param amount The amount of damage the shield has absorbed
* @return a value between 0 & 1 representing the decay rate
*/
public float getDamageDecayRate(ItemStack shield, float amount);
/**
* Returns the block angle in degrees that the shield can block.
* This angle is taken as 0 degrees being directly in front of the player. The shield
* will block between -blockAngle to blockangle
* @param shield The {@link #ItemStack} representing the shield
* @return The maximum angle the shield should be able to block at
*/
public float getBlockAngle(ItemStack shield);
/**
* Returns the time a shield bash should take to be preformed. A shield bash will disallow actions
* for the number of ticks given and will knockback an oponent at time/2
*
* @return The amount of ticks the shield bash animation will play
*/
public int getBashTimer(ItemStack shield);
}
@@ -0,0 +1,32 @@
package mods.battlegear2.api;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.PlayerEvent;
public class PlayerEventChild extends PlayerEvent{
public PlayerEvent parent;
public PlayerEventChild(PlayerEvent parent) {
super(parent.entityPlayer);
this.parent = parent;
}
public void setCancelParentEvent(boolean cancel) {
parent.setCanceled(cancel);
}
@Override
public void setCanceled(boolean cancel) {
super.setCanceled(cancel);
parent.setCanceled(cancel);
}
@Override
public void setResult(Result value) {
super.setResult(value);
parent.setResult(value);
}
}
@@ -0,0 +1,99 @@
package mods.battlegear2.api.quiver;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IArrowContainer2 {
/**
* Returns the maximum amout of slots in the arrow container
* @param container {@link #ItemStack} representing this item
* @return the amount of slots
*/
public int getSlotCount(ItemStack container);
/**
* Returns the currently selected slot in the arrow container
* @param container {@link #ItemStack} representing this item
* @return the currently selected slot
*/
public int getSelectedSlot(ItemStack container);
/**
* Sets the currently selected slot to the given value
* @param container {@link #ItemStack} representing this item
* @param newSlot the new slot index
*/
public void setSelectedSlot(ItemStack container, int newSlot);
/**
* Returns the itemStack in the currently selected slot
* @param container The {@link #ItemStack} representing this item
* @param slot the slot index
* @return The {@link #ItemStack} in the given slot.
*/
public ItemStack getStackInSlot(ItemStack container, int slot);
/**
* Sets places the given item stack in the give slot
* @param container {@link #ItemStack} representing this item
* @param slot the slot index
* @param container {@link #ItemStack} representing the new stack
*/
public void setStackInSlot(ItemStack container, int slot, ItemStack stack);
/**
*
* @param container The {@link #ItemStack} representing this item
* @param bow The bow trying to use this container
* @param player The {@link #EntityPlayer} using the bow
* @return true if the item contains at least one arrow in the selected slot
*/
public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot);
/**
* The arrow spawned when bow is used with this non empty container equipped
* @param container The {@link #ItemStack} representing this item
* @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @return the arrow entity to spawn when bow is used
*/
public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge);
/**
* Action to take after an arrow has been fired
* Usually equal to removing an arrow from the container
* @param player The {@link #EntityPlayer} using the bow
* @param world
* @param container The {@link #ItemStack} representing this item
* @param bow The bow which fired
* @param arrow the arrow fired
*/
public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow);
/**
* Called before the arrow is fired from this container
* @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment
*/
public void onPreArrowFired(QuiverArrowEvent arrowEvent);
/**
* Called when the container is put on a crafting bench with other items
* @param container The {@link #ItemStack} representing this item
* @param arrowStack The {@link #ItemStack} representing other items
* @return True to receive {@link #addArrows(ItemStack, ItemStack)}
*/
public boolean isCraftableWithArrows(ItemStack contaner, ItemStack arrowStack);
/**
* Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)}
* @param container The {@link #ItemStack} representing this item
* @param arrows Another valid item on the crafting bench
* @return Number of arrows that couldn't fit in
*/
public ItemStack addArrows(ItemStack container, ItemStack newStack);
}
@@ -0,0 +1,30 @@
package mods.battlegear2.api.quiver;
import mods.battlegear2.api.PlayerEventChild;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
public class QuiverArrowEvent extends PlayerEventChild{
public int bowDamage = 1;
public float bowSoundVolume = 1.0F;
public boolean addEnchantments = true;
public ArrowLooseEvent event;
public QuiverArrowEvent(ArrowLooseEvent parent) {
super(parent);
this.event = parent;
}
public ItemStack getBow()
{
return event.bow;
}
public int getCharge()
{
return event.charge;
}
}
@@ -0,0 +1,42 @@
package mods.battlegear2.api.quiver;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
public class QuiverArrowRegistry {
private static Map<ItemStack, Class<? extends EntityArrow>> map = new TreeMap<ItemStack, Class<? extends EntityArrow>>(new StackComparator());
public static void addArrowToRegistry(int itemId, int itemMetadata, Class<? extends EntityArrow> entityArrow){
ItemStack stack = new ItemStack(itemId, 1, itemMetadata);
map.put(stack, entityArrow);
}
public static Class<? extends EntityArrow> getArrowClass(ItemStack stack){
return map.get(stack);
}
static class StackComparator implements Comparator<ItemStack> {
@Override
public int compare(ItemStack stack, ItemStack stack2) {
if(stack == stack2){
return 0;
}else{
int idDiff = stack.itemID - stack2.itemID;
if(idDiff != 0){
return idDiff;
}else
return stack.getItemDamage() - stack2.getItemDamage();
}
}
}
}
@@ -0,0 +1,14 @@
package mods.battlegear2.api.weapons;
import net.minecraft.entity.EntityLivingBase;
public interface IBackStabbable {
/**
* Action to perform on back stabbing
* @param entityHit
* @param entityHitting
* @return true if it adds an hitting action
*/
public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting);
}
@@ -0,0 +1,70 @@
package mods.battlegear2.api.weapons;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
public interface IBattlegearWeapon {
/**
* Returns true if the weapon will allow other weapons to be placed in the partner offhand slot
*/
public boolean willAllowOffhandWeapon();
/**
* Will allow shield
*/
public boolean willAllowShield();
/**
* Returns true if the weapon be dual wielded in the offhand slot
*/
public boolean isOffhandHandDualWeapon();
/**
* Returns true if the weapon should always be sheathed on the back, false if it should be sheathed on the hip
*/
public boolean sheatheOnBack();
/**
* Perform any function when the item is held in the offhand and the user right clicks an entity.
* This is generally used to attack an entity with the offhand item. If this is the case the event should
* be canceled to prevent any default right clicking events (Eg Villager Trading)
*
* @param event the OffhandAttackEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
* @return true if the off hand swing animation should be performed
*/
public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem);
/**
* Perform any function when the item is held in the offhand and the user right clicks "Air".
*
* @param event the PlayerInteractEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
* @return true if the off hand swing animation should be performed
*/
public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem);
/**
* Perform any function when the item is held in the offhand and the user right clicks a block.
* Note that this will happen prior to the activation of any activation functions of blocks
*
* @param event the PlayerInteractEvent that was generated
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
*/
public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem);
/**
* Perform any passive effects on each game tick when the item is held in the offhand
*
* @param effectiveSide the effective side the method was called from
* @param mainhandItem the ItemStack currently being held in the right hand
* @param offhandItem the ItemStack currently being held in the left hand
*/
public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem);
}
@@ -0,0 +1,12 @@
package mods.battlegear2.api.weapons;
import net.minecraft.item.ItemStack;
public interface IExtendedReachWeapon {
/**
* The distance the weapon will hit (note this will ONLY work for main hand weapons)
* @param stack
* @return
*/
public float getReachModifierInBlocks(ItemStack stack);
}
@@ -0,0 +1,15 @@
package mods.battlegear2.api.weapons;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public interface IHitTimeModifier {
/**
*
* @param entityHit
* @return The amount to modify the hit shield
*/
public int getHitTime(ItemStack stack, EntityLivingBase entityHit);
}
@@ -0,0 +1,13 @@
package mods.battlegear2.api.weapons;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public interface IPenetrateWeapon {
/**
* The amount of damage bypassing armor
* @param stack The {@link net.minecraft.item.ItemStack} representative of the item dealing the hit.
* @return the amount of damage that bypasses armour
*/
public int getPenetratingPower(ItemStack stack);
}
@@ -0,0 +1,23 @@
package mods.battlegear2.api.weapons;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import java.util.Map;
public interface IPotionEffect {
/**
* Returns a map containing the potion effects to apply to an entity hit by the weapon. Each effect
* has a float value associated with the chance of applying the effect. Note that the "dice roll" only
* occurs once so any value under this roll will be applied.
*
* @param entityHit The entity the effect will be applied to.
* @param entityHitting
* @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, to be dealt to the entityHit
*/
public Map<PotionEffect,Float> getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting);
}
@@ -0,0 +1,16 @@
package mods.battlegear2.api.weapons;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
public interface ISpecialEffect {
/**
*
* @param entityHit The entity the effect will be applied to.
* @param entityHitting
* @return true if it adds an hitting action
*/
public boolean performEffects(EntityLivingBase entityHit, EntityLivingBase entityHitting);
}
@@ -0,0 +1,22 @@
package mods.battlegear2.api.weapons;
import mods.battlegear2.api.PlayerEventChild;
import net.minecraft.entity.Entity;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
public class OffhandAttackEvent extends PlayerEventChild {
public boolean swingOffhand = true;
public boolean shouldAttack = true;
public EntityInteractEvent event;
public OffhandAttackEvent(EntityInteractEvent parent) {
super(parent);
this.event = parent;
}
public Entity getTarget() {
return event.target;
}
}
@@ -0,0 +1,497 @@
package powercrystals.minefactoryreloaded.api;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetLogicCircuit;
import java.lang.reflect.Method;
import net.minecraft.item.ItemStack;
/**
* @author PowerCrystals
*
* Class used to register plants and other farming-related things with MFR. Will do nothing if MFR does not exist, but your mod should be set to load
* after MFR or things may not work properly.
*
* To avoid breaking the API, additional FactoryRegistry##s will appear on major MFR versions that contain API additions. On a Minecraft version change,
* these will be rolled back into this class.
*
*/
public class FactoryRegistry
{
/**
* Registers a plantable object with the Planter.
*
* @param plantable The thing to plant.
*/
public static void registerPlantable (IFactoryPlantable plantable)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerPlantable", IFactoryPlantable.class);
reg.invoke(registry, plantable);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a harvestable block with the Harvester.
*
* @param harvestable The thing to harvest.
*/
public static void registerHarvestable (IFactoryHarvestable harvestable)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerHarvestable", IFactoryHarvestable.class);
reg.invoke(registry, harvestable);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a fertilizable block with the Fertilizer.
*
* @param fertilizable The thing to fertilize.
*/
public static void registerFertilizable (IFactoryFertilizable fertilizable)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerFertilizable", IFactoryFertilizable.class);
reg.invoke(registry, fertilizable);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a fertilizer item Fertilizer.
*
* @param fertilizable The thing to fertilize with.
*/
public static void registerFertilizer (IFactoryFertilizer fertilizer)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerFertilizer", IFactoryFertilizer.class);
reg.invoke(registry, fertilizer);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a ranchable entity with the Rancher.
*
* @param ranchable The entity to ranch.
*/
public static void registerRanchable (IFactoryRanchable ranchable)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerRanchable", IFactoryRanchable.class);
reg.invoke(registry, ranchable);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a grindable entity with the Grinder using the new grinder interface. This method will be renamed to the standard "registerGrindable"
* on MC 1.6.
*
* @param grindable The entity to grind.
*/
public static void registerGrindable (IFactoryGrindable grindable)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerGrindable", IFactoryGrindable.class);
reg.invoke(registry, grindable);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a grindable entity with the Grinder using the new grinder interface. This method will be renamed to the standard "registerGrindable"
* on MC 1.6.
*
* @param grindable The entity to grind.
*/
public static void registerGrinderBlacklist (Class<?>... ungrindables)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerGrinderBlacklist", Class[].class);
reg.invoke(registry, (Object[]) ungrindables);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a possible output with the sludge boiler.
*
* @param weight Likelihood that this item will be produced. Lower means rarer.
* @param drop The thing being produced by the sludge boiler.
*/
public static void registerSludgeDrop (int weight, ItemStack drop)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerSludgeDrop", int.class, ItemStack.class);
reg.invoke(registry, weight, drop);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers specific food to use in the Breeder (instead of wheat) for a given mob.
*
* @param entityToBreed Entity this food will be used with.
* @param food The item to use when breeding this entity.
*/
public static void registerBreederFood (Class<?> entityToBreed, ItemStack food)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerBreederFood", Class.class, ItemStack.class);
reg.invoke(registry, entityToBreed, food);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Bans an entity class from being collected by Safari Nets
*
* @param blacklistedEntity Class to blacklist
*/
public static void registerSafariNetBlacklist (Class<?> blacklistedEntity)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerSafariNetBlacklist", Class.class);
reg.invoke(registry, blacklistedEntity);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a Safari Net handler to properly serialize a type of mob.
*
* @param handler The Safari Net handler.
*/
public static void registerSafariNetHandler (ISafariNetHandler handler)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerSafariNetHandler", ISafariNetHandler.class);
reg.invoke(registry, handler);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a mob egg handler, which allows the Safari Net to properly change colors.
*
* @param handler The mob egg handler
*/
public static void registerMobEggHandler (IMobEggHandler handler)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerMobEggHandler", IMobEggHandler.class);
reg.invoke(registry, handler);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Allows Rubber Trees to spawn in the specified biome.
*
* @param biome The biome name.
*/
public static void registerRubberTreeBiome (String biome)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerRubberTreeBiome", String.class);
reg.invoke(registry, biome);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers an entity as a possible output from villager random safari nets. Note that the "id" field must be initialized
* (i.e. with Entity.addEntityID()) for it to work correctly.
*
* @param savedMob A serialized mob that will be unloaded by the safari net
* @param weight The weight of this mob in the random selection
*/
public static void registerVillagerTradeMob (IRandomMobProvider mobProvider)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerVillagerTradeMob", IRandomMobProvider.class);
reg.invoke(registry, mobProvider);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a handler for drinking liquids with the straw.
*
* @param liquidId The block ID the handler handles.
* @param liquidDrinkHandler The drink handler instance.
*/
public static void registerLiquidDrinkHandler (int liquidId, ILiquidDrinkHandler liquidDrinkHandler)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerLiquidDrinkHandler", int.class, ILiquidDrinkHandler.class);
reg.invoke(registry, liquidId, liquidDrinkHandler);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a possible output with the laser drill.
*
* @param weight Likelihood that this item will be produced. Lower means rarer.
* @param drop The thing being produced by the laser drill.
*/
public static void registerLaserOre (int weight, ItemStack drop)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerLaserOre", int.class, ItemStack.class);
reg.invoke(registry, weight, drop);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a preferred ore with the laser drill. Focuses with the specified color will make the specified ore more likely.
* Used by MFR itself for vanilla: Black (Coal), Light Blue (Diamond), Lime (Emerald), Yellow (Gold), Brown (Iron), Blue (Lapis),
* Red (Redstone), and White (nether quartz).
*
* This will replace setLaserPreferredOre on MC 1.6.
*
* @param color The color that the preferred ore is being set for. White is 0.
* @param ore The ore that will be preferred by the drill when a focus with the specified color is present.
*/
public static void addLaserPreferredOre (int color, ItemStack ore)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("addLaserPreferredOre", int.class, ItemStack.class);
reg.invoke(registry, color, ore);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a block ID as a fruit tree log. When the Fruit Picker sees this block on the ground, it will
* begin a search in tree mode for any fruit nearby.
*
* @param fruitLogBlockId The block ID to mark as a fruit tree log.
*/
public static void registerFruitLogBlockId (Integer fruitLogBlockId)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerFruitLogBlockId", Integer.class);
reg.invoke(registry, fruitLogBlockId);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers a fruit for the Fruit Picker.
*
* @param fruit The fruit to be picked.
*/
public static void registerFruit (IFactoryFruit fruit)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerFruit", IFactoryFruit.class);
reg.invoke(registry, fruit);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers an entity string as an invalid entry for the autospawner.
* See also: {@link net.minecraft.entity.EntityList}'s classToStringMapping and stringToClassMapping.
*
* @param entityString The entity string to blacklist.
*/
public static void registerAutoSpawnerBlacklist (String entityString)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerAutoSpawnerBlacklist", String.class);
reg.invoke(registry, entityString);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* Registers logic circuit to be usable in the Programmable RedNet Controller.
*
* @param circuit The circuit to be registered.
*/
public static void registerRedNetLogicCircuit (IRedNetLogicCircuit circuit)
{
try
{
Class<?> registry = Class.forName("powercrystals.minefactoryreloaded.MFRRegistry");
if (registry != null)
{
Method reg = registry.getMethod("registerRedNetLogicCircuit", IRedNetLogicCircuit.class);
reg.invoke(registry, circuit);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
@@ -0,0 +1,23 @@
package powercrystals.minefactoryreloaded.api;
/**
* @author PowerCrystals
*
* Determines what kind of action a given fertilizer can perform. Your IFactoryFertilizable instances should check this before
* performing any action to maintain future compatibility.
*/
public enum FertilizerType
{
/**
* The fertilizer will fertilize grass.
*/
Grass,
/**
* The fertilizer will grow a plant.
*/
GrowPlant,
/**
* The fertilizer will grow magical crops.
*/
GrowMagicalCrop,
}
@@ -0,0 +1,34 @@
package powercrystals.minefactoryreloaded.api;
/**
* @author PowerCrystals
*
* Determines what algorithm the Harvester uses when it encounters this IFactoryHarvestable in the world.
*/
public enum HarvestType
{
/**
* Just break the single block - no special action needed. Carrots, flowers, etc.
*/
Normal,
/**
* Search for identical blocks above.
*/
Column,
/**
* Search for identical blocks above but leave this bottom one for the future. Cactus and sugarcane.
*/
LeaveBottom,
/**
* This block is the base of a tree and the harvester should enter tree-cutting mode.
*/
Tree,
/**
* This block is the base of the tree and the harvester should enter tree-cutting mode, but the tree grows upside-down.
*/
TreeFlipped,
/**
* This block is part of a tree as above, but leaves are cut before tree logs so that leaves do not decay more than necessary.
*/
TreeLeaf
}
@@ -0,0 +1,26 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
public interface IDeepStorageUnit
{
/**
* @return A populated ItemStack with stackSize for the full amount of materials in the DSU. May have a stackSize > getMaxStackSize().
*/
ItemStack getStoredItemType ();
/**
* Sets the total amount of the item currently being stored, or zero if it wants to remove all items.
*/
void setStoredItemCount (int amount);
/**
* Sets the type of the stored item and initializes the number of stored items to amount. Will overwrite any existing stored items.
*/
void setStoredItemType (ItemStack type, int amount);
/**
* @return The maximum number of items the DSU can hold.
*/
int getMaxStoredCount ();
}
@@ -0,0 +1,40 @@
package powercrystals.minefactoryreloaded.api;
import java.util.Random;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a fertilizable block, and the process to fertilize it. You can assume that you will never have to check that block ID matches the one returned by
* getFertilizableBlockId().
*/
public interface IFactoryFertilizable
{
/**
* @return The block ID this instance is managing.
*/
public int getFertilizableBlockId ();
/**
* @param world The world this block belongs to.
* @param x The X coordinate of this block.
* @param y The Y coordinate of this block.
* @param z The Z coordinate of this block.
* @param fertilizerType The kind of fertilizer being used.
* @return True if the block at (x,y,z) can be fertilized with the given type of fertilizer.
*/
public boolean canFertilizeBlock (World world, int x, int y, int z, FertilizerType fertilizerType);
/**
* @param world The world this block belongs to.
* @param rand A Random instance to use when fertilizing, if necessary.
* @param x The X coordinate of this block.
* @param y The Y coordinate of this block.
* @param z The Z coordinate of this block.
* @param fertilizerType The kind of fertilizer being used.
* @return True if fertilization was successful. If false, the Fertilizer will not consume a fertilizer item and will not drain power.
*/
public boolean fertilize (World world, Random rand, int x, int y, int z, FertilizerType fertilizerType);
}
@@ -0,0 +1,33 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
/**
* @author PowerCrystals
*
* Defines a fertilizer item for use in the Fertilizer.
*/
public interface IFactoryFertilizer
{
/**
* @return The ID of this fertilizer item.
*/
int getFertilizerId ();
/**
* @return The metadata of this fertilizer item.
*/
int getFertilizerMeta ();
/**
* @return The type of fertilizer this is.
*/
FertilizerType getFertilizerType ();
/**
* Called when a fertilization is successful. If you set the ItemStack size to 0, it will be deleted by the fertilizer.
*
* @param fertilizer The ItemStack used to fertilize.
*/
void consume (ItemStack fertilizer);
}
@@ -0,0 +1,69 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Defines a fruit entry for the Fruit Picker.
*
* @author powercrystals
*
*/
public interface IFactoryFruit
{
/**
* @return The block ID this fruit has in the world.
*/
public int getSourceBlockId ();
/**
* Used to determine if this fruit can be picked (is it ripe yet, etc)
* @param world The world where the fruit is being picked
* @param x The x-coordinate of the fruit
* @param y The y-coordinate of the fruit
* @param z The z-coordinate of the fruit
* @return True if the fruit can be picked
*/
public boolean canBePicked (World world, int x, int y, int z);
/**
* Called by the Fruit Picker to determine what block to replace the picked block with. Only ID and meta/damage will be used.
* At the time this method is called, the fruit still exists. Do not pass an item ID as the return value.
* @param world The world where the fruit is being picked
* @param x The x-coordinate of the fruit
* @param y The y-coordinate of the fruit
* @param z The z-coordinate of the fruit
* @return The block to replace the fruit block with, or null for air.
*/
public ItemStack getReplacementBlock (World world, int x, int y, int z);
/**
* Called by the Fruit Picker before the fruit is picked.
* @param world The world where the fruit is being picked
* @param x The x-coordinate of the fruit
* @param y The y-coordinate of the fruit
* @param z The z-coordinate of the fruit
*/
public void prePick (World world, int x, int y, int z);
/**
* Called by the Fruit Picker to determine what drops to generate. At the time this method is called, the fruit still exists.
* @param world The world where the fruit is being picked
* @param x The x-coordinate of the fruit
* @param y The y-coordinate of the fruit
* @param z The z-coordinate of the fruit
*/
public List<ItemStack> getDrops (World world, Random rand, int x, int y, int z);
/**
* Called by the Fruit Picker after the fruit is picked.
* @param world The world where the fruit is being picked
* @param x The x-coordinate of the fruit
* @param y The y-coordinate of the fruit
* @param z The z-coordinate of the fruit
*/
public void postPick (World world, int x, int y, int z);
}
@@ -0,0 +1,36 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a grindable entity for the Grinder.
*/
@SuppressWarnings("deprecation")
public interface IFactoryGrindable
{
/**
* @return The class that this grindable instance is handling. This must be a subtype of EntityLivingBase or the entity will never
* be noticed by the Grinder.
*/
public Class<?> getGrindableEntity ();
/**
* @param world The world this entity is in.
* @param entity The entity instance being ground.
* @param random A Random instance.
* @return The drops generated when this entity is killed.
*/
public List<MobDrop> grind (World world, EntityLivingBase entity, Random random);
/**
* @param entity The entity instance being ground.
* @return Whether this entity has been fully processed or not.
*/
public boolean processEntity (EntityLivingBase entity);
}
@@ -0,0 +1,70 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a harvestable block for the Harvester.
*/
public interface IFactoryHarvestable
{
/**
* @return The block ID this harvestable instance is managing.
*/
public int getPlantId ();
/**
* @return The type of harvest the Harvester should perform on this block.
*/
public HarvestType getHarvestType ();
/**
* @return Whether or not the Harvester should break the block when harvesting. If false, no changes will be performed by the Harvester itself.
*/
public boolean breakBlock ();
/**
* @param world The world this block is in.
* @param harvesterSettings The harvester's current settings. Do not modify these.
* @param x The X coordinate of the block being harvested.
* @param y The Y coordinate of the block being harvested.
* @param z The Z coordinate of the block being harvested.
* @return True if this block can be harvested.
*/
public boolean canBeHarvested (World world, Map<String, Boolean> harvesterSettings, int x, int y, int z);
/**
* @param world The world this block is in.
* @param rand A Random instance to use when generating drops.
* @param harvesterSettings The harvester's current settings. Do not modify these.
* @param x The X coordinate of the block being harvested.
* @param y The Y coordinate of the block being harvested.
* @param z The Z coordinate of the block being harvested.
* @return The drops generated by breaking this block. For a default implementation, calling Block.getBlockDropped() is usually sufficient.
*/
public List<ItemStack> getDrops (World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z);
/**
* Called before the block is going to be harvested. Usually empty.
* @param world The world this block is in.
* @param x The X coordinate of the block being harvested.
* @param y The Y coordinate of the block being harvested.
* @param z The Z coordinate of the block being harvested.
*/
public void preHarvest (World world, int x, int y, int z);
/**
* Called after the block is going to be harvested. Used to re-till soil, for example.
* @param world The world this block is in.
* @param x The X coordinate of the block being harvested.
* @param y The Y coordinate of the block being harvested.
* @param z The Z coordinate of the block being harvested.
*/
public void postHarvest (World world, int x, int y, int z);
}
@@ -0,0 +1,67 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a plantable object for use in the Planter.
*/
public interface IFactoryPlantable
{
/**
* @return The block or item ID this plantable is managing.
*/
public int getSeedId ();
/**
* @param world The world instance this block or item will be placed into.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param z The destination Z coordinate.
* @param stack The stack being planted.
* @return The block ID that will be placed into the world.
*/
public int getPlantedBlockId (World world, int x, int y, int z, ItemStack stack);
/**
* @param world The world instance this block or item will be placed into.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param z The destination Z coordinate.
* @param stack The stack being planted.
* @return The block metadata that will be placed into the world.
*/
public int getPlantedBlockMetadata (World world, int x, int y, int z, ItemStack stack);
/**
* @param world The world instance this block or item will be placed into.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param z The destination Z coordinate.
* @param stack The stack being planted.
* @return True if this plantable can be placed at the provided coordinates.
*/
public boolean canBePlantedHere (World world, int x, int y, int z, ItemStack stack);
/**
* Called before planting is performed. Used to till soil, for example.
* @param world The world instance this block or item will be placed into.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param z The destination Z coordinate.
* @param stack The stack being planted.
*/
public void prePlant (World world, int x, int y, int z, ItemStack stack);
/**
* Called after planting is performed. Usually empty.
* @param world The world instance this block or item will be placed into.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param z The destination Z coordinate.
* @param stack The stack being planted.
*/
public void postPlant (World world, int x, int y, int z, ItemStack stack);
}
@@ -0,0 +1,28 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.IInventory;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a ranchable entity for use in the Rancher.
*/
public interface IFactoryRanchable
{
/**
* @return The entity being ranched. Must be a subtype of EntityLivingBase.
*/
public Class<?> getRanchableEntity ();
/**
* @param world The world this entity is in.
* @param entity The entity instance being ranched.
* @param rancher The rancher instance doing the ranching. Used to access the Rancher's inventory when milking cows, for example.
* @return A list of drops.
*/
public List<RanchedItem> ranch (World world, EntityLivingBase entity, IInventory rancher);
}
@@ -0,0 +1,8 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.entity.player.EntityPlayer;
public interface ILiquidDrinkHandler
{
public void onDrink (EntityPlayer player);
}
@@ -0,0 +1,18 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.item.ItemStack;
/**
* @author PowerCrystals
*
* Defines a class that MFR will use to local egg info for a given mob. This is used to color the Safari Net based on the captured mob.
*/
public interface IMobEggHandler
{
/**
* @param safariNet The Safari Net that is looking for egg info.
* @return An EntityEggInfo, or null if this instance cannot handle this mob.
*/
public EntityEggInfo getEgg (ItemStack safariNet);
}
@@ -0,0 +1,14 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface INeedleAmmo
{
public boolean onHitEntity (EntityPlayer owner, Entity hit, double distance);
public void onHitBlock (EntityPlayer owner, World world, int x, int y, int z, int side, double distance);
public float getSpread ();
}
@@ -0,0 +1,10 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import net.minecraft.world.World;
public interface IRandomMobProvider
{
public List<RandomMob> getRandomMobs (World world);
}
@@ -0,0 +1,28 @@
package powercrystals.minefactoryreloaded.api;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* @author PowerCrystals
*
* Defines an object that can display information about a captured mob in a Safari net.
*/
public interface ISafariNetHandler
{
/**
* @return The class of mob that this handler applies to.
*/
public Class<?> validFor ();
/**
* @param safariNetStack The Safari Net that is requesting information.
* @param player The player holding the Safari Net.
* @param infoList The current list of information strings. Add yours to this.
* @param advancedTooltips True if the advanced tooltips option is on.
*/
@SuppressWarnings("rawtypes")
public void addInformation (ItemStack safariNetStack, EntityPlayer player, List infoList, boolean advancedTooltips);
}
@@ -0,0 +1,31 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* @author PowerCrystals
*
* Defines a syringe for use in the Vet machine.
*/
public interface ISyringe
{
/**
* Called when the vet is deciding if it should use this syringe.
* @param world The world instance.
* @param entity The entity being injected.
* @param syringe The syringe ItemStack.
* @return True if the entity can be injected by this syringe.
*/
public boolean canInject (World world, EntityLivingBase entity, ItemStack syringe);
/**
* Called to perform an injection.
* @param world The world instance.
* @param entity The entity being injected.
* @param syringe The syringe ItemStack.
* @return True if injection was successful.
*/
public boolean inject (World world, EntityLivingBase entity, ItemStack syringe);
}
@@ -0,0 +1,9 @@
package powercrystals.minefactoryreloaded.api;
/**
* @author PowerCrystals
* Defines a tool that can rotate MFR machines. Implement on an Item class. Requires no additional work on your part.
*/
public interface IToolHammer
{
}
@@ -0,0 +1,16 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
/**
* @author PowerCrystals
*
* This interface is like IToolHammer, but is for items that change state on a per-stack basis. Implement this
* instead of IToolHammer - not both!
*
* This interface will replace IToolHammer in MC 1.6.
*/
public interface IToolHammerAdvanced
{
public boolean isActive (ItemStack stack);
}
@@ -0,0 +1,22 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomItem;
public class MobDrop extends WeightedRandomItem
{
private ItemStack _stack;
public MobDrop(int weight, ItemStack stack)
{
super(weight);
_stack = stack;
}
public ItemStack getStack ()
{
if (_stack == null)
return null;
return _stack.copy();
}
}
@@ -0,0 +1,69 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* @author skyboy026
*
* Defines an ItemStack or a FluidStack that is the result of an entity being ranched
*/
public final class RanchedItem
{
private final ItemStack item;
private final FluidStack fluid;
public RanchedItem(Block item, int amount, int meta)
{
this(new ItemStack(item, amount, meta));
}
public RanchedItem(Block item, int amount)
{
this(new ItemStack(item, amount));
}
public RanchedItem(Block item)
{
this(new ItemStack(item));
}
public RanchedItem(Item item, int amount, int meta)
{
this(new ItemStack(item, amount, meta));
}
public RanchedItem(Item item, int amount)
{
this(new ItemStack(item, amount));
}
public RanchedItem(Item item)
{
this(new ItemStack(item));
}
public RanchedItem(ItemStack item)
{
this.item = item;
fluid = null;
}
public RanchedItem(FluidStack fluid)
{
this.fluid = fluid;
item = null;
}
public boolean hasFluid ()
{
return item == null & fluid != null;
}
public Object getResult ()
{
return item == null ? fluid : item;
}
}
@@ -0,0 +1,22 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.entity.Entity;
import net.minecraft.util.WeightedRandomItem;
public class RandomMob extends WeightedRandomItem
{
private Entity _mob;
public RandomMob(Entity savedMob, int weight)
{
super(weight);
_mob = savedMob;
}
public Entity getMob ()
{
if (_mob == null)
return null;
return _mob;
}
}
@@ -0,0 +1,86 @@
package powercrystals.minefactoryreloaded.api.rednet;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
/**
* Defines a Block that can connect to RedNet cables. This must be implemented on your Block class.
* Note that when you implement this, the RedNet network makes several assumptions about your code -
* primarily, it will not clamp values to 0 <= x <= 15. This means you must be able to accept any
* possible integer without crashing, even negatives. It will also assume that calling the onInput(s)Changed()
* methods are sufficient, and will not issue block updates. Finally, it will never call the vanilla redstone
* output methods in All mode, and will only query the methods contained in this interface in that case. In Single
* mode, it will call onInputChanged, and will check for strong power (or weak if in Plate mode) through the vanilla
* method calls.
*
* RedNet cables have their subnets indicated to the user by colored bands on the cable.
* The color of a given subnet is the same as the wool with metadata equal to the subnet number.
* For reference:
* 0:White, 1:Orange, 2:Magenta, 3:LightBlue, 4:Yellow, 5:Lime, 6:Pink, 7:Gray,
* 8:LightGray, 9:Cyan, 10:Purple, 11:Blue, 12:Brown, 13:Green, 14:Red, 15:Black
*/
public interface IConnectableRedNet
{
/**
* Returns the connection type of this Block. "All" types will cause getOutputValues() and onInputsChanged() to be used,
* whereas "Single" types will onInputChanged() to be called for input changes and the normal redstone power output methods
* to be called for output. If this value must be changed while the block is alive, it must perform a block update on any
* adjacent RedNet wires.
* @param world The world this block is in.
* @param x This block's X coordinate.
* @param y This block's Y coordinate.
* @param z This block's Z coordinate.
* @param side The side that connection information is required for.
* @return The connection type.
*/
public RedNetConnectionType getConnectionType (World world, int x, int y, int z, ForgeDirection side);
/**
* Returns the output values of this RedNet node. This array must be 16 elements long. Only called if your block is connected in "All" mode.
* @param world The world this block is in.
* @param x This block's X coordinate.
* @param y This block's Y coordinate.
* @param z This block's Z coordinate.
* @param side The side the output values are required for.
* @return The output values.
*/
public int[] getOutputValues (World world, int x, int y, int z, ForgeDirection side);
/**
* Returns the output value of this RedNet node for a given subnet. Only called if your block is connected in "All" mode.
* @param world The world this block is in.
* @param x This block's X coordinate.
* @param y This block's Y coordinate.
* @param z This block's Z coordinate.
* @param side The side the output value is required for.
* @param subnet The subnet to get the output value for (0-15).
* @return The output value.
*/
public int getOutputValue (World world, int x, int y, int z, ForgeDirection side, int subnet);
/**
* Called when the input values to this block change. Only called if your block is connected in "All" mode.
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
* on the next tick.
* @param world The world this block is in.
* @param x This block's X coordinate.
* @param y This block's Y coordinate.
* @param z This block's Z coordinate.
* @param side The side the input values are being changed on.
* @param inputValues The new set of input values. This array will be 16 elements long.
*/
public void onInputsChanged (World world, int x, int y, int z, ForgeDirection side, int[] inputValues);
/**
* Called when the input value to this block changes. Only called if your block is connected in "Single" mode.
* Do not issue a network value update from inside this method call; it will be ignored. Issue your updates
* on the next tick.
* @param world The world this block is in.
* @param x This block's X coordinate.
* @param y This block's Y coordinate.
* @param z This block's Z coordinate.
* @param side The side the input values are being changed on.
* @param inputValue The new input value
*/
public void onInputChanged (World world, int x, int y, int z, ForgeDirection side, int inputValue);
}
@@ -0,0 +1,22 @@
package powercrystals.minefactoryreloaded.api.rednet;
import net.minecraft.nbt.NBTTagCompound;
public interface IRedNetLogicCircuit
{
public int getInputCount ();
public int getOutputCount ();
public int[] recalculateOutputValues (long worldTime, int[] inputValues);
public String getUnlocalizedName ();
public String getInputPinLabel (int pin);
public String getOutputPinLabel (int pin);
public void readFromNBT (NBTTagCompound tag);
public void writeToNBT (NBTTagCompound tag);
}
@@ -0,0 +1,31 @@
package powercrystals.minefactoryreloaded.api.rednet;
import net.minecraft.world.World;
/**
*
* You should not implement this yourself. Instead, use this to look for cables to notify from your IConnectableRedNet as this does not
* require a block update. This will be implemented on the cable's Block class.
*
*/
public interface IRedNetNetworkContainer
{
/**
* Tells the network to recalculate all subnets.
* @param world The world this cable is in.
* @param x The x-coordinate of this cable.
* @param x The y-coordinate of this cable.
* @param x The z-coordinate of this cable.
*/
public void updateNetwork (World world, int x, int y, int z);
/**
* Tells the network to recalculate a specific subnet.
* @param world The world this cable is in.
* @param x The x-coordinate of this cable.
* @param x The y-coordinate of this cable.
* @param x The z-coordinate of this cable.
* @param subnet The subnet to recalculate.
*/
public void updateNetwork (World world, int x, int y, int z, int subnet);
}
@@ -0,0 +1,6 @@
package powercrystals.minefactoryreloaded.api.rednet;
public interface IRedNetNoConnection
{
}
@@ -0,0 +1,65 @@
package powercrystals.minefactoryreloaded.api.rednet;
import java.util.HashMap;
import java.util.Map;
/**
* Defines how RedNet cable connects to a block
*
* None: RedNet will never connect to this block (if this is all you want: use IRedNetNoConnection)
*
* CableSingle: Connections will use the cable renderer with a single band, best used for whole blocks
* PlateSingle: Connections will use the plate renderer with a single band, used for conveyers and rails
*
* CableAll: Connections permit access to all 16 bands
* PlateAll: Connections permit access to all 16 bands
*
* Forced connection modes are best used for decoration blocks: RedNet will not connect normally, but will if the user forces it
*
* ForcedCableSingle: Connections permit access to a single band only when the cable is in forced connection mode
* ForcedPlateSingle: Connections permit access to a single band only when the cable is in forced connection mode
*
* ForcedCableAll: Connections permit access to all 16 bands only when the cable is in forced connection mode
* ForcedPlateAll: Connections permit access to all 16 bands only when the cable is in forced connection mode
*/
public enum RedNetConnectionType
{
None, // 0
CableSingle, // 11
PlateSingle, // 13
CableAll, // 19
PlateAll, // 21
ForcedCableSingle, // 43
ForcedPlateSingle, // 45
ForcedCableAll, // 51
ForcedPlateAll; // 53
public final boolean isConnected = this.ordinal() != 0;
public final boolean isSingleSubnet = this.name().endsWith("Single");
public final boolean isAllSubnets = this.name().endsWith("All");
public final boolean isConnectionForced = this.name().startsWith("Forced");
public final boolean isPlate = this.name().contains("Plate");
public final boolean isCable = this.name().contains("Cable");
public final short flags = toFlags(isConnected, isCable, isPlate, isSingleSubnet, isAllSubnets, isConnectionForced);
public static final RedNetConnectionType fromFlags (short flags)
{
return connections.get(flags);
}
private static final short toFlags (boolean... flags)
{
short ret = 0;
for (int i = flags.length; i-- > 0;)
ret |= (flags[i] ? 1 : 0) << i;
return ret;
}
private static final Map<Short, RedNetConnectionType> connections = new HashMap<Short, RedNetConnectionType>();
static
{
for (RedNetConnectionType type : RedNetConnectionType.values())
connections.put(type.flags, type);
}
}