mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-19 19:49:50 +00:00
Galacticraft and MFR API Optional-ing
This commit is contained in:
1 parent
8ddda5d0dc
commit
26463711de
8 files changed
+53
-11
No files matched your search
@@ -0,0 +1,25 @@
|
||||
A note to anyone looking to use this API:
|
||||
This API should now be fairly stable and usable. You can use prefabs and core API classes to create your own galaxies.
|
||||
|
||||
Please avoid including interfaces where possible...
|
||||
|
||||
If you are creating your own addon you should be relying on Galacticraft:
|
||||
|
||||
Use the following steps to allow Galacticraft compilation:
|
||||
1. Download the dev-deobf (deobfuscated development) version of Galacticraft.
|
||||
2. Place the jar file somewhere in your workspace, remember the location.
|
||||
3. In eclipse, right click on your project, click properties->Java Build Path->Libraries->Add External Jars and select the dev jar.
|
||||
4. Galacticraft will now compile properly.
|
||||
|
||||
You can also download the source from github "https://github.com/micdoodle8" and add it to your development source.
|
||||
|
||||
Release your addon without any API classes or prefabs. Users with Galacticraft installed will experience no issues.
|
||||
|
||||
If you are implementing a few classes for compatibility, or checking inheritance:
|
||||
|
||||
Try to use java reflection where performance is not mandatory. Google is your friend for learning reflection.
|
||||
|
||||
Create multiple versions of a class implementing one of my interfaces. Check if Galacticraft is installed and invoke the appropriate class.
|
||||
Crashes will only occur if you reference a class with a missing interface, so call the correct one and you won't have issues.
|
||||
|
||||
If you must include interfaces, only include the ones you need and check for updates.
|
||||
@@ -0,0 +1,13 @@
|
||||
package micdoodle8.mods.galacticraft.api.entity;
|
||||
|
||||
/**
|
||||
* Implement into entities that are living, but can breath without oxygen
|
||||
*/
|
||||
public interface IEntityBreathable
|
||||
{
|
||||
/**
|
||||
* Whether or not this entity can currently breathe without oxygen in it's
|
||||
* vicinity
|
||||
*/
|
||||
public boolean canBreath();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API")
|
||||
package micdoodle8.mods.galacticraft.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package micdoodle8.mods.galacticraft.api.world;
|
||||
|
||||
/**
|
||||
* Used to change the solar multiplier of certain world providers
|
||||
*
|
||||
* If you have a solar feature in your mod, check whether the world's provider
|
||||
* inherits this class and multiply the solar generation by the solar multiplier
|
||||
* double
|
||||
*
|
||||
* for example:
|
||||
*
|
||||
* if (worldObj.provider instanceof ISolarLevel) solarStrength *= ((ISolarLevel)
|
||||
* worldObj.provider).getSolarEnergyMultiplier();
|
||||
*/
|
||||
public interface ISolarLevel
|
||||
{
|
||||
public double getSolarEnergyMultiplier();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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(). May have a stackSize of 0 (indicating locked contents).
|
||||
*/
|
||||
ItemStack getStoredItemType();
|
||||
|
||||
/**
|
||||
* Sets the total amount of the item currently being stored, or zero if all items are to be removed.
|
||||
*/
|
||||
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.
|
||||
* May change based on the current type stored.
|
||||
*/
|
||||
int getMaxStoredCount();
|
||||
}
|
||||
Reference in new issue
Block a user