Skip to content

Commit

Permalink
Version 1.2.0.0 API
Browse files Browse the repository at this point in the history
This version is used for the Big Update release that gets relesed soon
after this.
-Changed: Name for ReactorPlanner components
-Changed: instead of Integer i use NBTPrimals thats easier to use
differend types of numbers
-Added: Default Tag so you do not have to use a Special Created Inttag
or something.
-Added: ISpecailWrenchable allows you todo a Special Action on a side
before removing happens. (Note: My WrenchPlugin will support that with
its next version which i will work on soon)
-Added: IReactorProduct. Simply for items that can stay but should be
extracted like Depleted Uranium Cells.. IC2 did not had a API for
something like that. I wonder how greg solved that in GregTech....
-Added: INetworkFieldData if you want to sync a field that is not
implemented by IC2 Classic itself you can make a container to sync it by
yourself. Note: It will not create a new instance of that field it
accesses that field and syncs the data inside of that... So be sure that
the field will be never null.
-IReactorPlannerComponent is simply the class to Support the
ReactorPlanner from IC2 Classic. It has Passive Check and a Active
check. But you can decide which requires a active check.
  • Loading branch information
Speiger committed Apr 3, 2016
1 parent 69f43c5 commit 6926313
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 76 deletions.
33 changes: 33 additions & 0 deletions src/main/java/ic2/api/network/INetworkFieldData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ic2.api.network;

import java.io.DataInput;
import java.io.DataOutput;

/**
*
* @author Speiger
* IC2 Classic only
*/
public interface INetworkFieldData
{
/**
* Instead of being limited by a System that IC2 Provide i thought how could
* i expand it modular without much work and also not much by way of
* complexity. This is the Result. INetworkFieldData
* This class is implemented by any classField that you want to sync.
* What this will cause then is simple. It will call these functions and allow you to sync indirectly stuff.
* Note: When a field class implements this it will be not sync normally.
* And it will be not replaced. Field has to be always there and not a Null!
* But it will still be calling the Function in the INetworkUpdateListener with the field name
*/

/**
* Read function. Please make sure you do not read more data then necessary.
*/
public void read(DataInput stream);

/**
* Write Function.
*/
public void write(DataOutput stream);
}
135 changes: 135 additions & 0 deletions src/main/java/ic2/api/reactor/IReactorPlannerComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package ic2.api.reactor;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase.NBTPrimitive;
import net.minecraft.nbt.NBTTagInt;

public interface IReactorPlannerComponent extends IReactorComponent
{
/**
* Null Tag for states so you do not need to create something differed
*/
public static NBTPrimitive nulltag = new NBTNull();
/**
* This function is there if a item has more then 1 ReactorPart
* return all parts here if hasSubParts is true.
* @return all Reactor Parts (creative/new Crafted)
* Info: NO NBT Support on the Comparing.
* The Reactor States get Cached as Item&Meta so NBT is not for SubTypes
*/
public ItemStack[] getSubParts();

/**
* @return true if the Item has more then one part.
* If true then it skips the getReactorPart so if true return all,
* on the getSubParts function
*/
public boolean hasSubParts();

/**
* @return the Reactor part created Creatively.
*/
public ItemStack getReactorPart();

/**
* This function is for a simple ID system which reduce the data amount in the NBTData
* Its only used for Coping&Pasting Setups for clip board.
* Please use static numbers that never change.
* ID0-200 Is bound to IC2 Classic.
* As same as the ComponentStates these do not support NBTData for Types
* @param stack YourItem
* @return the ID
*/
public short getID(ItemStack stack);

/**
* @return the Reactor Part type so the Reactor Planner knows how to handle it.
*/
public ReactorComponentType getType(ItemStack par1);

/**
* Based on the ReactorPart Type you return the Planner wants to know some stats,
* which are important for the calculation.
* @return the State based on the Item and the State it requests.
*/
public NBTPrimitive getReactorStat(ReactorComponentStat par1, ItemStack par2);

/**
* This function is there to say if a state needs a reactor for more detailed info.
* Note: This function is only called if the item is in the grid of the reactorPlanner.
* @param par1 The state which is requested
* @param par2 The Item.
* @return If the state has differed when in a grid.
*/
public boolean isAdvancedStat(ReactorComponentStat par1, ItemStack par2);

/**
* This function is for advanced/grid information about the state.
* Note: This function will be called separate from the original getReactorStat.
* So support both when you create the support.
* @param par1: The Reactor
* @param x: xCoord of your Item in the Reactor
* @param y: yCoord of your Item in the Reactor
* @param item: yourItem
* @param stat: The Requested State.
* @return the result of the state
*/
public NBTPrimitive getReactorStat(IReactor par1, int x, int y, ItemStack item, ReactorComponentStat stat);

/**
* Important Info. If a Type has a MaxDurabilty State
* it has to show the durability in the getDamage function
* simply because its used in the ReactorPlanner
*/


public static enum ReactorComponentType
{
FuelRod(ReactorComponentStat.HeatProduction, ReactorComponentStat.EnergyProduction, ReactorComponentStat.MaxDurability, ReactorComponentStat.ReactorEEM),
CoolantCell(ReactorComponentStat.HeatStorage),
Conensator(ReactorComponentStat.HeatStorage),
HeatPack(ReactorComponentStat.HeatProduction),
Vent(ReactorComponentStat.SelfCooling, ReactorComponentStat.ReactorCooling),
VentSpread(ReactorComponentStat.PartCooling, ReactorComponentStat.ReactorCooling),
HeatSwitch(ReactorComponentStat.ReactorChange, ReactorComponentStat.PartChange),
Plating(ReactorComponentStat.ReactorMaxHeat, ReactorComponentStat.ReactorEEM),
Reflection(ReactorComponentStat.EnergyProduction, ReactorComponentStat.MaxDurability),
IsotopeCell(ReactorComponentStat.MaxDurability, ReactorComponentStat.ReactorEEM);

ReactorComponentStat[] parts;

private ReactorComponentType(ReactorComponentStat...par1)
{
parts = par1;
}

public ReactorComponentStat[] getStats()
{
return parts;
}
}

public static enum ReactorComponentStat
{
HeatProduction,
EnergyProduction,
SelfCooling,
PartCooling,
ReactorCooling,
PartChange,
ReactorChange,
HeatStorage,
ReactorMaxHeat,
ReactorEEM,
MaxDurability;

}

public static class NBTNull extends NBTTagInt
{
public NBTNull()
{
super(0);
}
}
}
76 changes: 0 additions & 76 deletions src/main/java/ic2/api/reactor/IReactorPlannerPart.java

This file was deleted.

8 changes: 8 additions & 0 deletions src/main/java/ic2/api/reactor/IReactorProduct.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ic2.api.reactor;

import net.minecraft.item.ItemStack;

public interface IReactorProduct
{
public boolean isProduct(ItemStack item);
}
10 changes: 10 additions & 0 deletions src/main/java/ic2/api/tile/ISpecialWrenchable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ic2.api.tile;

import net.minecraft.entity.player.EntityPlayer;

public interface ISpecialWrenchable extends IWrenchable
{
public boolean canDoSpecial(EntityPlayer player, int side);

public boolean doSpecial(EntityPlayer player, int side);
}

0 comments on commit 6926313

Please sign in to comment.