mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 23:13:21 +00:00
Move sources and resources. Strip copied dependencies
This commit is contained in:
1 parent
62766cf221
commit
63fd5597fe
1400 files changed
+4
-32810
No files matched your search
@@ -1,11 +0,0 @@
|
||||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.7.10R1.0.13";
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is
|
||||
* server-safe and doesn't use client-side code.
|
||||
*
|
||||
*/
|
||||
public interface IBlockAppearance {
|
||||
|
||||
/**
|
||||
* This function returns the block that is being shown on a given side.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
*/
|
||||
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
|
||||
/**
|
||||
* This function returns metadata of the block that is being shown on a given side.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
*/
|
||||
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
|
||||
/**
|
||||
* This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance.
|
||||
*/
|
||||
public boolean supportsVisualConnections();
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which have a GUI that needs a tool (e.g., multimeter) to open.
|
||||
*
|
||||
*/
|
||||
public interface IBlockConfigGui {
|
||||
|
||||
/**
|
||||
* This function will open a GUI if the player has permission.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
* @param player
|
||||
* Player doing the configuring.
|
||||
* @return True if the GUI was opened.
|
||||
*/
|
||||
public boolean openConfigGui(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which have some debug method which can be activated via a tool or other means.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockDebug {
|
||||
|
||||
/**
|
||||
* This function debugs a block.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block.
|
||||
* @param player
|
||||
* Player doing the debugging.
|
||||
*/
|
||||
void debugBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player);
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import cofh.api.tileentity.ITileInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on blocks which can provide information about themselves. If the block contains Tile Entities, then it is recommended that this
|
||||
* function serve as a passthrough for {@link ITileInfo}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IBlockInfo {
|
||||
|
||||
/**
|
||||
* This function appends information to a list provided to it.
|
||||
*
|
||||
* @param world
|
||||
* Reference to the world.
|
||||
* @param x
|
||||
* X coordinate of the block.
|
||||
* @param y
|
||||
* Y coordinate of the block.
|
||||
* @param z
|
||||
* Z coordinate of the block.
|
||||
* @param side
|
||||
* The side of the block that is being queried.
|
||||
* @param player
|
||||
* Player doing the querying - this can be NULL.
|
||||
* @param info
|
||||
* The list that the information should be appended to.
|
||||
* @param debug
|
||||
* If true, the block should return "debug" information.
|
||||
*/
|
||||
void getBlockInfo(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player, List<IChatComponent> info, boolean debug);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package cofh.api.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implemented on Blocks which have some method of being instantly dismantled.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IDismantleable {
|
||||
|
||||
/**
|
||||
* Dismantles the block. If returnDrops is true, the drop(s) should be placed into the player's inventory.
|
||||
*/
|
||||
ArrayList<ItemStack> dismantleBlock(EntityPlayer player, World world, int x, int y, int z, boolean returnDrops);
|
||||
|
||||
/**
|
||||
* Return true if the block can be dismantled. The criteria for this is entirely up to the block.
|
||||
*/
|
||||
boolean canDismantle(EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|block")
|
||||
package cofh.api.block;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
* accept it; otherwise just use IEnergyHandler.
|
||||
* <p>
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @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 a container 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 container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
||||
|
||||
// merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
@Override
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
@Override
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
@Override
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
@Override
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyProvider extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyReceiver extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.<br>
|
||||
* This is not to be implemented on TileEntities. This is for internal use only.
|
||||
* <p>
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
||||
|
||||
protected EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
}
|
||||
|
||||
/* IEnergyConnection */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IEnergyReceiver */
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyProvider */
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyReceiver and IEnergyProvider */
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
||||
package cofh.api.energy;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package cofh.api.inventory;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to item transportation blocks.
|
||||
*/
|
||||
public interface IInventoryConnection {
|
||||
|
||||
/**
|
||||
* @param from
|
||||
* Side to which a connector would connect
|
||||
* @return DEFAULT if the connector should decide how to connect; FORCE if the connector should always connect; DENY if the connector should never connect.
|
||||
*/
|
||||
public ConnectionType canConnectInventory(ForgeDirection from);
|
||||
|
||||
public static enum ConnectionType {
|
||||
DEFAULT, FORCE, DENY;
|
||||
|
||||
public final boolean canConnect = ordinal() != 2;
|
||||
public final boolean forceConnect = ordinal() == 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package cofh.api.inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should handle items.
|
||||
*
|
||||
* A reference implementation is provided {@link TileInventoryHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryHandler extends IInventoryConnection {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns what is remaining of the
|
||||
* original stack - a null return means that the entire stack was accepted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @param simulate
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted (or would have been, if simulated) into the container inventory.
|
||||
*/
|
||||
ItemStack insertItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param item
|
||||
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
|
||||
* immediately be returned.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, ItemStack item, boolean simulate);
|
||||
|
||||
/**
|
||||
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
|
||||
* null return means that nothing was extracted!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum number of items to extract. (The returned ItemStack should have a stackSize no higher than this.)
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
|
||||
*/
|
||||
ItemStack extractItem(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the contents of the IInventoryHandler's inventory. This returns a COPY. This should only return non-null ItemStacks, and an empty List if the
|
||||
* inventory has nothing.
|
||||
*/
|
||||
List<ItemStack> getInventoryContents(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Get the size (number of internal slots) of the IInventoryHandler's inventory.
|
||||
*/
|
||||
int getSizeInventory(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is empty (for a given side).
|
||||
*/
|
||||
boolean isEmpty(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns whether or not the IInventoryHandler's inventory is full (for a given side).
|
||||
*/
|
||||
boolean isFull(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package cofh.api.inventory;
|
||||
|
||||
/**
|
||||
* Marks a block which will retain its inventory when broken.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryRetainer {
|
||||
|
||||
// There's nothing else to go here at the moment. Potentially a conditional at a later date.
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|inventory")
|
||||
package cofh.api.inventory;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAugmentItem {
|
||||
|
||||
/**
|
||||
* Get the augmentation level for a given Augment and Augment Type.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack representing the Augment.
|
||||
* @param type
|
||||
* String containing the Augment type name.
|
||||
* @return The Augment level of the stack for the requested type - 0 if it does not affect that attribute.
|
||||
*/
|
||||
int getAugmentLevel(ItemStack stack, String type);
|
||||
|
||||
/**
|
||||
* Get the Augment Types for a given Augment. Set ensure that there are no duplicates.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack representing the Augment.
|
||||
* @return Set of the Augmentation Types. Should return an empty set if there are none (but this would be really stupid to make). DO NOT RETURN NULL.
|
||||
*/
|
||||
Set<String> getAugmentTypes(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with
|
||||
* them.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEmpowerableItem {
|
||||
|
||||
/**
|
||||
* Check whether or not a given item is currently in an empowered state.
|
||||
*/
|
||||
boolean isEmpowered(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Attempt to set the empowered state of the item.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack to be empowered/disempowered.
|
||||
* @param state
|
||||
* Desired state.
|
||||
* @return TRUE if the operation was successful, FALSE if it was not.
|
||||
*/
|
||||
boolean setEmpoweredState(ItemStack stack, boolean state);
|
||||
|
||||
/**
|
||||
* Callback method for reacting to a state change. Useful in KeyBinding handlers.
|
||||
*
|
||||
* @param player
|
||||
* Player holding the item, if applicable.
|
||||
* @param stack
|
||||
* The item being held.
|
||||
*/
|
||||
void onStateChange(EntityPlayer player, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes that are themselves inventories.
|
||||
*
|
||||
* A reference implementation is provided {@link ItemInventoryContainer}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IInventoryContainerItem {
|
||||
|
||||
/**
|
||||
* Get the size of this inventory of this container item.
|
||||
*/
|
||||
int getSizeInventory(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with
|
||||
* them.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IMultiModeItem {
|
||||
|
||||
/**
|
||||
* Get the current mode of an item.
|
||||
*/
|
||||
int getMode(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Attempt to set the empowered state of the item.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack to set the mode on.
|
||||
* @param mode
|
||||
* Desired mode.
|
||||
* @return TRUE if the operation was successful, FALSE if it was not.
|
||||
*/
|
||||
boolean setMode(ItemStack stack, int mode);
|
||||
|
||||
/**
|
||||
* Increment the current mode of an item.
|
||||
*/
|
||||
boolean incrMode(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Decrement the current mode of an item.
|
||||
*/
|
||||
boolean decrMode(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns the number of possible modes.
|
||||
*/
|
||||
int getNumModes(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Callback method for reacting to a state change. Useful in KeyBinding handlers.
|
||||
*
|
||||
* @param player
|
||||
* Player holding the item, if applicable.
|
||||
* @param stack
|
||||
* The item being held.
|
||||
*/
|
||||
void onModeChange(EntityPlayer player, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on subclasses of Item to change how the item works in Thermal Dynamics Fluiducts filter slots.
|
||||
*
|
||||
* This can be used to create customizable Items which are determined to be "equal" for the purposes of filtering.
|
||||
*/
|
||||
public interface ISpecialFilterFluid {
|
||||
|
||||
/**
|
||||
* This method is called to find out if the given FluidStack should be matched by the given Filter ItemStack.
|
||||
*
|
||||
* @param filter
|
||||
* ItemStack representing the filter.
|
||||
* @param fluid
|
||||
* FluidStack representing the queried fluid.
|
||||
* @return True if the filter should match the FluidStack. False if the default matching should be used.
|
||||
*/
|
||||
public boolean matchesFluid(ItemStack filter, FluidStack fluid);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on subclasses of Item to change how the item works in Thermal Dynamics Itemducts filter slots.
|
||||
*
|
||||
* This can be used to create customizable Items which are determined to be "equal" for the purposes of filtering.
|
||||
*/
|
||||
public interface ISpecialFilterItem {
|
||||
|
||||
/**
|
||||
* This method is called to find out if the given ItemStack should be matched by the given Filter ItemStack.
|
||||
*
|
||||
* @param filter
|
||||
* ItemStack representing the filter.
|
||||
* @param item
|
||||
* ItemStack representing the queried item.
|
||||
* @return True if the filter should match. False if the default matching should be used.
|
||||
*/
|
||||
public boolean matchesItem(ItemStack filter, ItemStack item);
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on subclasses of Item to have that item work as a tool for CoFH mods.
|
||||
*/
|
||||
public interface IToolHammer {
|
||||
|
||||
/**
|
||||
* Called to ensure that the wrench can be used.
|
||||
*
|
||||
* @param item
|
||||
* The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
|
||||
* @param user
|
||||
* The entity using the tool
|
||||
* @param x
|
||||
* X location of the block/tile
|
||||
* @param y
|
||||
* Y location of the block/tile
|
||||
* @param z
|
||||
* Z location of the block/tile
|
||||
* @return True if this tool can be used
|
||||
*/
|
||||
boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Callback for when the tool has been used reactively.
|
||||
*
|
||||
* @param item
|
||||
* The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
|
||||
* @param user
|
||||
* The entity using the tool
|
||||
* @param x
|
||||
* X location of the block/tile
|
||||
* @param y
|
||||
* Y location of the block/tile
|
||||
* @param z
|
||||
* Z location of the block/tile
|
||||
*/
|
||||
void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|item")
|
||||
package cofh.api.item;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implemented on objects which support Augments.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IAugmentable {
|
||||
|
||||
/**
|
||||
* Attempt to reconfigure the tile based on the Augmentations present.
|
||||
*/
|
||||
void installAugments();
|
||||
|
||||
/**
|
||||
* Returns an array of the Augment slots for this Tile Entity.
|
||||
*/
|
||||
ItemStack[] getAugmentSlots();
|
||||
|
||||
/**
|
||||
* Returns a status array for the Augmentations installed in the Tile Entity.
|
||||
*/
|
||||
boolean[] getAugmentStatus();
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on objects which can report information about their energy usage.
|
||||
*
|
||||
* This is used for reporting purposes - Energy transactions are handled through IEnergyHandler!
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyInfo {
|
||||
|
||||
/**
|
||||
* Returns energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
int getInfoEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns maximum energy usage/generation per tick (RF/t).
|
||||
*/
|
||||
int getInfoMaxEnergyPerTick();
|
||||
|
||||
/**
|
||||
* Returns energy stored (RF).
|
||||
*/
|
||||
int getInfoEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns maximum energy stored (RF).
|
||||
*/
|
||||
int getInfoMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can write a limited amount of data about themselves.
|
||||
*
|
||||
* This is typically for the purposes of being transferred to a similar tile entity.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IPortableData {
|
||||
|
||||
/**
|
||||
* Data identifier of the Tile Entity/Block. Used for display as well as verification purposes. Tiles with completely interchangeable data should return the
|
||||
* same type.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getDataType();
|
||||
|
||||
/**
|
||||
* Read the data from a tag. The player object exists because this should always be called via player interaction!
|
||||
*/
|
||||
void readPortableData(EntityPlayer player, NBTTagCompound tag);
|
||||
|
||||
/**
|
||||
* Write the data to a tag. The player object exists because this should always be called via player interaction!
|
||||
*/
|
||||
void writePortableData(EntityPlayer player, NBTTagCompound tag);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their facing.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableFacing {
|
||||
|
||||
/**
|
||||
* Returns the current facing of the block.
|
||||
*/
|
||||
int getFacing();
|
||||
|
||||
/**
|
||||
* Returns whether or not the block's face can be aligned with the Y Axis.
|
||||
*/
|
||||
boolean allowYAxisFacing();
|
||||
|
||||
/**
|
||||
* Attempt to rotate the block. Arbitrary based on implementation.
|
||||
*
|
||||
* @return True if rotation was successful, false otherwise.
|
||||
*/
|
||||
boolean rotateBlock();
|
||||
|
||||
/**
|
||||
* Set the facing of the block.
|
||||
*
|
||||
* @param side
|
||||
* The side to set the facing to.
|
||||
* @return True if the facing was set, false otherwise.
|
||||
*/
|
||||
boolean setFacing(int side);
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which allow for reconfiguration of their sides.
|
||||
*
|
||||
* Coordination with the containing block is required.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IReconfigurableSides {
|
||||
|
||||
/**
|
||||
* Decrement the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
boolean decrSide(int side);
|
||||
|
||||
/**
|
||||
* Increment the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to decrement.
|
||||
* @return True if config was changed, false otherwise.
|
||||
*/
|
||||
boolean incrSide(int side);
|
||||
|
||||
/**
|
||||
* Set the config for a given side.
|
||||
*
|
||||
* @param side
|
||||
* The side to set.
|
||||
* @param config
|
||||
* The config value to use.
|
||||
* @return True of config was set, false otherwise.
|
||||
*/
|
||||
boolean setSide(int side, int config);
|
||||
|
||||
/**
|
||||
* Reset configs on all sides to their base values.
|
||||
*
|
||||
* @return True if reset was successful, false otherwise.
|
||||
*/
|
||||
boolean resetSides();
|
||||
|
||||
/**
|
||||
* Returns the number of possible config settings for a given side.
|
||||
*/
|
||||
int getNumConfig(int side);
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which cache their redstone status.
|
||||
*
|
||||
* Note that {@link IRedstoneControl} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneCache {
|
||||
|
||||
void setPowered(boolean isPowered);
|
||||
|
||||
boolean isPowered();
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or
|
||||
* respond to a low or high redstone state.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IRedstoneControl extends IRedstoneCache {
|
||||
|
||||
public static enum ControlMode {
|
||||
DISABLED(true), LOW(false), HIGH(true);
|
||||
|
||||
private final boolean state;
|
||||
|
||||
private ControlMode(boolean state) {
|
||||
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
|
||||
return this == DISABLED;
|
||||
}
|
||||
|
||||
public boolean isLow() {
|
||||
|
||||
return this == LOW;
|
||||
}
|
||||
|
||||
public boolean isHigh() {
|
||||
|
||||
return this == HIGH;
|
||||
}
|
||||
|
||||
public boolean getState() {
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
public static ControlMode stepForward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? LOW : curControl == HIGH ? DISABLED : HIGH;
|
||||
}
|
||||
|
||||
public static ControlMode stepBackward(ControlMode curControl) {
|
||||
|
||||
return curControl == DISABLED ? HIGH : curControl == HIGH ? LOW : DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
void setControl(ControlMode control);
|
||||
|
||||
ControlMode getControl();
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can have access restrictions.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ISecurable {
|
||||
|
||||
/**
|
||||
* Enum for Access Modes - Restricted is Friends Only, Private is Owner only.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public static enum AccessMode {
|
||||
PUBLIC, RESTRICTED, PRIVATE;
|
||||
|
||||
public boolean isPublic() {
|
||||
|
||||
return this == PUBLIC;
|
||||
}
|
||||
|
||||
public boolean isRestricted() {
|
||||
|
||||
return this == RESTRICTED;
|
||||
}
|
||||
|
||||
public boolean isPrivate() {
|
||||
|
||||
return this == PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepForward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? RESTRICTED : curAccess == PRIVATE ? PUBLIC : PRIVATE;
|
||||
}
|
||||
|
||||
public static AccessMode stepBackward(AccessMode curAccess) {
|
||||
|
||||
return curAccess == PUBLIC ? PRIVATE : curAccess == PRIVATE ? RESTRICTED : PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
boolean setAccess(AccessMode access);
|
||||
|
||||
boolean setOwnerName(String name);
|
||||
|
||||
boolean setOwner(GameProfile name);
|
||||
|
||||
AccessMode getAccess();
|
||||
|
||||
String getOwnerName();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
boolean canPlayerAccess(EntityPlayer player);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile
|
||||
* Entity.
|
||||
*
|
||||
* @author Zeldo Kavira
|
||||
*
|
||||
*/
|
||||
public interface ISidedTexture {
|
||||
|
||||
/**
|
||||
* Returns the icon to use for a given side and render pass.
|
||||
*
|
||||
* @param side
|
||||
* Block side to get the texture for.
|
||||
* @param pass
|
||||
* Render pass.
|
||||
* @return The icon to use.
|
||||
*/
|
||||
IIcon getTexture(int side, int pass);
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which can provide information about themselves.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface ITileInfo {
|
||||
|
||||
/**
|
||||
* This function appends information to a list provided to it.
|
||||
*
|
||||
* @param info
|
||||
* The list that the information should be appended to.
|
||||
* @param side
|
||||
* The side of the block that is being queried.
|
||||
* @param player
|
||||
* Player doing the querying - this can be NULL.
|
||||
* @param debug
|
||||
* If true, the tile should return "debug" information.
|
||||
*/
|
||||
void getTileInfo(List<IChatComponent> info, ForgeDirection side, EntityPlayer player, boolean debug);
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|tileentity")
|
||||
package cofh.api.tileentity;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
interface IEnderAttuned {
|
||||
|
||||
public String getChannelString();
|
||||
|
||||
public int getFrequency();
|
||||
|
||||
public boolean setFrequency(int frequency);
|
||||
|
||||
public boolean clearFrequency();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
public interface IEnderDestination extends IEnderAttuned {
|
||||
|
||||
public boolean isNotValid();
|
||||
|
||||
public int x();
|
||||
|
||||
public int y();
|
||||
|
||||
public int z();
|
||||
|
||||
public int dimension();
|
||||
|
||||
public int getDestination();
|
||||
|
||||
public boolean setDestination(int frequency);
|
||||
|
||||
public boolean clearDestination();
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux).
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderEnergyHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send energy (Redstone Flux).
|
||||
*/
|
||||
boolean canSendEnergy();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive energy (Redstone Flux).
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveEnergy();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy
|
||||
* was received!
|
||||
*
|
||||
* @param energy
|
||||
* Amount of energy to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return Amount of energy that is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
int receiveEnergy(int energy, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Fluid.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderFluidHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send FluidStacks.
|
||||
*/
|
||||
boolean canSendFluid();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive a FluidStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveFluid();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* @param fluid
|
||||
* FluidStack to be received.
|
||||
* @param simulate
|
||||
* If TRUE, the result will only be simulated.
|
||||
* @return FluidStack representing how much fluid is remaining (or would be remaining, if simulated).
|
||||
*/
|
||||
FluidStack receiveFluid(FluidStack fluid, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is implemented on Ender Attuned objects which can receive Items.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnderItemHandler extends IEnderAttuned {
|
||||
|
||||
/**
|
||||
* Return whether or not the Ender Attuned object can currently send ItemStacks.
|
||||
*/
|
||||
boolean canSendItems();
|
||||
|
||||
/**
|
||||
* This should be checked to see if the Ender Attuned object can currently receive an ItemStack.
|
||||
*
|
||||
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
|
||||
*/
|
||||
boolean canReceiveItems();
|
||||
|
||||
/**
|
||||
* This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return
|
||||
* means that the entire stack was received!
|
||||
*
|
||||
* This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do
|
||||
* so.
|
||||
*
|
||||
* @param item
|
||||
* ItemStack to be received.
|
||||
* @return An ItemStack representing how much is remaining.
|
||||
*/
|
||||
ItemStack receiveItem(ItemStack item);
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point.
|
||||
*
|
||||
* @author Zeldo Kavira, King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IItemDuct {
|
||||
|
||||
/**
|
||||
* Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a
|
||||
* null return means that the entire stack was accepted/routed!
|
||||
*
|
||||
* @param from
|
||||
* Orientation the item is inserted from.
|
||||
* @param item
|
||||
* ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert.
|
||||
* @return An ItemStack representing how much is remaining after the item was inserted into the Duct.
|
||||
*/
|
||||
public ItemStack insertItem(ForgeDirection from, ItemStack item);
|
||||
|
||||
}
|
||||
@@ -1,389 +0,0 @@
|
||||
package cofh.api.transport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public final class RegistryEnderAttuned {
|
||||
|
||||
public static Map<String, Map<Integer, List<IEnderItemHandler>>> inputItem = new HashMap<String, Map<Integer, List<IEnderItemHandler>>>();
|
||||
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> inputFluid = new HashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
|
||||
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> inputEnergy = new HashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
|
||||
|
||||
public static Map<String, Map<Integer, List<IEnderItemHandler>>> outputItem = new HashMap<String, Map<Integer, List<IEnderItemHandler>>>();
|
||||
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> outputFluid = new HashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
|
||||
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> outputEnergy = new HashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
|
||||
|
||||
public static Map<String, Map<Integer, EnderDestination>> outputTeleport = new HashMap<String, Map<Integer, EnderDestination>>();
|
||||
|
||||
public static Configuration linkConf;
|
||||
|
||||
public static Map<String, String> clientFrequencyNames = new LinkedHashMap<String, String>();
|
||||
public static Map<String, String> clientFrequencyNamesReversed = new LinkedHashMap<String, String>();
|
||||
|
||||
private static class EnderDestination {
|
||||
|
||||
private final int dimension;
|
||||
private final int x, y, z;
|
||||
private IEnderDestination output;
|
||||
|
||||
public EnderDestination(IEnderDestination output) {
|
||||
|
||||
x = output.x();
|
||||
y = output.y();
|
||||
z = output.z();
|
||||
dimension = output.dimension();
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public boolean hasOutput() {
|
||||
|
||||
return DimensionManager.isDimensionRegistered(dimension);
|
||||
}
|
||||
|
||||
public IEnderDestination getOutput() {
|
||||
|
||||
if (output == null || output.isNotValid()) {
|
||||
output = null;
|
||||
if (!DimensionManager.isDimensionRegistered(dimension)) {
|
||||
return null;
|
||||
}
|
||||
WorldServer world = DimensionManager.getWorld(dimension);
|
||||
if (world == null) {
|
||||
DimensionManager.initDimension(dimension);
|
||||
world = DimensionManager.getWorld(dimension);
|
||||
}
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof IEnderDestination) {
|
||||
output = (IEnderDestination) te;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
|
||||
inputItem.clear();
|
||||
inputFluid.clear();
|
||||
inputEnergy.clear();
|
||||
outputItem.clear();
|
||||
outputFluid.clear();
|
||||
outputEnergy.clear();
|
||||
}
|
||||
|
||||
public static List<IEnderItemHandler> getLinkedItemInputs(IEnderItemHandler theAttuned) {
|
||||
|
||||
if (inputItem.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static List<IEnderItemHandler> getLinkedItemOutputs(IEnderItemHandler theAttuned) {
|
||||
|
||||
if (outputItem.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static List<IEnderFluidHandler> getLinkedFluidInputs(IEnderFluidHandler theAttuned) {
|
||||
|
||||
if (inputFluid.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static List<IEnderFluidHandler> getLinkedFluidOutputs(IEnderFluidHandler theAttuned) {
|
||||
|
||||
if (outputFluid.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static List<IEnderEnergyHandler> getLinkedEnergyInputs(IEnderEnergyHandler theAttuned) {
|
||||
|
||||
if (inputEnergy.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static List<IEnderEnergyHandler> getLinkedEnergyOutputs(IEnderEnergyHandler theAttuned) {
|
||||
|
||||
if (outputEnergy.get(theAttuned.getChannelString()) == null) {
|
||||
return null;
|
||||
}
|
||||
return outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
|
||||
}
|
||||
|
||||
public static boolean hasDestination(IEnderDestination theAttuned) {
|
||||
|
||||
return hasDestination(theAttuned, true);
|
||||
}
|
||||
|
||||
public static boolean hasDestination(IEnderDestination theAttuned, boolean to) {
|
||||
|
||||
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
|
||||
if (map == null) {
|
||||
return false;
|
||||
}
|
||||
EnderDestination dest = map.get(to ? theAttuned.getDestination() : theAttuned.getFrequency());
|
||||
return dest == null ? false : dest.hasOutput();
|
||||
}
|
||||
|
||||
public static IEnderDestination getDestination(IEnderDestination theAttuned) {
|
||||
|
||||
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
EnderDestination dest = map.get(theAttuned.getDestination());
|
||||
return dest == null ? null : dest.getOutput();
|
||||
}
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
public static void addItemHandler(IEnderItemHandler theAttuned) {
|
||||
|
||||
if (theAttuned.canSendItems()) {
|
||||
if (inputItem.get(theAttuned.getChannelString()) == null) {
|
||||
inputItem.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderItemHandler>>());
|
||||
}
|
||||
if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
inputItem.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderItemHandler>());
|
||||
}
|
||||
if (!inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
if (theAttuned.canReceiveItems()) {
|
||||
if (outputItem.get(theAttuned.getChannelString()) == null) {
|
||||
outputItem.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderItemHandler>>());
|
||||
}
|
||||
if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
outputItem.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderItemHandler>());
|
||||
}
|
||||
if (!outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addFluidHandler(IEnderFluidHandler theAttuned) {
|
||||
|
||||
if (theAttuned.canSendFluid()) {
|
||||
if (inputFluid.get(theAttuned.getChannelString()) == null) {
|
||||
inputFluid.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderFluidHandler>>());
|
||||
}
|
||||
if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
inputFluid.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderFluidHandler>());
|
||||
}
|
||||
if (!inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
if (theAttuned.canReceiveFluid()) {
|
||||
if (outputFluid.get(theAttuned.getChannelString()) == null) {
|
||||
outputFluid.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderFluidHandler>>());
|
||||
}
|
||||
if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
outputFluid.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderFluidHandler>());
|
||||
}
|
||||
if (!outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addEnergyHandler(IEnderEnergyHandler theAttuned) {
|
||||
|
||||
if (theAttuned.canSendEnergy()) {
|
||||
if (inputEnergy.get(theAttuned.getChannelString()) == null) {
|
||||
inputEnergy.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderEnergyHandler>>());
|
||||
}
|
||||
if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
inputEnergy.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderEnergyHandler>());
|
||||
}
|
||||
if (!inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
if (theAttuned.canReceiveEnergy()) {
|
||||
if (outputEnergy.get(theAttuned.getChannelString()) == null) {
|
||||
outputEnergy.put(theAttuned.getChannelString(), new HashMap<Integer, List<IEnderEnergyHandler>>());
|
||||
}
|
||||
if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) {
|
||||
outputEnergy.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList<IEnderEnergyHandler>());
|
||||
}
|
||||
if (!outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) {
|
||||
outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDestination(IEnderDestination theAttuned) {
|
||||
|
||||
if (!hasDestination(theAttuned, false)) {
|
||||
if (outputTeleport.get(theAttuned.getChannelString()) == null) {
|
||||
outputTeleport.put(theAttuned.getChannelString(), new HashMap<Integer, EnderDestination>());
|
||||
}
|
||||
outputTeleport.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new EnderDestination(theAttuned));
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeItemHandler(IEnderItemHandler theAttuned) {
|
||||
|
||||
if (inputItem.get(theAttuned.getChannelString()) != null) {
|
||||
if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
inputItem.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outputItem.get(theAttuned.getChannelString()) != null) {
|
||||
if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
outputItem.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeFluidHandler(IEnderFluidHandler theAttuned) {
|
||||
|
||||
if (inputFluid.get(theAttuned.getChannelString()) != null) {
|
||||
if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
inputFluid.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outputFluid.get(theAttuned.getChannelString()) != null) {
|
||||
if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
outputFluid.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeEnergyHandler(IEnderEnergyHandler theAttuned) {
|
||||
|
||||
if (inputEnergy.get(theAttuned.getChannelString()) != null) {
|
||||
if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
inputEnergy.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outputEnergy.get(theAttuned.getChannelString()) != null) {
|
||||
if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) {
|
||||
outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned);
|
||||
if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) {
|
||||
outputEnergy.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeDestination(IEnderDestination theAttuned) {
|
||||
|
||||
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
|
||||
if (map == null) {
|
||||
return;
|
||||
}
|
||||
EnderDestination dest = map.get(theAttuned.getFrequency());
|
||||
if (dest == null) {
|
||||
return;
|
||||
}
|
||||
if (dest.dimension == theAttuned.dimension()) {
|
||||
if (dest.x == theAttuned.x() && dest.y == theAttuned.x() && dest.z == theAttuned.x()) {
|
||||
map.remove(theAttuned.getFrequency());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void add(IEnderAttuned theAttuned) {
|
||||
|
||||
if (theAttuned instanceof IEnderItemHandler) {
|
||||
addItemHandler((IEnderItemHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderFluidHandler) {
|
||||
addFluidHandler((IEnderFluidHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderEnergyHandler) {
|
||||
addEnergyHandler((IEnderEnergyHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderDestination) {
|
||||
addDestination((IEnderDestination) theAttuned);
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove(IEnderAttuned theAttuned) {
|
||||
|
||||
if (theAttuned instanceof IEnderItemHandler) {
|
||||
removeItemHandler((IEnderItemHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderFluidHandler) {
|
||||
removeFluidHandler((IEnderFluidHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderEnergyHandler) {
|
||||
removeEnergyHandler((IEnderEnergyHandler) theAttuned);
|
||||
}
|
||||
if (theAttuned instanceof IEnderDestination) {
|
||||
removeDestination((IEnderDestination) theAttuned);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sortClientNames() {
|
||||
|
||||
List<Map.Entry<String, String>> list = new ArrayList<Map.Entry<String, String>>(clientFrequencyNames.entrySet());
|
||||
Collections.sort(list, new Comparator<Map.Entry<String, String>>() {
|
||||
|
||||
@Override
|
||||
public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
|
||||
|
||||
int int1 = Integer.valueOf(clientFrequencyNamesReversed.get(o1.getValue()));
|
||||
int int2 = Integer.valueOf(clientFrequencyNamesReversed.get(o2.getValue()));
|
||||
return int1 > int2 ? 1 : int1 == int2 ? 0 : -1;
|
||||
}
|
||||
});
|
||||
Map<String, String> result = new LinkedHashMap<String, String>();
|
||||
for (Map.Entry<String, String> entry : list) {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
clientFrequencyNames = result;
|
||||
}
|
||||
|
||||
public static void clearClientNames() {
|
||||
|
||||
clientFrequencyNames.clear();
|
||||
clientFrequencyNamesReversed.clear();
|
||||
}
|
||||
|
||||
public static void addClientNames(String owner, String name) {
|
||||
|
||||
if (!owner.isEmpty()) {
|
||||
clientFrequencyNames.put(owner, name);
|
||||
clientFrequencyNamesReversed.put(name, owner);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|transport")
|
||||
package cofh.api.transport;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.cricketcraft.chisel.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface IFacade {
|
||||
|
||||
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/Crap.java
|
||||
@@ -1,13 +0,0 @@
|
||||
package info.jbcs.minecraft.chisel.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface IFacade {
|
||||
|
||||
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user