From 1c6a60c0c52233f33c4b309360e9f0ab88a490e7 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Wed, 4 Dec 2013 12:52:12 -0500 Subject: [PATCH] more cleanup --- src/dark/api/IAimable.java | 8 ++--- src/dark/api/{access => }/ITerminal.java | 3 +- .../api/{access => }/ITerminalCommand.java | 3 +- src/dark/api/access/AccessCollection.java | 23 -------------- src/dark/api/access/AccessProfile.java | 10 +++++-- src/dark/api/access/GroupRegistry.java | 3 ++ src/dark/api/energy/IEnergyProvider.java | 6 ++-- src/dark/api/energy/IPowerLess.java | 4 +++ src/dark/api/energy/IPsiReciever.java | 13 -------- src/dark/api/tilenetwork/INetworkHost.java | 24 --------------- src/dark/api/tilenetwork/ITileConnector.java | 5 ++-- .../core/prefab/sentry/BlockSentryGun.java | 16 +++++++--- .../core/prefab/sentry/ItemBlockSentry.java | 30 ------------------- .../prefab/sentry/TileEntityGunPlatform.java | 13 ++++++++ .../core/prefab/terminal/CommandUser.java | 4 +-- .../prefab/terminal/TileEntityTerminal.java | 2 +- 16 files changed, 57 insertions(+), 110 deletions(-) rename src/dark/api/{access => }/ITerminal.java (92%) rename src/dark/api/{access => }/ITerminalCommand.java (97%) delete mode 100644 src/dark/api/access/AccessCollection.java delete mode 100644 src/dark/api/energy/IPsiReciever.java delete mode 100644 src/dark/api/tilenetwork/INetworkHost.java delete mode 100644 src/dark/core/prefab/sentry/ItemBlockSentry.java diff --git a/src/dark/api/IAimable.java b/src/dark/api/IAimable.java index f4a450726..8977df3a8 100644 --- a/src/dark/api/IAimable.java +++ b/src/dark/api/IAimable.java @@ -4,15 +4,15 @@ import universalelectricity.core.vector.Vector3; /** Applied to objects that can be aimed by yaw and pitch. This is used by things like sentry guns, * vehicles, or mining tools. - * + * * @author DarkGuardsman */ public interface IAimable { - /** Vector which runs from the objects eyes(or gun) to what it is looking at. Should be right - * outside the objects bounds but no farther than that. Used for ray traces mainly */ + /** Vector which runs from the objects eyes(or gun). Should be right outside the objects bounds + * but no farther than that. */ public Vector3 getLook(); - /** X pitch, Y is yaw, z is roll but is not used for basic aiming */ + /** X pitch, Y is yaw, z is roll. Roll is almost never used*/ public Vector3 getRotation(); /** This does not set the rotation but rather moves the current rotation by the given values */ diff --git a/src/dark/api/access/ITerminal.java b/src/dark/api/ITerminal.java similarity index 92% rename from src/dark/api/access/ITerminal.java rename to src/dark/api/ITerminal.java index 38a2fd383..7935b92c7 100644 --- a/src/dark/api/access/ITerminal.java +++ b/src/dark/api/ITerminal.java @@ -1,8 +1,9 @@ -package dark.api.access; +package dark.api; import java.util.List; import net.minecraft.entity.player.EntityPlayer; +import dark.api.access.ISpecialAccess; import dark.core.interfaces.IScroll; /** Basic methods to make it easier to construct or interact with a terminal based tile. Recommend to diff --git a/src/dark/api/access/ITerminalCommand.java b/src/dark/api/ITerminalCommand.java similarity index 97% rename from src/dark/api/access/ITerminalCommand.java rename to src/dark/api/ITerminalCommand.java index a3dfc7818..2295514c4 100644 --- a/src/dark/api/access/ITerminalCommand.java +++ b/src/dark/api/ITerminalCommand.java @@ -1,7 +1,8 @@ -package dark.api.access; +package dark.api; import java.util.Set; + import net.minecraft.entity.player.EntityPlayer; /** Prefab for creating commands that most terminal entities can use diff --git a/src/dark/api/access/AccessCollection.java b/src/dark/api/access/AccessCollection.java deleted file mode 100644 index a50ab00ca..000000000 --- a/src/dark/api/access/AccessCollection.java +++ /dev/null @@ -1,23 +0,0 @@ -package dark.api.access; - -/** Container of access groups that can be used by anything. Only the core machine should load/save - * global access collections to prevent conflicts. - * - * @author DarkGuardsman */ -public class AccessCollection -{ - /** Was created from a save within a tile entity */ - public final boolean isLocal; - ISpecialAccess machine; - - public AccessCollection(ISpecialAccess machine) - { - this.isLocal = true; - this.machine = machine; - } - - public AccessCollection() - { - this.isLocal = false; - } -} diff --git a/src/dark/api/access/AccessProfile.java b/src/dark/api/access/AccessProfile.java index 4e0ccd633..5f4edc0db 100644 --- a/src/dark/api/access/AccessProfile.java +++ b/src/dark/api/access/AccessProfile.java @@ -16,7 +16,7 @@ import dark.api.save.SaveManager; /** Designed to be used as a container for AccessGroups and AccessUser. If you plan to use this make * sure to use it correctly. This is designed to be saved separate from the world save if marked for * global access. Which means it can save/load at will from the world file. - * + * * @author DarkGuardsman */ public class AccessProfile implements ISpecialAccess, IVirtualObject { @@ -27,10 +27,16 @@ public class AccessProfile implements ISpecialAccess, IVirtualObject /** Only used by global profiles that have no defined container. Also LocalHost means it was * created by a tileEntity */ protected String profileID = "LocalHost"; - + /** Is this profile global */ protected boolean global = false; + /** Save file by which this was loaded from. Mainly used to save it in the same location again. */ protected File saveFile; + static + { + SaveManager.registerClass("AccessProfile", AccessProfile.class); + } + public AccessProfile() { if (global) diff --git a/src/dark/api/access/GroupRegistry.java b/src/dark/api/access/GroupRegistry.java index 9d79e5716..76f77d018 100644 --- a/src/dark/api/access/GroupRegistry.java +++ b/src/dark/api/access/GroupRegistry.java @@ -5,6 +5,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import dark.api.ITerminal; +import dark.api.ITerminalCommand; + import net.minecraft.entity.player.EntityPlayer; /** @author DarkGuardsman */ diff --git a/src/dark/api/energy/IEnergyProvider.java b/src/dark/api/energy/IEnergyProvider.java index 253df3556..05f4f4603 100644 --- a/src/dark/api/energy/IEnergyProvider.java +++ b/src/dark/api/energy/IEnergyProvider.java @@ -8,11 +8,11 @@ import net.minecraftforge.common.ForgeDirection; public interface IEnergyProvider extends IEnergyDevice { /** Called to have the tile provide energy */ - public EnergyPack provideEnergy(ForgeDirection from, EnergyPack request, boolean doProvide); + public EnergyPack requestEnergy(ForgeDirection from, EnergyPack request, boolean doProvide); /** Gets the energy provided at the given time on the given side */ - public EnergyPack getEnergyProduce(ForgeDirection direction, String type); + public EnergyPack getEnergyOutput(ForgeDirection direction, String type); /** Can the device provide energy on the given side */ - public boolean canProviderEnergy(ForgeDirection side, String type); + public boolean canOutputEnergy(ForgeDirection side, String type); } diff --git a/src/dark/api/energy/IPowerLess.java b/src/dark/api/energy/IPowerLess.java index 268338347..f13e208aa 100644 --- a/src/dark/api/energy/IPowerLess.java +++ b/src/dark/api/energy/IPowerLess.java @@ -1,5 +1,9 @@ package dark.api.energy; +/** Applied to devices that have the option to run without power. Normally this option is only shown + * to creative mode players + * + * @author DarkGuardsman */ public interface IPowerLess { /** Should this run without power */ diff --git a/src/dark/api/energy/IPsiReciever.java b/src/dark/api/energy/IPsiReciever.java deleted file mode 100644 index 50e0e23a3..000000000 --- a/src/dark/api/energy/IPsiReciever.java +++ /dev/null @@ -1,13 +0,0 @@ -package dark.api.energy; - -import dark.api.tilenetwork.ITileConnector; - -/** A tileEntity that receives a pressure driven fluid. Suggested to use some of the class from - * net.minecraftforge.liquids too make your machine work with other fluid mods that don't use - * pressure */ -public interface IPsiReciever extends ITileConnector -{ - /** the load that this machine is handling, working, or moving */ - public double getPressureLoad(); - -} diff --git a/src/dark/api/tilenetwork/INetworkHost.java b/src/dark/api/tilenetwork/INetworkHost.java deleted file mode 100644 index c935ff0f9..000000000 --- a/src/dark/api/tilenetwork/INetworkHost.java +++ /dev/null @@ -1,24 +0,0 @@ -package dark.api.tilenetwork; - -import java.util.List; - -import net.minecraft.tileentity.TileEntity; -import dark.core.prefab.tilenetwork.NetworkTileEntities; - -public interface INetworkHost extends ITileConnector -{ - /** Array of connections this tile has to other tiles */ - public List getNetworkConnections(); - - /** Update the connection this tile has to other tiles */ - public void refresh(); - - /** Gets all networks this machine is part of */ - public List getTileNetworks(); - - /** Adds a network to this machine */ - public void addNetwork(NetworkTileEntities network); - - /** Removes a network from this machine */ - public void removeNetwork(NetworkTileEntities network); -} diff --git a/src/dark/api/tilenetwork/ITileConnector.java b/src/dark/api/tilenetwork/ITileConnector.java index 22141d213..4f5ba419e 100644 --- a/src/dark/api/tilenetwork/ITileConnector.java +++ b/src/dark/api/tilenetwork/ITileConnector.java @@ -4,7 +4,7 @@ import net.minecraftforge.common.ForgeDirection; /** Used on tiles that want control over what can connect to there device. It is suggest that other * interfaces for connection be routed threw this to reduce the need to change things - * + * * @author DarkGuardsman */ public interface ITileConnector { @@ -21,7 +21,8 @@ public interface ITileConnector /** Force mainly from rotating rods */ FORCE(), /** Hydraulic pressure from DM pipe */ - PRESSURE(), + FLUID_PRESSURE(), + AIR_PRESSURE(), /** Item pipe */ ITEMS(), /** Data line input */ diff --git a/src/dark/core/prefab/sentry/BlockSentryGun.java b/src/dark/core/prefab/sentry/BlockSentryGun.java index 310f32005..a5e8d2ba1 100644 --- a/src/dark/core/prefab/sentry/BlockSentryGun.java +++ b/src/dark/core/prefab/sentry/BlockSentryGun.java @@ -9,12 +9,14 @@ import net.minecraft.tileentity.TileEntity; import com.builtbroken.common.Pair; import dark.core.ModObjectRegistry; +import dark.core.prefab.ItemBlockHolder; import dark.core.prefab.machine.BlockMachine; import dark.machines.common.DarkMain; /** Actual block that is the sentry gun. Mainly a place holder as the sentry guns need something to - * exist threw that is not an entity. - * + * exist threw that is not an entity. Renders need to still be handled by the respective mod. + * Especial item renders as this just creates the block and reservers the meta slot + * * @author DarkGuardsman */ public class BlockSentryGun extends BlockMachine { @@ -91,8 +93,14 @@ public class BlockSentryGun extends BlockMachine { if (sentryBlockIds[b] == -1) { - Block block = ModObjectRegistry.createNewBlock("DMSentryGun" + b, DarkMain.MOD_ID, BlockSentryGun.class); - sentryBlockIds[b] = block.blockID; + Block block = new BlockSentryGun(b); + if (block != null) + { + ModObjectRegistry.registredBlocks.put(block, "DMSentryGun" + b); + ModObjectRegistry.proxy.registerBlock(block, ItemBlockHolder.class, "DMSentryGun" + b, DarkMain.MOD_ID); + ModObjectRegistry.finishCreation(block, null); + sentryBlockIds[b] = block.blockID; + } } } } diff --git a/src/dark/core/prefab/sentry/ItemBlockSentry.java b/src/dark/core/prefab/sentry/ItemBlockSentry.java deleted file mode 100644 index 107cf5338..000000000 --- a/src/dark/core/prefab/sentry/ItemBlockSentry.java +++ /dev/null @@ -1,30 +0,0 @@ -package dark.core.prefab.sentry; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import dark.core.prefab.ItemBlockHolder; - -/** Item block that is the unplaced sentry gun. All sentry gun data is held by NBT to allow the - * sentry gun to exist without metadata limits. - * - * @author DarkGuardsman */ -public class ItemBlockSentry extends ItemBlockHolder -{ - public ItemBlockSentry(int id) - { - super(id); - } - - @Override - public int getMetadata(int damage) - { - return 0; - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage(); - } - -} diff --git a/src/dark/core/prefab/sentry/TileEntityGunPlatform.java b/src/dark/core/prefab/sentry/TileEntityGunPlatform.java index e6253db22..8ebb022ab 100644 --- a/src/dark/core/prefab/sentry/TileEntityGunPlatform.java +++ b/src/dark/core/prefab/sentry/TileEntityGunPlatform.java @@ -4,5 +4,18 @@ import dark.core.prefab.terminal.TileEntityTerminal; public class TileEntityGunPlatform extends TileEntityTerminal { + public TileEntityGunPlatform() + { + super(0, 0); + } + public TileEntityGunPlatform(float wattsPerTick) + { + super(wattsPerTick); + } + + public TileEntityGunPlatform(float wattsPerTick, float maxEnergy) + { + super(wattsPerTick, maxEnergy); + } } diff --git a/src/dark/core/prefab/terminal/CommandUser.java b/src/dark/core/prefab/terminal/CommandUser.java index aa975b953..a3639ad56 100644 --- a/src/dark/core/prefab/terminal/CommandUser.java +++ b/src/dark/core/prefab/terminal/CommandUser.java @@ -4,9 +4,9 @@ import java.util.HashSet; import java.util.Set; import net.minecraft.entity.player.EntityPlayer; +import dark.api.ITerminal; +import dark.api.ITerminalCommand; import dark.api.access.ISpecialAccess; -import dark.api.access.ITerminal; -import dark.api.access.ITerminalCommand; public class CommandUser implements ITerminalCommand { diff --git a/src/dark/core/prefab/terminal/TileEntityTerminal.java b/src/dark/core/prefab/terminal/TileEntityTerminal.java index b24673dd0..f0aa564de 100644 --- a/src/dark/core/prefab/terminal/TileEntityTerminal.java +++ b/src/dark/core/prefab/terminal/TileEntityTerminal.java @@ -12,8 +12,8 @@ import com.google.common.io.ByteArrayDataInput; import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; +import dark.api.ITerminal; import dark.api.access.GroupRegistry; -import dark.api.access.ITerminal; import dark.core.network.PacketHandler; import dark.core.prefab.machine.TileEntityEnergyMachine; import dark.core.prefab.machine.TileEntityMachine.SimplePacketTypes;