diff --git a/src/dark/core/common/CommonProxy.java b/src/dark/core/common/CommonProxy.java index 835deacba..4509b76fc 100644 --- a/src/dark/core/common/CommonProxy.java +++ b/src/dark/core/common/CommonProxy.java @@ -8,6 +8,8 @@ import dark.core.network.PacketManagerEffects; public class CommonProxy { + public static final int GUI_COAL_GEN = 0, GUI_FUEL_GEN = 1, GUI_FURNACE_ELEC = 2, GUI_BATTERY_BOX = 3; + public void preInit() { // TODO Auto-generated method stub diff --git a/src/dark/core/network/PacketHandler.java b/src/dark/core/network/PacketHandler.java index a1b033745..b0306cace 100644 --- a/src/dark/core/network/PacketHandler.java +++ b/src/dark/core/network/PacketHandler.java @@ -30,7 +30,7 @@ import cpw.mods.fml.common.network.Player; * @author DarkGuardsman */ public class PacketHandler implements IPacketHandler, IPacketReceiver { - public static PacketHandler instance; + protected static PacketHandler instance; public static HashMap packetTypes = new HashMap(); diff --git a/src/dark/core/prefab/access/AccessLevel.java b/src/dark/core/prefab/access/AccessLevel.java deleted file mode 100644 index c50d3d745..000000000 --- a/src/dark/core/prefab/access/AccessLevel.java +++ /dev/null @@ -1,45 +0,0 @@ -package dark.core.prefab.access; - -public enum AccessLevel -{ - NONE("None"), - BASIC("Basic"), - USER("Standard"), - ADMIN("Admin"), - OWNER("Owner"); - - public String displayName; - - private AccessLevel(String name) - { - displayName = name; - } - - /** Gets the access level in varies ways - * - * @return AccessLevel NONE instead of null if correct level can't be found. */ - public static AccessLevel get(Object ob) - { - if (ob instanceof String) - { - for (AccessLevel access : AccessLevel.values()) - { - if (access.displayName.equalsIgnoreCase((String) ob) || access.name().equalsIgnoreCase((String) ob)) - { - return access; - } - } - } - if (ob instanceof Integer) - { - int i = (Integer) ob; - - if (i >= 0 && i < AccessLevel.values().length) - { - return AccessLevel.values()[i]; - } - } - - return NONE; - } -} diff --git a/src/dark/core/prefab/access/GlobalAccessManager.java b/src/dark/core/prefab/access/GlobalAccessManager.java index 1c4a4c6bf..b240e7f9f 100644 --- a/src/dark/core/prefab/access/GlobalAccessManager.java +++ b/src/dark/core/prefab/access/GlobalAccessManager.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.Map.Entry; import net.minecraft.nbt.NBTTagCompound; +import dark.api.AccessLevel; import dark.core.prefab.helpers.NBTFileLoader; public class GlobalAccessManager diff --git a/src/dark/core/prefab/access/ISpecialAccess.java b/src/dark/core/prefab/access/ISpecialAccess.java deleted file mode 100644 index 0cd2757fd..000000000 --- a/src/dark/core/prefab/access/ISpecialAccess.java +++ /dev/null @@ -1,39 +0,0 @@ -package dark.core.prefab.access; - -import java.util.List; - -/** Used by any object that needs to restrict access to it by a set of usernames - * - * @author DarkGuardsman */ -public interface ISpecialAccess -{ - /** Gets the player's access level on the machine he is using - * - * @return access level of the player, make sure to return no access if the player doesn't have - * any */ - public AccessLevel getUserAccess(String username); - - /** gets the access list for the machine - * - * @return hasMap of players and there access levels */ - public List getUsers(); - - /** sets the players access level in the access map - * - * @param player - * @return true if the level was set false if something went wrong */ - public boolean addUserAccess(String username, AccessLevel level, boolean save); - - /** Removes the user from the access list - * - * @param username - * @return */ - public boolean removeUserAccess(String username); - - /** Gets a list of users with this specified access level. - * - * @param level - * @return */ - List getUsersWithAcess(AccessLevel level); - -} diff --git a/src/dark/core/prefab/access/UserAccess.java b/src/dark/core/prefab/access/UserAccess.java index 779c9b7e2..4248ecec6 100644 --- a/src/dark/core/prefab/access/UserAccess.java +++ b/src/dark/core/prefab/access/UserAccess.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import dark.api.AccessLevel; public class UserAccess { diff --git a/src/dark/core/prefab/machine/BlockMachine.java b/src/dark/core/prefab/machine/BlockMachine.java index 926aa49c6..21e0a6fbb 100644 --- a/src/dark/core/prefab/machine/BlockMachine.java +++ b/src/dark/core/prefab/machine/BlockMachine.java @@ -16,7 +16,7 @@ import dark.core.common.DarkMain; /** Basic TileEntity Container class designed to be used by generic machines. It is suggested that * each mod using this create there own basic block extending this to reduce need to input config * file each time - * + * * @author Darkguardsman */ public abstract class BlockMachine extends BlockTile implements ITileEntityProvider { @@ -78,5 +78,4 @@ public abstract class BlockMachine extends BlockTile implements ITileEntityProvi return super.createTileEntity(world, metadata); } - } diff --git a/src/dark/core/prefab/machine/TileEntityEnergyMachine.java b/src/dark/core/prefab/machine/TileEntityEnergyMachine.java index 71ceb0d9f..82f457d7b 100644 --- a/src/dark/core/prefab/machine/TileEntityEnergyMachine.java +++ b/src/dark/core/prefab/machine/TileEntityEnergyMachine.java @@ -37,9 +37,9 @@ import dark.api.energy.IPowerLess; import dark.core.common.ExternalModHandler; /** Basic energy tile that can consume power - * + * * Based off both UE universal electrical tile, and electrical tile prefabs - * + * * @author DarkGuardsman */ public class TileEntityEnergyMachine extends TileEntityMachine implements IElectrical, IElectricalStorage, IEnergySink, IEnergySource, IPowerReceptor, IPowerLess { @@ -83,6 +83,7 @@ public class TileEntityEnergyMachine extends TileEntityMachine implements IElect } /** Does this tile have power to run and do work */ + @Override public boolean canFunction() { return !this.isDisabled() && (this.runPowerLess() || this.consumePower(this.WATTS_PER_TICK, false)); @@ -412,7 +413,7 @@ public class TileEntityEnergyMachine extends TileEntityMachine implements IElect } /** Produces UE power towards a specific direction. - * + * * @param outputDirection - The output direction. */ public void produceUE(ForgeDirection outputDirection) { @@ -441,7 +442,7 @@ public class TileEntityEnergyMachine extends TileEntityMachine implements IElect } /** The electrical input direction. - * + * * @return The direction that electricity is entered into the tile. Return null for no input. By * default you can accept power from all sides. */ public EnumSet getInputDirections() @@ -450,7 +451,7 @@ public class TileEntityEnergyMachine extends TileEntityMachine implements IElect } /** The electrical output direction. - * + * * @return The direction that electricity is output from the tile. Return null for no output. By * default it will return an empty EnumSet. */ public EnumSet getOutputDirections() diff --git a/src/dark/core/prefab/machine/TileEntityInv.java b/src/dark/core/prefab/machine/TileEntityInv.java index 4435f40d9..5c86c7029 100644 --- a/src/dark/core/prefab/machine/TileEntityInv.java +++ b/src/dark/core/prefab/machine/TileEntityInv.java @@ -11,20 +11,21 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.ForgeDirection; import universalelectricity.prefab.tile.TileEntityAdvanced; +import dark.api.AccessLevel; +import dark.api.ISpecialAccess; import dark.core.interfaces.IExternalInv; import dark.core.interfaces.IInvBox; -import dark.core.prefab.access.AccessLevel; -import dark.core.prefab.access.ISpecialAccess; import dark.core.prefab.access.UserAccess; import dark.core.prefab.invgui.InvChest; /** Prefab for simple object who only need basic inv support and nothing more - * + * * @author Darkguardsman */ public class TileEntityInv extends TileEntityAdvanced implements IExternalInv, ISidedInventory, ISpecialAccess { protected IInvBox inventory; protected boolean lockInv; + protected int invSlots = 1; /** A list of user access data. */ protected final List users = new ArrayList(); @@ -33,7 +34,7 @@ public class TileEntityInv extends TileEntityAdvanced implements IExternalInv, I { if (inventory == null) { - inventory = new InvChest(this, 1); + inventory = new InvChest(this, this.invSlots); } return inventory; } diff --git a/src/dark/core/prefab/machine/TileEntityMachine.java b/src/dark/core/prefab/machine/TileEntityMachine.java index cd70235a4..e5f2c6d20 100644 --- a/src/dark/core/prefab/machine/TileEntityMachine.java +++ b/src/dark/core/prefab/machine/TileEntityMachine.java @@ -206,7 +206,7 @@ public class TileEntityMachine extends TileEntityInv implements ISidedInventory, } /** Handles reduced data from the main packet method - * + * * @param id - packet ID * @param dis - data * @param player - player diff --git a/src/dark/core/prefab/terminal/CommandHelp.java b/src/dark/core/prefab/terminal/CommandHelp.java index cf368a87e..9cd71b2d3 100644 --- a/src/dark/core/prefab/terminal/CommandHelp.java +++ b/src/dark/core/prefab/terminal/CommandHelp.java @@ -4,7 +4,8 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import dark.core.prefab.access.ISpecialAccess; +import dark.api.ISpecialAccess; +import dark.api.ITerminal; public class CommandHelp extends TerminalCommand { diff --git a/src/dark/core/prefab/terminal/CommandRegistry.java b/src/dark/core/prefab/terminal/CommandRegistry.java index 4ea46a119..6970c715c 100644 --- a/src/dark/core/prefab/terminal/CommandRegistry.java +++ b/src/dark/core/prefab/terminal/CommandRegistry.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; +import dark.api.ITerminal; /** @author Calclavia, DarkGuardsman */ public class CommandRegistry diff --git a/src/dark/core/prefab/terminal/CommandUser.java b/src/dark/core/prefab/terminal/CommandUser.java index f2a7c7dd3..027e8fb9b 100644 --- a/src/dark/core/prefab/terminal/CommandUser.java +++ b/src/dark/core/prefab/terminal/CommandUser.java @@ -4,8 +4,9 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import dark.core.prefab.access.AccessLevel; -import dark.core.prefab.access.ISpecialAccess; +import dark.api.AccessLevel; +import dark.api.ISpecialAccess; +import dark.api.ITerminal; public class CommandUser extends TerminalCommand { diff --git a/src/dark/core/prefab/terminal/ContainerTerminal.java b/src/dark/core/prefab/terminal/ContainerTerminal.java index 83a03d253..d47f61af4 100644 --- a/src/dark/core/prefab/terminal/ContainerTerminal.java +++ b/src/dark/core/prefab/terminal/ContainerTerminal.java @@ -12,13 +12,11 @@ public abstract class ContainerTerminal extends Container public ContainerTerminal(InventoryPlayer inventoryPlayer, TileEntityTerminal tileEntity) { this.tileEntity = tileEntity; - this.tileEntity.playersUsing.add(inventoryPlayer.player); } @Override public void onContainerClosed(EntityPlayer par1EntityPlayer) { - this.tileEntity.playersUsing.remove(par1EntityPlayer); super.onContainerClosed(par1EntityPlayer); } diff --git a/src/dark/core/prefab/terminal/ITerminal.java b/src/dark/core/prefab/terminal/ITerminal.java deleted file mode 100644 index fc750abe2..000000000 --- a/src/dark/core/prefab/terminal/ITerminal.java +++ /dev/null @@ -1,20 +0,0 @@ -package dark.core.prefab.terminal; - -import java.util.List; - -import dark.core.interfaces.IScroll; -import dark.core.prefab.access.ISpecialAccess; - -/** Basic methods to make it easier to construct or interact with a terminal based tile. Recommend to - * be used by tiles that want to mimic computer command line like interfaces. As well to restrict - * access to the tile in the same way a computer would - * - * @author DarkGuardsmsan */ -public interface ITerminal extends ISpecialAccess, IScroll -{ - /** Gets an output of the string stored in the console. */ - public List getTerminalOuput(); - - /** Adds a string to the console. Server side only. */ - public boolean addToConsole(String msg); -} diff --git a/src/dark/core/prefab/terminal/TerminalCommand.java b/src/dark/core/prefab/terminal/TerminalCommand.java index f83418f37..8680c67e8 100644 --- a/src/dark/core/prefab/terminal/TerminalCommand.java +++ b/src/dark/core/prefab/terminal/TerminalCommand.java @@ -3,7 +3,8 @@ package dark.core.prefab.terminal; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import dark.core.prefab.access.ISpecialAccess; +import dark.api.ISpecialAccess; +import dark.api.ITerminal; /** @author Calclavia, DarkGuardsman */ public abstract class TerminalCommand diff --git a/src/dark/core/prefab/terminal/TileEntityTerminal.java b/src/dark/core/prefab/terminal/TileEntityTerminal.java index 0572fd118..8b6b3585e 100644 --- a/src/dark/core/prefab/terminal/TileEntityTerminal.java +++ b/src/dark/core/prefab/terminal/TileEntityTerminal.java @@ -3,31 +3,18 @@ package dark.core.prefab.terminal; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.util.AxisAlignedBB; import universalelectricity.prefab.network.IPacketReceiver; - -import com.google.common.io.ByteArrayDataInput; - -import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; +import dark.api.ITerminal; import dark.core.network.PacketHandler; -import dark.core.prefab.access.AccessLevel; -import dark.core.prefab.access.ISpecialAccess; -import dark.core.prefab.access.UserAccess; import dark.core.prefab.machine.TileEntityEnergyMachine; -import dark.core.prefab.machine.TileEntityMachine.SimplePacketTypes; /** @author Calclavia, DarkGuardsman */ public abstract class TileEntityTerminal extends TileEntityEnergyMachine implements IPacketReceiver, ITerminal