update energy API, Gradle wrapper version
This commit is contained in:
parent
9bfc13031b
commit
c09be6f465
|
@ -6,6 +6,6 @@ public class CoFHAPIProps {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String VERSION = "1.7.10R1.0.2";
|
public static final String VERSION = "1.7.10R1.3.1";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||||
*
|
*
|
||||||
* @author King Lemming
|
* @author King Lemming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EnergyStorage implements IEnergyStorage {
|
public class EnergyStorage implements IEnergyStorage {
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class EnergyStorage implements IEnergyStorage {
|
||||||
/**
|
/**
|
||||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
|
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
|
||||||
* are guaranteed to have it.
|
* are guaranteed to have it.
|
||||||
*
|
*
|
||||||
* @param energy
|
* @param energy
|
||||||
*/
|
*/
|
||||||
public void setEnergyStored(int energy) {
|
public void setEnergyStored(int energy) {
|
||||||
|
@ -106,7 +106,7 @@ public class EnergyStorage implements IEnergyStorage {
|
||||||
/**
|
/**
|
||||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||||
*
|
*
|
||||||
* @param energy
|
* @param energy
|
||||||
*/
|
*/
|
||||||
public void modifyEnergyStored(int energy) {
|
public void modifyEnergyStored(int energy) {
|
||||||
|
|
|
@ -7,9 +7,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
* accept it; otherwise just use IEnergyHandler.
|
* accept it; otherwise just use IEnergyHandler.
|
||||||
* <p>
|
* <p>
|
||||||
* Note that {@link IEnergyHandler} is an extension of this.
|
* Note that {@link IEnergyHandler} is an extension of this.
|
||||||
*
|
*
|
||||||
* @author King Lemming
|
* @author King Lemming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IEnergyConnection {
|
public interface IEnergyConnection {
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack;
|
||||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||||
* <p>
|
* <p>
|
||||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||||
*
|
*
|
||||||
* @author King Lemming
|
* @author King Lemming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IEnergyContainerItem {
|
public interface IEnergyContainerItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||||
*
|
*
|
||||||
* @param container
|
* @param container
|
||||||
* ItemStack to be charged.
|
* ItemStack to be charged.
|
||||||
* @param maxReceive
|
* @param maxReceive
|
||||||
|
@ -28,7 +28,7 @@ public interface IEnergyContainerItem {
|
||||||
/**
|
/**
|
||||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||||
* discharged.
|
* discharged.
|
||||||
*
|
*
|
||||||
* @param container
|
* @param container
|
||||||
* ItemStack to be discharged.
|
* ItemStack to be discharged.
|
||||||
* @param maxExtract
|
* @param maxExtract
|
||||||
|
|
|
@ -42,7 +42,6 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
||||||
@Override
|
@Override
|
||||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of energy currently stored.
|
* Returns the amount of energy currently stored.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,15 +5,15 @@ package cofh.api.energy;
|
||||||
* This is not to be implemented on TileEntities. This is for internal use only.
|
* This is not to be implemented on TileEntities. This is for internal use only.
|
||||||
* <p>
|
* <p>
|
||||||
* A reference implementation can be found at {@link EnergyStorage}.
|
* A reference implementation can be found at {@link EnergyStorage}.
|
||||||
*
|
*
|
||||||
* @author King Lemming
|
* @author King Lemming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IEnergyStorage {
|
public interface IEnergyStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||||
*
|
*
|
||||||
* @param maxReceive
|
* @param maxReceive
|
||||||
* Maximum amount of energy to be inserted.
|
* Maximum amount of energy to be inserted.
|
||||||
* @param simulate
|
* @param simulate
|
||||||
|
@ -24,7 +24,7 @@ public interface IEnergyStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||||
*
|
*
|
||||||
* @param maxExtract
|
* @param maxExtract
|
||||||
* Maximum amount of energy to be extracted.
|
* Maximum amount of energy to be extracted.
|
||||||
* @param simulate
|
* @param simulate
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
package cofh.api.energy;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement this interface on Tile Entities which transport energy.
|
||||||
|
* <p>
|
||||||
|
* This is used to "negotiate" connection types between two separate IEnergyTransports, allowing users to set flow direction and allowing for networks Of
|
||||||
|
* IEnergyTransports to intelligently transfer energy to other networks.
|
||||||
|
*/
|
||||||
|
public interface IEnergyTransport extends IEnergyProvider, IEnergyReceiver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of interface for a given side of a {@link IEnergyTransport}.
|
||||||
|
* <p>
|
||||||
|
* Values are:<br>
|
||||||
|
* {@link SEND} for sending only<br>
|
||||||
|
* {@link RECEIVE} for receiving only<br>
|
||||||
|
* {@link BALANCE} for sending and receiving, and the default state
|
||||||
|
*/
|
||||||
|
public enum InterfaceType {
|
||||||
|
/**
|
||||||
|
* Indicates that this {@link IEnergyTransport} is only sending power on this side.
|
||||||
|
*/
|
||||||
|
SEND,
|
||||||
|
/**
|
||||||
|
* Indicates that this {@link IEnergyTransport} is only receiving power on this side.
|
||||||
|
*/
|
||||||
|
RECEIVE,
|
||||||
|
/**
|
||||||
|
* Indicates that this {@link IEnergyTransport} wants to balance power between itself and the
|
||||||
|
* senders/receivers on this side. This is the default state.<br>
|
||||||
|
* To block any connection, use {@link IEnergyConnection#canConnectEnergy}
|
||||||
|
* <p>
|
||||||
|
* IEnergyTransport based senders should check that the total power in the destination IEnergyTransport is less than the power in themselves before sending.
|
||||||
|
* <br>
|
||||||
|
* Active IEnergyTransport receivers (i.e., those that call {@link IEnergyProvider#extractEnergy}) should check that they contain less power than the
|
||||||
|
* source IEnergyTransport.
|
||||||
|
*/
|
||||||
|
BALANCE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the opposite state to this InterfaceType.
|
||||||
|
* <p>
|
||||||
|
* {@link #BALANCE} is considered its own opposite.<br>
|
||||||
|
* {@link #SEND} is the opposite of {@link #RECEIVE} and visa versa.
|
||||||
|
*/
|
||||||
|
public InterfaceType getOpposite() {
|
||||||
|
|
||||||
|
return this == BALANCE ? BALANCE : this == SEND ? RECEIVE : SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState}
|
||||||
|
*/
|
||||||
|
public InterfaceType rotate() {
|
||||||
|
|
||||||
|
return rotate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState}
|
||||||
|
*
|
||||||
|
* @param forward
|
||||||
|
* Whether to step in the order specified by {@link IEnergyTransport#getTransportState} (<tt>true</tt>) or to step in the opposite direction
|
||||||
|
*/
|
||||||
|
public InterfaceType rotate(boolean forward) {
|
||||||
|
|
||||||
|
if (forward) {
|
||||||
|
return this == BALANCE ? RECEIVE : this == RECEIVE ? SEND : BALANCE;
|
||||||
|
} else {
|
||||||
|
return this == BALANCE ? SEND : this == SEND ? RECEIVE : BALANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}<br>
|
||||||
|
* This method <b>cannot</b> be a no-op for IEnergyTransport.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
int getEnergyStored(ForgeDirection from);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates to other IEnergyTransports the state of the given side. See {@link #InterfaceType} for details.
|
||||||
|
* <p>
|
||||||
|
* For clarity of state tracking, on a tile update from another IEnergyTransport, if its mode has changed from the opposite of your own mode on that side, you
|
||||||
|
* should change your mode to the opposite of its mode.
|
||||||
|
* <p>
|
||||||
|
* When the user alters your mode and your state is:<br>
|
||||||
|
* BALANCE, your mode should change to {@link InterFaceType#RECEIVE}.<br>
|
||||||
|
* RECEIVE, your mode should change to {@link InterFaceType#SEND}.<br>
|
||||||
|
* SEND, your mode should change to {@link InterFaceType#BALANCE}.<br>
|
||||||
|
* This is not required, but will be easier for users.
|
||||||
|
*
|
||||||
|
* @return The type of connection to establish on this side. <b>null is NOT a valid value</b>
|
||||||
|
*/
|
||||||
|
InterfaceType getTransportState(ForgeDirection from);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is provided primarily for the purposes of automation tools, and should not need to be called by another IEnergyTransport.
|
||||||
|
* <p>
|
||||||
|
* Calls to this method may fail if this IEnergyTransport has been secured by a user.
|
||||||
|
*
|
||||||
|
* @return Whether or not state was successfully altered.
|
||||||
|
*/
|
||||||
|
boolean setTransportState(InterfaceType state, ForgeDirection from);
|
||||||
|
|
||||||
|
}
|
|
@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||||
*
|
*
|
||||||
* @author King Lemming
|
* @author King Lemming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* (C) 2015 Team CoFH / CoFH / Cult of the Full Hub
|
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||||
* http://www.teamcofh.com
|
* http://www.teamcofh.com
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
||||||
package cofh.api.energy;
|
package cofh.api.energy;
|
||||||
|
|
||||||
|
import cofh.api.CoFHAPIProps;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
||||||
|
|
||||||
import cofh.api.CoFHAPIProps;
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* (C) 2015 Team CoFH / CoFH / Cult of the Full Hub
|
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||||
* http://www.teamcofh.com
|
* http://www.teamcofh.com
|
||||||
*/
|
*/
|
||||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
|
||||||
|
|
Loading…
Reference in New Issue