From 34b47427988633fee136a8bfad19a68c77c9fff0 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sat, 2 Aug 2014 00:48:11 +0100 Subject: [PATCH 1/2] Start on framework for energy/fluid/gas/item teleportation --- .../common/teleportation/SharedInventory.java | 26 ++++++++++++++++++ .../teleportation/SharedInventoryManager.java | 27 +++++++++++++++++++ .../tile/TileEntityEntangledInventory.java | 12 +++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/main/java/mekanism/common/teleportation/SharedInventory.java create mode 100644 src/main/java/mekanism/common/teleportation/SharedInventoryManager.java create mode 100644 src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java diff --git a/src/main/java/mekanism/common/teleportation/SharedInventory.java b/src/main/java/mekanism/common/teleportation/SharedInventory.java new file mode 100644 index 000000000..389fd5314 --- /dev/null +++ b/src/main/java/mekanism/common/teleportation/SharedInventory.java @@ -0,0 +1,26 @@ +package mekanism.common.teleportation; + +import mekanism.api.gas.GasTank; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidTank; + +public class SharedInventory +{ + public String name; + + public double storedEnergy; + public FluidTank storedFluid; + public GasTank storedGas; + public ItemStack storedItem; + + public SharedInventory(String freq) + { + name = freq; + + storedEnergy = 0; + storedFluid = new FluidTank(1000); + storedGas = new GasTank(1000); + storedItem = null; + } +} diff --git a/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java b/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java new file mode 100644 index 000000000..99c7c209f --- /dev/null +++ b/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java @@ -0,0 +1,27 @@ +package mekanism.common.teleportation; + +import java.util.HashMap; + +public class SharedInventoryManager +{ + public static HashMap inventories = new HashMap(); + + public static SharedInventory getInventory(String frequency) + { + if(frequency.length() <= 0) + { + return null; + } + + SharedInventory inv = inventories.get(frequency); + + if(inv == null) + { + inv = new SharedInventory(frequency); + + inventories.put(frequency, inv); + } + + return inv; + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java b/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java new file mode 100644 index 000000000..02c7a138b --- /dev/null +++ b/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java @@ -0,0 +1,12 @@ +package mekanism.common.tile; + +import mekanism.common.Tier; +import mekanism.common.Tier.EnergyCubeTier; + +public class TileEntityEntangledInventory extends TileEntityElectricBlock +{ + public TileEntityEntangledInventory() + { + super("Entangled", 0); + } +} From e0e54523fb2926d64f68859e22d6990569d3f205 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sat, 2 Aug 2014 00:49:46 +0100 Subject: [PATCH 2/2] Remove some bad imports --- .../mekanism/common/tile/TileEntityEntangledInventory.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java b/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java index 02c7a138b..d0b272986 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java +++ b/src/main/java/mekanism/common/tile/TileEntityEntangledInventory.java @@ -1,8 +1,5 @@ package mekanism.common.tile; -import mekanism.common.Tier; -import mekanism.common.Tier.EnergyCubeTier; - public class TileEntityEntangledInventory extends TileEntityElectricBlock { public TileEntityEntangledInventory()