diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2016-02-19 17:38:35 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-02-19 17:38:35 +1000 |
| commit | 7011e367ac5ccc34473283d6245bc2cec93b835e (patch) | |
| tree | cc5675471f1101631bec2cde9713cb9c0004cc8f /src/Java/binnie/core | |
| parent | c68c67d74f39c3eb075ac29e88936a1976ef089b (diff) | |
| download | GT5-Unofficial-7011e367ac5ccc34473283d6245bc2cec93b835e.tar.gz GT5-Unofficial-7011e367ac5ccc34473283d6245bc2cec93b835e.tar.bz2 GT5-Unofficial-7011e367ac5ccc34473283d6245bc2cec93b835e.zip | |
Removed Hard dependency on gregtech as another Project and added dev versions of all requires libs.
Also started work on GT-EU EnderIO conduits, adding @Optional annotations where possible and a few other nice things.
Diffstat (limited to 'src/Java/binnie/core')
164 files changed, 0 insertions, 10974 deletions
diff --git a/src/Java/binnie/core/AbstractMod.java b/src/Java/binnie/core/AbstractMod.java deleted file mode 100644 index 74f274cdb7..0000000000 --- a/src/Java/binnie/core/AbstractMod.java +++ /dev/null @@ -1,158 +0,0 @@ -package binnie.core; - -import binnie.Binnie; -import binnie.core.gui.IBinnieGUID; -import binnie.core.mod.config.ManagerConfig; -import binnie.core.mod.parser.FieldParser; -import binnie.core.network.BinniePacketHandler; -import binnie.core.network.IPacketID; -import binnie.core.network.IPacketProvider; -import binnie.core.network.packet.MessageBinnie; -import binnie.core.proxy.IProxyCore; -import cpw.mods.fml.common.eventhandler.EventBus; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import cpw.mods.fml.relauncher.Side; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import net.minecraftforge.common.MinecraftForge; - -public abstract class AbstractMod - implements IPacketProvider, IInitializable -{ - private SimpleNetworkWrapper wrapper; - - public AbstractMod() - { - BinnieCore.registerMod(this); - MinecraftForge.EVENT_BUS.register(this); - } - - public abstract boolean isActive(); - - public abstract String getChannel(); - - public IPacketID[] getPacketIDs() - { - return new IPacketID[0]; - } - - public IBinnieGUID[] getGUIDs() - { - return new IBinnieGUID[0]; - } - - public Class[] getConfigs() - { - return new Class[0]; - } - - public abstract IProxyCore getProxy(); - - public abstract String getModID(); - - public SimpleNetworkWrapper getNetworkWrapper() - { - return this.wrapper; - } - - protected abstract Class<? extends BinniePacketHandler> getPacketHandler(); - - public void preInit() - { - if (!isActive()) { - return; - } - if (getConfigs() != null) { - for (Class cls : getConfigs()) { - Binnie.Configuration.registerConfiguration(cls, this); - } - } - getProxy().preInit(); - for (IInitializable module : this.modules) { - module.preInit(); - } - for (Field field : getClass().getFields()) { - this.fields.add(field); - } - for (Class cls : getClass().getClasses()) { - for (Field field : getClass().getFields()) { - this.fields.add(field); - } - } - for (IInitializable module : this.modules) { - for (Field field : module.getClass().getFields()) { - this.fields.add(field); - } - } - for (Field field : this.fields) { - try - { - FieldParser.preInitParse(field, this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - } - - public void init() - { - if (!isActive()) { - return; - } - getProxy().init(); - - this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(getChannel()); - - this.wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT); - this.wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.SERVER); - for (IInitializable module : this.modules) { - module.init(); - } - for (Field field : this.fields) { - try - { - FieldParser.initParse(field, this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - } - - private LinkedHashSet<Field> fields = new LinkedHashSet(); - - public void postInit() - { - if (!isActive()) { - return; - } - getProxy().postInit(); - for (IInitializable module : this.modules) { - module.postInit(); - } - for (Field field : this.fields) { - try - { - FieldParser.postInitParse(field, this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - } - - protected final void addModule(IInitializable init) - { - this.modules.add(init); - MinecraftForge.EVENT_BUS.register(init); - } - - protected List<IInitializable> modules = new ArrayList(); -} diff --git a/src/Java/binnie/core/BinnieCore.java b/src/Java/binnie/core/BinnieCore.java deleted file mode 100644 index e2dbc502e3..0000000000 --- a/src/Java/binnie/core/BinnieCore.java +++ /dev/null @@ -1,240 +0,0 @@ -package binnie.core; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraftforge.client.event.TextureStitchEvent; -import binnie.Binnie; -import binnie.core.block.MultipassBlockRenderer; -import binnie.core.block.TileEntityMetadata; -import binnie.core.gui.BinnieCoreGUI; -import binnie.core.gui.BinnieGUIHandler; -import binnie.core.gui.IBinnieGUID; -import binnie.core.item.ItemFieldKit; -import binnie.core.item.ItemGenesis; -import binnie.core.machines.MachineGroup; -import binnie.core.machines.storage.ModuleStorage; -import binnie.core.mod.config.ConfigurationMain; -import binnie.core.mod.config.ConfigurationMods; -import binnie.core.mod.parser.FieldParser; -import binnie.core.mod.parser.ItemParser; -import binnie.core.network.BinnieCorePacketID; -import binnie.core.network.BinniePacketHandler; -import binnie.core.network.IPacketID; -import binnie.core.proxy.BinnieProxy; -import binnie.core.proxy.IBinnieProxy; -import binnie.core.triggers.ModuleTrigger; -import binnie.craftgui.minecraft.ModuleCraftGUI; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.ForestryEvent; -import forestry.plugins.PluginManager; - -@Mod(modid="BinnieCore", name="Binnie Core", useMetadata=true) -public final class BinnieCore - extends AbstractMod -{ - @Mod.Instance("BinnieCore") - public static BinnieCore instance; - @SidedProxy(clientSide="binnie.core.proxy.BinnieProxyClient", serverSide="binnie.core.proxy.BinnieProxyServer") - public static BinnieProxy proxy; - public static int multipassRenderID; - - @Mod.EventHandler - public void preInit(FMLPreInitializationEvent evt) - { - Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this); - for (ManagerBase baseManager : Binnie.Managers) { - addModule(baseManager); - } - addModule(new ModuleCraftGUI()); - addModule(new ModuleStorage()); - //addModule(new ModuleItems()); - if (Loader.isModLoaded("BuildCraft|Silicon")) { - addModule(new ModuleTrigger()); - } - preInit(); - } - - @Mod.EventHandler - public void init(FMLInitializationEvent evt) - { - init(); - } - - @Mod.EventHandler - public void postInit(FMLPostInitializationEvent evt) - { - postInit(); - } - - public IBinnieGUID[] getGUIDs() - { - return BinnieCoreGUI.values(); - } - - public void preInit() - { - instance = this; - FieldParser.parsers.add(new ItemParser()); - - super.preInit(); - } - - public void init() - { - super.init(); - for (AbstractMod mod : getActiveMods()) { - NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod)); - } - multipassRenderID = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer()); - - GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata"); - } - - public static boolean isLepidopteryActive() - { - return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled(); - } - - public static boolean isApicultureActive() - { - return PluginManager.Module.APICULTURE.isEnabled(); - } - - public static boolean isArboricultureActive() - { - return PluginManager.Module.ARBORICULTURE.isEnabled(); - } - - public static boolean isBotanyActive() - { - return ConfigurationMods.botany; - } - - public static boolean isGeneticsActive() - { - return ConfigurationMods.genetics; - } - - public static boolean isExtraBeesActive() - { - return (ConfigurationMods.extraBees) && (isApicultureActive()); - } - - public static boolean isExtraTreesActive() - { - return (ConfigurationMods.extraTrees) && (isArboricultureActive()); - } - - public void postInit() - { - super.postInit(); - } - - private static List<AbstractMod> modList = new ArrayList(); - public static MachineGroup packageCompartment; - public static ItemGenesis genesis; - public static ItemFieldKit fieldKit; - - static void registerMod(AbstractMod mod) - { - modList.add(mod); - } - - private static List<AbstractMod> getActiveMods() - { - List<AbstractMod> list = new ArrayList(); - for (AbstractMod mod : modList) { - if (mod.isActive()) { - list.add(mod); - } - } - return list; - } - - @SubscribeEvent - @SideOnly(Side.CLIENT) - public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) - { - try - { - EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName()); - if (player == null) { - return; - } - event.tracker.synchToPlayer(player); - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("species", event.species.getUID()); - } - catch (Exception e) {} - } - - public String getChannel() - { - return "BIN"; - } - - public IBinnieProxy getProxy() - { - return proxy; - } - - public String getModID() - { - return "binniecore"; - } - - public IPacketID[] getPacketIDs() - { - return BinnieCorePacketID.values(); - } - - @SubscribeEvent - @SideOnly(Side.CLIENT) - public void handleTextureRemap(TextureStitchEvent.Pre event) - { - if (event.map.getTextureType() == 0) { - //Binnie.Liquid.reloadIcons(event.map); - } - Binnie.Resource.registerIcons(event.map, event.map.getTextureType()); - } - - public Class<?>[] getConfigs() - { - return new Class[] { ConfigurationMain.class }; - } - - protected Class<? extends BinniePacketHandler> getPacketHandler() - { - return PacketHandler.class; - } - - public static class PacketHandler - extends BinniePacketHandler - { - public PacketHandler() - { - super(instance); - } - } - - public boolean isActive() - { - return true; - } -} diff --git a/src/Java/binnie/core/IInitializable.java b/src/Java/binnie/core/IInitializable.java deleted file mode 100644 index 7a357faa12..0000000000 --- a/src/Java/binnie/core/IInitializable.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core; - -public abstract interface IInitializable -{ - public abstract void preInit(); - - public abstract void init(); - - public abstract void postInit(); -} diff --git a/src/Java/binnie/core/ManagerBase.java b/src/Java/binnie/core/ManagerBase.java deleted file mode 100644 index 9627ed20bd..0000000000 --- a/src/Java/binnie/core/ManagerBase.java +++ /dev/null @@ -1,19 +0,0 @@ -package binnie.core; - -import binnie.Binnie; -import java.util.List; - -public abstract class ManagerBase - implements IInitializable -{ - public ManagerBase() - { - Binnie.Managers.add(this); - } - - public void preInit() {} - - public void init() {} - - public void postInit() {} -} diff --git a/src/Java/binnie/core/Mods.java b/src/Java/binnie/core/Mods.java deleted file mode 100644 index 9c242aa712..0000000000 --- a/src/Java/binnie/core/Mods.java +++ /dev/null @@ -1 +0,0 @@ -// INTERNAL ERROR //
\ No newline at end of file diff --git a/src/Java/binnie/core/block/BlockMetadata.java b/src/Java/binnie/core/block/BlockMetadata.java deleted file mode 100644 index 39b461d01d..0000000000 --- a/src/Java/binnie/core/block/BlockMetadata.java +++ /dev/null @@ -1,138 +0,0 @@ -package binnie.core.block; - -import binnie.core.BinnieCore; -import binnie.core.proxy.BinnieProxy; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.PlayerCapabilities; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockMetadata - extends BlockContainer - implements IBlockMetadata -{ - public BlockMetadata(Material material) - { - super(material); - } - - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) - { - return getBlockDropped(this, world, x, y, z, blockMeta); - } - - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) - { - return breakBlock(this, player, world, x, y, z); - } - - public TileEntity createNewTileEntity(World var1, int i) - { - return new TileEntityMetadata(); - } - - public boolean hasTileEntity(int meta) - { - return true; - } - - public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) - { - super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); - TileEntity tileentity = par1World.getTileEntity(par2, par3, par4); - return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; - } - - public IIcon getIcon(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) - { - int metadata = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4); - return getIcon(par5, metadata); - } - - public String getBlockName(ItemStack par1ItemStack) - { - return getLocalizedName(); - } - - public void getBlockTooltip(ItemStack par1ItemStack, List par3List) {} - - public int getPlacedMeta(ItemStack item, World world, int x, int y, int z, ForgeDirection clickedBlock) - { - int damage = TileEntityMetadata.getItemDamage(item); - return damage; - } - - public int getDroppedMeta(int tileMeta, int blockMeta) - { - return tileMeta; - } - - public static ArrayList<ItemStack> getBlockDropped(IBlockMetadata block, World world, int x, int y, int z, int blockMeta) - { - ArrayList<ItemStack> array = new ArrayList(); - TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z); - if ((tile != null) && (!tile.hasDroppedBlock())) - { - int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata()); - array.add(TileEntityMetadata.getItemStack((Block)block, meta)); - } - return array; - } - - static int temporyMeta = -1; - - public static boolean breakBlock(IBlockMetadata block, EntityPlayer player, World world, int i, int j, int k) - { - List<ItemStack> drops = new ArrayList(); - - Block block2 = (Block)block; - - TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k); - if ((tile != null) && (!tile.hasDroppedBlock())) - { - int tileMeta = TileEntityMetadata.getTileMetadata(world, i, j, k); - drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0); - } - boolean hasBeenBroken = world.setBlockToAir(i, j, k); - if ((hasBeenBroken) && (BinnieCore.proxy.isSimulating(world)) && (drops.size() > 0) && ((player == null) || (!player.capabilities.isCreativeMode))) - { - for (ItemStack drop : drops) { - block.dropAsStack(world, i, j, k, drop); - } - tile.dropBlock(); - } - return hasBeenBroken; - } - - public void dropAsStack(World world, int x, int y, int z, ItemStack drop) - { - dropBlockAsItem(world, x, y, z, drop); - } - - public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) - { - super.breakBlock(par1World, par2, par3, par4, par5, par6); - par1World.removeTileEntity(par2, par3, par4); - } - - public static ItemStack getPickBlock(World world, int x, int y, int z) - { - List<ItemStack> list = getBlockDropped((IBlockMetadata)world.getBlock(x, y, z), world, x, y, z, world.getBlockMetadata(x, y, z)); - return list.isEmpty() ? null : (ItemStack)list.get(0); - } - - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) - { - return getPickBlock(world, x, y, z); - } -} diff --git a/src/Java/binnie/core/block/IBlockMetadata.java b/src/Java/binnie/core/block/IBlockMetadata.java deleted file mode 100644 index b182139de7..0000000000 --- a/src/Java/binnie/core/block/IBlockMetadata.java +++ /dev/null @@ -1,21 +0,0 @@ -package binnie.core.block; - -import java.util.List; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public abstract interface IBlockMetadata - extends ITileEntityProvider -{ - public abstract int getPlacedMeta(ItemStack paramItemStack, World paramWorld, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection); - - public abstract int getDroppedMeta(int paramInt1, int paramInt2); - - public abstract String getBlockName(ItemStack paramItemStack); - - public abstract void getBlockTooltip(ItemStack paramItemStack, List paramList); - - public abstract void dropAsStack(World paramWorld, int paramInt1, int paramInt2, int paramInt3, ItemStack paramItemStack); -} diff --git a/src/Java/binnie/core/block/IMultipassBlock.java b/src/Java/binnie/core/block/IMultipassBlock.java deleted file mode 100644 index fd578c0ee5..0000000000 --- a/src/Java/binnie/core/block/IMultipassBlock.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.block; - -public abstract interface IMultipassBlock -{ - public abstract int getNumberOfPasses(); - - public abstract int colorMultiplier(int paramInt); -} diff --git a/src/Java/binnie/core/block/ItemMetadata.java b/src/Java/binnie/core/block/ItemMetadata.java deleted file mode 100644 index a3cd5173a9..0000000000 --- a/src/Java/binnie/core/block/ItemMetadata.java +++ /dev/null @@ -1,67 +0,0 @@ -package binnie.core.block; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ItemMetadata - extends ItemBlock -{ - public ItemMetadata(Block block) - { - super(block); - } - - public int getMetadata(int par1) - { - return 0; - } - - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) - { - Block block = this.field_150939_a; - if (!(block instanceof IBlockMetadata)) { - return false; - } - int placedMeta = ((IBlockMetadata)block).getPlacedMeta(stack, world, x, y, z, net.minecraftforge.common.util.ForgeDirection.values()[side]); - if (placedMeta < 0) { - return false; - } - if (!world.setBlock(x, y, z, block, metadata, 3)) { - return false; - } - if (world.getBlock(x, y, z) == block) - { - TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z); - if (tile != null) { - tile.setTileMetadata(placedMeta, false); - } - block.onBlockPlacedBy(world, x, y, z, player, stack); - block.onPostBlockPlaced(world, x, y, z, metadata); - } - return true; - } - - @SideOnly(Side.CLIENT) - public String getItemStackDisplayName(ItemStack par1ItemStack) - { - return ((IBlockMetadata)this.field_150939_a).getBlockName(par1ItemStack); - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - ((IBlockMetadata)this.field_150939_a).getBlockTooltip(par1ItemStack, par3List); - } - - public IIcon getIconFromDamage(int par1) - { - return this.field_150939_a.getIcon(1, par1); - } -} diff --git a/src/Java/binnie/core/block/ItemMetadataRenderer.java b/src/Java/binnie/core/block/ItemMetadataRenderer.java deleted file mode 100644 index e96dd068c1..0000000000 --- a/src/Java/binnie/core/block/ItemMetadataRenderer.java +++ /dev/null @@ -1,64 +0,0 @@ -package binnie.core.block; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; -import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; -import org.lwjgl.opengl.GL11; - -public class ItemMetadataRenderer - implements IItemRenderer -{ - public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) - { - return (type == IItemRenderer.ItemRenderType.INVENTORY) || (type == IItemRenderer.ItemRenderType.ENTITY) || (type == IItemRenderer.ItemRenderType.EQUIPPED) || (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON); - } - - public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) - { - if (type == IItemRenderer.ItemRenderType.INVENTORY) { - return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK; - } - if (type == IItemRenderer.ItemRenderType.ENTITY) { - return (helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING) || (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION); - } - if ((type == IItemRenderer.ItemRenderType.EQUIPPED) || (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON)) { - return helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK; - } - return false; - } - - public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) - { - GL11.glPushMatrix(); - - - - - - - - - - - Block block = Block.getBlockFromItem(item.getItem()); - if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) { - GL11.glTranslated(0.5D, 0.5D, 0.5D); - } - if ((type == IItemRenderer.ItemRenderType.INVENTORY) && - (block.getRenderBlockPass() != 0)) - { - GL11.glAlphaFunc(516, 0.1F); - GL11.glEnable(3042); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - } - GL11.glPushMatrix(); - ((RenderBlocks)data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0F); - - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } -} diff --git a/src/Java/binnie/core/block/MultipassBlockRenderer.java b/src/Java/binnie/core/block/MultipassBlockRenderer.java deleted file mode 100644 index cc809fb8e5..0000000000 --- a/src/Java/binnie/core/block/MultipassBlockRenderer.java +++ /dev/null @@ -1,106 +0,0 @@ -package binnie.core.block; - -import binnie.core.BinnieCore; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.world.IBlockAccess; -import org.lwjgl.opengl.GL11; - -public class MultipassBlockRenderer - implements ISimpleBlockRenderingHandler -{ - public static MultipassBlockRenderer instance; - - public MultipassBlockRenderer() - { - instance = this; - } - - private void setColour(Tessellator tess, int colour) - { - float var6 = (colour >> 16 & 0xFF) / 255.0F; - float var7 = (colour >> 8 & 0xFF) / 255.0F; - float var8 = (colour & 0xFF) / 255.0F; - GL11.glColor3f(var6, var7, var8); - } - - private static int layer = 0; - - public static int getLayer() - { - return layer; - } - - public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) - { - block.setBlockBoundsForItemRender(); - renderer.setRenderBoundsFromBlock(block); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - for (layer = 0; layer < ((IMultipassBlock)block).getNumberOfPasses(); layer += 1) { - renderItem(block, renderer, meta); - } - layer = 0; - } - - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - boolean r = true; - for (layer = 0; layer < ((IMultipassBlock)block).getNumberOfPasses(); layer += 1) { - r = renderer.renderStandardBlock(block, x, y, z); - } - layer = 0; - return r; - } - - public boolean shouldRender3DInInventory(int i) - { - return true; - } - - public int getRenderId() - { - return BinnieCore.multipassRenderID; - } - - public void renderItem(Block block, RenderBlocks renderer, int meta) - { - setColor(((IMultipassBlock)block).colorMultiplier(meta)); - - Tessellator tessellator = Tessellator.instance; - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); - tessellator.draw(); - } - - public void setColor(int l) - { - float f = (l >> 16 & 0xFF) / 255.0F; - float f1 = (l >> 8 & 0xFF) / 255.0F; - float f2 = (l & 0xFF) / 255.0F; - GL11.glColor3f(f, f1, f2); - } -} diff --git a/src/Java/binnie/core/block/MultipassItemRenderer.java b/src/Java/binnie/core/block/MultipassItemRenderer.java deleted file mode 100644 index 6e53642b2f..0000000000 --- a/src/Java/binnie/core/block/MultipassItemRenderer.java +++ /dev/null @@ -1,78 +0,0 @@ -package binnie.core.block; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; -import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; -import org.lwjgl.opengl.GL11; - -public class MultipassItemRenderer - implements IItemRenderer -{ - private void render(RenderBlocks renderer, ItemStack item, float f, float g, float h) - { - GL11.glTranslatef(f, g, h); - - Block block = ((ItemBlock)item.getItem()).field_150939_a; - - GL11.glEnable(3008); - if (block.getRenderBlockPass() != 0) - { - GL11.glAlphaFunc(516, 0.1F); - GL11.glEnable(3042); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - } - else - { - GL11.glAlphaFunc(516, 0.5F); - GL11.glDisable(3042); - } - MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer); - if (block.getRenderBlockPass() == 0) { - GL11.glAlphaFunc(516, 0.1F); - } - GL11.glTranslatef(-f, -g, -h); - } - - public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) - { - switch (1.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()]) - { - case 1: - return true; - case 2: - return true; - case 3: - return true; - case 4: - return true; - } - return false; - } - - public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) - { - return true; - } - - public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) - { - switch (1.$SwitchMap$net$minecraftforge$client$IItemRenderer$ItemRenderType[type.ordinal()]) - { - case 1: - render((RenderBlocks)data[0], item, 0.0F, 0.0F, 0.0F); - break; - case 2: - case 4: - render((RenderBlocks)data[0], item, 0.5F, 0.5F, 0.5F); - break; - case 3: - render((RenderBlocks)data[0], item, 0.0F, 0.0F, 0.0F); - break; - } - } -} diff --git a/src/Java/binnie/core/block/TileEntityMetadata.java b/src/Java/binnie/core/block/TileEntityMetadata.java deleted file mode 100644 index 28563e66e7..0000000000 --- a/src/Java/binnie/core/block/TileEntityMetadata.java +++ /dev/null @@ -1,116 +0,0 @@ -package binnie.core.block; - -import binnie.core.BinnieCore; -import binnie.core.network.packet.MessageMetadata; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class TileEntityMetadata - extends TileEntity -{ - private int meta; - - public boolean receiveClientEvent(int par1, int par2) - { - if (par1 == 42) - { - this.meta = par2; - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - return true; - } - - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.meta = nbt.getInteger("meta"); - } - - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("meta", this.meta); - } - - public boolean canUpdate() - { - return false; - } - - public int getTileMetadata() - { - return this.meta; - } - - public void setTileMetadata(int meta, boolean notify) - { - if (this.meta != meta) - { - this.meta = meta; - if (notify) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - } - } - - public Packet getDescriptionPacket() - { - return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageMetadata(this.xCoord, this.yCoord, this.zCoord, this.meta).GetMessage()); - } - - public static TileEntityMetadata getTile(IBlockAccess world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TileEntityMetadata)) { - return null; - } - return (TileEntityMetadata)tile; - } - - public static ItemStack getItemStack(Block block, int damage) - { - ItemStack item = new ItemStack(block, 1, 0); - setItemDamage(item, damage); - return item; - } - - public static void setItemDamage(ItemStack item, int i) - { - item.setItemDamage(i < 16387 ? i : 16387); - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("meta", i); - item.setTagCompound(tag); - } - - public static int getItemDamage(ItemStack item) - { - if ((item.hasTagCompound()) && (item.getTagCompound().hasKey("meta"))) { - return item.getTagCompound().getInteger("meta"); - } - return item.getItemDamage(); - } - - public static int getTileMetadata(IBlockAccess world, int x, int y, int z) - { - TileEntityMetadata tile = getTile(world, x, y, z); - return tile == null ? 0 : tile.getTileMetadata(); - } - - private boolean droppedBlock = false; - - public boolean hasDroppedBlock() - { - return this.droppedBlock; - } - - public void dropBlock() - { - this.droppedBlock = true; - } -} diff --git a/src/Java/binnie/core/circuits/BinnieCircuit.java b/src/Java/binnie/core/circuits/BinnieCircuit.java deleted file mode 100644 index e7e2db0203..0000000000 --- a/src/Java/binnie/core/circuits/BinnieCircuit.java +++ /dev/null @@ -1,80 +0,0 @@ -package binnie.core.circuits; - -import forestry.api.circuits.ChipsetManager; -import forestry.api.circuits.ICircuit; -import forestry.api.circuits.ICircuitLayout; -import forestry.api.circuits.ICircuitRegistry; -import forestry.api.circuits.ISolderManager; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -public class BinnieCircuit - implements ICircuit -{ - private String uid; - private int limit; - private List<String> tooltips = new ArrayList(); - - public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) - { - this.uid = ("binnie.circuit." + uid); - this.limit = limit; - ChipsetManager.circuitRegistry.registerCircuit(this); - if (itemStack != null) { - ChipsetManager.solderManager.addRecipe(layout, itemStack, this); - } - } - - public BinnieCircuit(String uid, int limit, ICircuitLayout layout, Item item, int itemMeta) - { - this(uid, limit, layout, new ItemStack(item, 1, itemMeta)); - } - - public void addTooltipString(String string) - { - this.tooltips.add(string); - } - - public String getUID() - { - return this.uid; - } - - public boolean requiresDiscovery() - { - return false; - } - - public int getLimit() - { - return this.limit; - } - - public String getName() - { - return this.uid; - } - - public boolean isCircuitable(TileEntity tile) - { - return false; - } - - public void onInsertion(int slot, TileEntity tile) {} - - public void onLoad(int slot, TileEntity tile) {} - - public void onRemoval(int slot, TileEntity tile) {} - - public void onTick(int slot, TileEntity tile) {} - - public void addTooltip(List<String> list) - { - for (String string : this.tooltips) { - list.add(" - " + string); - } - } -} diff --git a/src/Java/binnie/core/circuits/BinnieCircuitLayout.java b/src/Java/binnie/core/circuits/BinnieCircuitLayout.java deleted file mode 100644 index 0f160054ce..0000000000 --- a/src/Java/binnie/core/circuits/BinnieCircuitLayout.java +++ /dev/null @@ -1,37 +0,0 @@ -package binnie.core.circuits; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.language.ManagerLanguage; -import forestry.api.circuits.ChipsetManager; -import forestry.api.circuits.ICircuitLayout; -import forestry.api.circuits.ICircuitRegistry; - -public class BinnieCircuitLayout - implements ICircuitLayout -{ - private String uid; - private AbstractMod mod; - - public BinnieCircuitLayout(AbstractMod mod, String uid) - { - this.uid = uid; - this.mod = mod; - ChipsetManager.circuitRegistry.registerLayout(this); - } - - public String getUID() - { - return "binnie.circuitLayout" + this.uid; - } - - public String getName() - { - return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase()); - } - - public String getUsage() - { - return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage"); - } -} diff --git a/src/Java/binnie/core/gui/BinnieCoreGUI.java b/src/Java/binnie/core/gui/BinnieCoreGUI.java deleted file mode 100644 index 50f99306f1..0000000000 --- a/src/Java/binnie/core/gui/BinnieCoreGUI.java +++ /dev/null @@ -1,54 +0,0 @@ -package binnie.core.gui; - -import binnie.core.machines.storage.WindowCompartment; -import binnie.craftgui.binniecore.WindowFieldKit; -import binnie.craftgui.binniecore.WindowGenesis; -import binnie.craftgui.minecraft.Window; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public enum BinnieCoreGUI - implements IBinnieGUID -{ - Compartment, FieldKit, Genesis; - - private BinnieCoreGUI() {} - - public Window getWindow(EntityPlayer player, IInventory object, Side side) - throws Exception - { - switch (1.$SwitchMap$binnie$core$gui$BinnieCoreGUI[ordinal()]) - { - case 1: - return new WindowCompartment(player, object, side); - case 2: - return new WindowFieldKit(player, null, side); - case 3: - return new WindowGenesis(player, null, side); - } - return null; - } - - public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) - { - Window window = null; - TileEntity tileEntity = world.getTileEntity(x, y, z); - - IInventory object = null; - if ((tileEntity instanceof IInventory)) { - object = (IInventory)tileEntity; - } - try - { - window = getWindow(player, object, side); - } - catch (Exception e) - { - e.printStackTrace(); - } - return window; - } -} diff --git a/src/Java/binnie/core/gui/BinnieGUIHandler.java b/src/Java/binnie/core/gui/BinnieGUIHandler.java deleted file mode 100644 index c146d914e0..0000000000 --- a/src/Java/binnie/core/gui/BinnieGUIHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -package binnie.core.gui; - -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.proxy.BinnieProxy; -import binnie.craftgui.minecraft.Window; -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public final class BinnieGUIHandler - implements IGuiHandler -{ - private AbstractMod mod; - - public BinnieGUIHandler(AbstractMod mod) - { - this.mod = mod; - } - - public final Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { - Window window = getWindow(id, player, world, x, y, z, Side.SERVER); - if (window == null) { - return null; - } - window.initialiseServer(); - - return window.getContainer(); - } - - public final Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) - { - if (BinnieCore.proxy.isSimulating(world)) { - return getServerGuiElement(id, player, world, x, y, z); - } - Window window = getWindow(id, player, world, x, y, z, Side.CLIENT); - if (window == null) { - return null; - } - return window.getGui(); - } - - public Window getWindow(int id, EntityPlayer player, World world, int x, int y, int z, Side side) - { - for (IBinnieGUID guid : this.mod.getGUIDs()) { - if (guid.ordinal() == id) { - return guid.getWindow(player, world, x, y, z, side); - } - } - return null; - } -} diff --git a/src/Java/binnie/core/gui/IBinnieGUID.java b/src/Java/binnie/core/gui/IBinnieGUID.java deleted file mode 100644 index be0fd174da..0000000000 --- a/src/Java/binnie/core/gui/IBinnieGUID.java +++ /dev/null @@ -1,13 +0,0 @@ -package binnie.core.gui; - -import binnie.core.network.IOrdinaled; -import binnie.craftgui.minecraft.Window; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public abstract interface IBinnieGUID - extends IOrdinaled -{ - public abstract Window getWindow(EntityPlayer paramEntityPlayer, World paramWorld, int paramInt1, int paramInt2, int paramInt3, Side paramSide); -} diff --git a/src/Java/binnie/core/item/IItemEnum.java b/src/Java/binnie/core/item/IItemEnum.java deleted file mode 100644 index 70b27d7aa7..0000000000 --- a/src/Java/binnie/core/item/IItemEnum.java +++ /dev/null @@ -1,14 +0,0 @@ -package binnie.core.item; - -import net.minecraft.item.ItemStack; - -public abstract interface IItemEnum -{ - public abstract boolean isActive(); - - public abstract String getName(ItemStack paramItemStack); - - public abstract int ordinal(); - - public abstract ItemStack get(int paramInt); -} diff --git a/src/Java/binnie/core/item/IItemMisc.java b/src/Java/binnie/core/item/IItemMisc.java deleted file mode 100644 index 1538297884..0000000000 --- a/src/Java/binnie/core/item/IItemMisc.java +++ /dev/null @@ -1,19 +0,0 @@ -package binnie.core.item; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public abstract interface IItemMisc - extends IItemEnum -{ - public abstract IIcon getIcon(ItemStack paramItemStack); - - @SideOnly(Side.CLIENT) - public abstract void registerIcons(IIconRegister paramIIconRegister); - - public abstract void addInformation(List paramList); -} diff --git a/src/Java/binnie/core/item/ItemFieldKit.java b/src/Java/binnie/core/item/ItemFieldKit.java deleted file mode 100644 index 0a6ec0b813..0000000000 --- a/src/Java/binnie/core/item/ItemFieldKit.java +++ /dev/null @@ -1,82 +0,0 @@ -package binnie.core.item; - -import binnie.core.BinnieCore; -import binnie.core.gui.BinnieCoreGUI; -import binnie.core.proxy.BinnieProxy; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ItemFieldKit - extends Item -{ - private IIcon fieldKit0; - private IIcon fieldKit1; - private IIcon fieldKit2; - private IIcon fieldKit3; - - public ItemFieldKit() - { - setUnlocalizedName("fieldKit"); - setCreativeTab(CreativeTabs.tabTools); - setMaxStackSize(1); - setMaxDamage(64); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register) - { - this.fieldKit0 = BinnieCore.proxy.getIcon(register, "fieldKit"); - this.fieldKit1 = BinnieCore.proxy.getIcon(register, "fieldKit1"); - this.fieldKit2 = BinnieCore.proxy.getIcon(register, "fieldKit2"); - this.fieldKit3 = BinnieCore.proxy.getIcon(register, "fieldKit3"); - this.itemIcon = this.fieldKit0; - } - - public IIcon getIcon(ItemStack stack, int pass) - { - int damage = stack.getItemDamage(); - if (damage < 24) { - return this.fieldKit3; - } - if (damage < 48) { - return this.fieldKit2; - } - if (damage < 64) { - return this.fieldKit1; - } - return this.fieldKit0; - } - - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) - { - if (!player.isSneaking()) { - BinnieCore.proxy.openGui(BinnieCoreGUI.FieldKit, player, (int)player.posX, (int)player.posY, (int)player.posZ); - } - return itemstack; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) - { - int i = getMaxDamage() - p_77624_1_.getItemDamage(); - if (i == 0) { - p_77624_3_.add("No paper"); - } else { - p_77624_3_.add("" + i + " sheet" + (i > 1 ? "s" : "") + " of paper"); - } - super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } - - public String getItemStackDisplayName(ItemStack p_77653_1_) - { - return "Field Kit"; - } -} diff --git a/src/Java/binnie/core/item/ItemGenesis.java b/src/Java/binnie/core/item/ItemGenesis.java deleted file mode 100644 index 1e946372be..0000000000 --- a/src/Java/binnie/core/item/ItemGenesis.java +++ /dev/null @@ -1,42 +0,0 @@ -package binnie.core.item; - -import binnie.core.BinnieCore; -import binnie.core.gui.BinnieCoreGUI; -import binnie.core.proxy.BinnieProxy; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.core.Tabs; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class ItemGenesis - extends Item -{ - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register) - { - this.itemIcon = BinnieCore.proxy.getIcon(register, "genesis"); - } - - public ItemGenesis() - { - setCreativeTab(Tabs.tabApiculture); - setUnlocalizedName("genesis"); - setMaxStackSize(1); - } - - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) - { - BinnieCore.proxy.openGui(BinnieCoreGUI.Genesis, player, (int)player.posX, (int)player.posY, (int)player.posZ); - - return itemstack; - } - - public String getItemStackDisplayName(ItemStack i) - { - return "Genesis"; - } -} diff --git a/src/Java/binnie/core/item/ItemMisc.java b/src/Java/binnie/core/item/ItemMisc.java deleted file mode 100644 index db54b2c1dd..0000000000 --- a/src/Java/binnie/core/item/ItemMisc.java +++ /dev/null @@ -1,81 +0,0 @@ -package binnie.core.item; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class ItemMisc - extends Item -{ - private IItemMisc[] items; - - protected ItemMisc(CreativeTabs tab, IItemMisc[] items2) - { - setCreativeTab(tab); - setHasSubtypes(true); - setUnlocalizedName("misc"); - this.items = items2; - } - - @SideOnly(Side.CLIENT) - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (IItemMisc item : this.items) { - if (item.isActive()) { - par3List.add(getStack(item, 1)); - } - } - } - - private IItemMisc getItem(int damage) - { - return damage >= this.items.length ? this.items[0] : this.items[damage]; - } - - public ItemStack getStack(IItemMisc type, int size) - { - return new ItemStack(this, size, type.ordinal()); - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); - IItemMisc item = getItem(par1ItemStack.getItemDamage()); - if (item != null) { - item.addInformation(par3List); - } - } - - public String getItemStackDisplayName(ItemStack stack) - { - IItemMisc item = getItem(stack.getItemDamage()); - return item != null ? item.getName(stack) : "null"; - } - - public IIcon getIcon(ItemStack stack, int pass) - { - IItemMisc item = getItem(stack.getItemDamage()); - return item != null ? item.getIcon(stack) : null; - } - - public IIcon getIconFromDamage(int damage) - { - IItemMisc item = getItem(damage); - return item != null ? item.getIcon(null) : null; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register) - { - for (IItemMisc item : this.items) { - item.registerIcons(register); - } - } -} diff --git a/src/Java/binnie/core/item/ManagerItem.java b/src/Java/binnie/core/item/ManagerItem.java deleted file mode 100644 index 39ea70f826..0000000000 --- a/src/Java/binnie/core/item/ManagerItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.core.item; - -import net.minecraft.creativetab.CreativeTabs; - -public class ManagerItem -{ - public ItemMisc registerMiscItems(IItemMisc[] items, CreativeTabs tab) - { - return new ItemMisc(tab, items); - } -} diff --git a/src/Java/binnie/core/language/ManagerLanguage.java b/src/Java/binnie/core/language/ManagerLanguage.java deleted file mode 100644 index b4deb37344..0000000000 --- a/src/Java/binnie/core/language/ManagerLanguage.java +++ /dev/null @@ -1,59 +0,0 @@ -package binnie.core.language; - -import binnie.core.AbstractMod; -import binnie.core.ManagerBase; -import java.util.HashMap; -import java.util.Map; -import net.minecraft.util.StatCollector; - -public class ManagerLanguage - extends ManagerBase -{ - private Map<Object, String> objNames = new HashMap(); - - public void addObjectName(Object obj, String name) - { - this.objNames.put(obj, name); - } - - public String unlocalised(AbstractMod mod, String id) - { - return mod.getModID() + "." + id; - } - - public String localise(Object key) - { - String loc = StatCollector.translateToLocal(key.toString()); - if (loc.equals(key.toString())) { - return this.objNames.containsKey(key) ? localise(this.objNames.get(key)) : key.toString(); - } - return loc; - } - - public String localise(AbstractMod mod, String id) - { - return localise(unlocalised(mod, id)); - } - - public String localiseOrBlank(AbstractMod mod, String id) - { - return localiseOrBlank(unlocalised(mod, id)); - } - - public String localise(AbstractMod mod, String id, Object... objs) - { - return String.format(localise(mod, id), objs); - } - - public String localiseOrBlank(Object key) - { - String trans = localise(key); - return trans.equals(key) ? "" : trans; - } - - public boolean canLocalise(Object key) - { - String trans = localise(key); - return !trans.equals(key); - } -} diff --git a/src/Java/binnie/core/machines/BlockMachine.java b/src/Java/binnie/core/machines/BlockMachine.java deleted file mode 100644 index e2ad883207..0000000000 --- a/src/Java/binnie/core/machines/BlockMachine.java +++ /dev/null @@ -1,180 +0,0 @@ -package binnie.core.machines; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import binnie.Binnie; -import binnie.core.BinnieCore; -import binnie.core.machines.component.IRender; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -class BlockMachine - extends BlockContainer - implements IBlockMachine -{ - private MachineGroup group; - - public BlockMachine(MachineGroup group, String blockName) - { - super(Material.iron); - this.group = group; - setHardness(1.5F); - setBlockName(blockName); - } - - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList) - { - for (MachinePackage pack : this.group.getPackages()) { - if (pack.isActive()) { - itemList.add(new ItemStack(this, 1, pack.getMetadata().intValue())); - } - } - } - - public boolean isOpaqueCube() - { - return false; - } - - public boolean renderAsNormalBlock() - { - return !this.group.customRenderer; - } - - public int getRenderType() - { - return Binnie.Machine.getMachineRenderID(); - } - - public TileEntity createTileEntity(World world, int metadata) - { - if (this.group.getPackage(metadata) == null) { - return null; - } - return this.group.getPackage(metadata).createTileEntity(); - } - - public MachinePackage getPackage(int meta) - { - return this.group.getPackage(meta); - } - - public String getMachineName(int meta) - { - return getPackage(meta) == null ? "Unnamed Machine" : getPackage(meta).getDisplayName(); - } - - public int damageDropped(int par1) - { - return par1; - } - - public TileEntity createNewTileEntity(World var1, int meta) - { - return createTileEntity(var1, meta); - } - - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (!BinnieCore.proxy.isSimulating(world)) { - return true; - } - if (player.isSneaking()) { - return true; - } - TileEntity entity = world.getTileEntity(x, y, z); - if ((entity instanceof TileEntityMachine)) { - ((TileEntityMachine)entity).getMachine().onRightClick(world, player, x, y, z); - } - return true; - } - - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) - { - super.onBlockPlacedBy(world, i, j, k, entityliving, stack); - if (!BinnieCore.proxy.isSimulating(world)) { - return; - } - IMachine machine = Machine.getMachine(world.getTileEntity(i, j, k)); - if (machine == null) { - return; - } - if ((entityliving instanceof EntityPlayer)) { - machine.setOwner(((EntityPlayer)entityliving).getGameProfile()); - } - } - - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) - { - TileEntity entity = world.getTileEntity(x, y, z); - if (((entity instanceof TileEntityMachine)) && (((TileEntityMachine)entity).getMachine().hasInterface(IMachineTexturedFaces.class))) { - return ((IMachineTexturedFaces)((TileEntityMachine)entity).getMachine().getInterface(IMachineTexturedFaces.class)).getIcon(side); - } - return Blocks.dirt.getIcon(0, 0); - } - - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) - { - TileEntity tileentity = world.getTileEntity(x, y, z); - if (!(tileentity instanceof TileEntityMachine)) { - return; - } - TileEntityMachine entity = (TileEntityMachine)tileentity; - if (entity != null) { - entity.onBlockDestroy(); - } - super.breakBlock(world, x, y, z, par5, par6); - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister register) {} - - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random rand) - { - IMachine machine = Machine.getMachine(world.getTileEntity(x, y, z)); - if (machine != null) { - for (IRender.RandomDisplayTick renders : machine.getInterfaces(IRender.RandomDisplayTick.class)) { - renders.onRandomDisplayTick(world, x, y, z, rand); - } - } - } - - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - return new ArrayList(); - } - - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) - { - if ((BinnieCore.proxy.isSimulating(world)) && (canHarvestBlock(player, world.getBlockMetadata(x, y, z))) && - (!player.capabilities.isCreativeMode)) - { - int metadata = world.getBlockMetadata(x, y, z); - ItemStack stack = new ItemStack(Item.getItemFromBlock(this), 1, damageDropped(metadata)); - dropBlockAsItem(world, x, y, z, stack); - } - return world.setBlockToAir(x, y, z); - } - - public static abstract interface IMachineTexturedFaces - { - public abstract IIcon getIcon(int paramInt); - } -} diff --git a/src/Java/binnie/core/machines/IBlockMachine.java b/src/Java/binnie/core/machines/IBlockMachine.java deleted file mode 100644 index 01b7e321a1..0000000000 --- a/src/Java/binnie/core/machines/IBlockMachine.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.machines; - -abstract interface IBlockMachine -{ - public abstract MachinePackage getPackage(int paramInt); - - public abstract String getMachineName(int paramInt); -} diff --git a/src/Java/binnie/core/machines/IMachine.java b/src/Java/binnie/core/machines/IMachine.java deleted file mode 100644 index 9a57b0e019..0000000000 --- a/src/Java/binnie/core/machines/IMachine.java +++ /dev/null @@ -1,25 +0,0 @@ -package binnie.core.machines; - -import java.util.Collection; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public abstract interface IMachine - extends IOwnable -{ - public abstract void addComponent(MachineComponent paramMachineComponent); - - public abstract MachineUtil getMachineUtil(); - - public abstract <T> T getInterface(Class<T> paramClass); - - public abstract void markDirty(); - - public abstract World getWorld(); - - public abstract TileEntity getTileEntity(); - - public abstract <T> Collection<T> getInterfaces(Class<T> paramClass); - - public abstract MachinePackage getPackage(); -} diff --git a/src/Java/binnie/core/machines/IMachineType.java b/src/Java/binnie/core/machines/IMachineType.java deleted file mode 100644 index 06c02218a0..0000000000 --- a/src/Java/binnie/core/machines/IMachineType.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.core.machines; - -import binnie.core.network.IOrdinaled; - -public abstract interface IMachineType - extends IOrdinaled -{ - public abstract Class<? extends MachinePackage> getPackageClass(); - - public abstract boolean isActive(); -} diff --git a/src/Java/binnie/core/machines/IOwnable.java b/src/Java/binnie/core/machines/IOwnable.java deleted file mode 100644 index 78aa1a76f9..0000000000 --- a/src/Java/binnie/core/machines/IOwnable.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core.machines; - -import com.mojang.authlib.GameProfile; - -abstract interface IOwnable -{ - public abstract GameProfile getOwner(); - - public abstract void setOwner(GameProfile paramGameProfile); -} diff --git a/src/Java/binnie/core/machines/ItemMachine.java b/src/Java/binnie/core/machines/ItemMachine.java deleted file mode 100644 index 08426cdb7a..0000000000 --- a/src/Java/binnie/core/machines/ItemMachine.java +++ /dev/null @@ -1,29 +0,0 @@ -package binnie.core.machines; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class ItemMachine - extends ItemBlock -{ - private IBlockMachine associatedBlock; - - public ItemMachine(Block block) - { - super(block); - setMaxDamage(0); - setHasSubtypes(true); - this.associatedBlock = ((IBlockMachine)block); - } - - public int getMetadata(int i) - { - return i; - } - - public String getItemStackDisplayName(ItemStack itemstack) - { - return this.associatedBlock.getMachineName(itemstack.getItemDamage()); - } -} diff --git a/src/Java/binnie/core/machines/Machine.java b/src/Java/binnie/core/machines/Machine.java deleted file mode 100644 index 70dc65c485..0000000000 --- a/src/Java/binnie/core/machines/Machine.java +++ /dev/null @@ -1,318 +0,0 @@ -package binnie.core.machines; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import binnie.core.BinnieCore; -import binnie.core.machines.component.IInteraction; -import binnie.core.machines.component.IRender; -import binnie.core.machines.network.INetwork; -import binnie.core.machines.power.ITankMachine; -import binnie.core.network.BinnieCorePacketID; -import binnie.core.network.INetworkedEntity; -import binnie.core.network.packet.MessageTileNBT; -import binnie.core.network.packet.PacketPayload; - -import com.mojang.authlib.GameProfile; - -import cpw.mods.fml.relauncher.Side; -import forestry.api.core.INBTTagable; - -public class Machine - implements INetworkedEntity, INBTTagable, INetwork.TilePacketSync, IMachine, INetwork.GuiNBT -{ - private MachinePackage machinePackage; - private Map<Class, List<MachineComponent>> componentInterfaceMap = new LinkedHashMap(); - private Map<Class<? extends MachineComponent>, MachineComponent> componentMap = new LinkedHashMap(); - private TileEntity tile; - - public Machine(MachinePackage pack, TileEntity tile) - { - this.tile = tile; - - pack.createMachine(this); - this.machinePackage = pack; - } - - public void addComponent(MachineComponent component) - { - if (component == null) { - throw new NullPointerException("Can't have a null machine component!"); - } - component.setMachine(this); - this.componentMap.put(component.getClass(), component); - for (Class inter : component.getComponentInterfaces()) - { - if (!this.componentInterfaceMap.containsKey(inter)) { - this.componentInterfaceMap.put(inter, new ArrayList()); - } - ((List)this.componentInterfaceMap.get(inter)).add(component); - } - } - - public Collection<MachineComponent> getComponents() - { - return this.componentMap.values(); - } - - public <T extends MachineComponent> MachineComponent getComponent(Class<T> componentClass) - { - return hasComponent(componentClass) ? (MachineComponent)componentClass.cast(this.componentMap.get(componentClass)) : null; - } - - public <T> T getInterface(Class<T> interfaceClass) - { - if (hasInterface(interfaceClass)) { - return getInterfaces(interfaceClass).get(0); - } - if (interfaceClass.isInstance(getPackage())) { - return interfaceClass.cast(getPackage()); - } - for (MachineComponent component : getComponents()) { - if (interfaceClass.isInstance(component)) { - return interfaceClass.cast(component); - } - } - return null; - } - - public <T> List<T> getInterfaces(Class<T> interfaceClass) - { - ArrayList<T> interfaces = new ArrayList(); - if (!hasInterface(interfaceClass)) { - return interfaces; - } - for (MachineComponent component : (List)this.componentInterfaceMap.get(interfaceClass)) { - interfaces.add(interfaceClass.cast(component)); - } - return interfaces; - } - - public boolean hasInterface(Class<?> interfaceClass) - { - return this.componentInterfaceMap.containsKey(interfaceClass); - } - - public boolean hasComponent(Class<? extends MachineComponent> componentClass) - { - return this.componentMap.containsKey(componentClass); - } - - public TileEntity getTileEntity() - { - return this.tile; - } - - public void sendPacket() - { - if (!BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj())) { - return; - } - BinnieCore.proxy.sendNetworkEntityPacket((INetworkedEntity)getTileEntity()); - } - - public Side getSide() - { - return BinnieCore.proxy.isSimulating(getTileEntity().getWorldObj()) ? Side.SERVER : Side.CLIENT; - } - - public void writeToPacket(PacketPayload payload) - { - for (MachineComponent component : getComponents()) { - if ((component instanceof INetworkedEntity)) { - ((INetworkedEntity)component).writeToPacket(payload); - } - } - } - - public void readFromPacket(PacketPayload payload) - { - for (MachineComponent component : getComponents()) { - if ((component instanceof INetworkedEntity)) { - ((INetworkedEntity)component).readFromPacket(payload); - } - } - } - - public void onRightClick(World world, EntityPlayer player, int x, int y, int z) - { - for (IInteraction.RightClick component : getInterfaces(IInteraction.RightClick.class)) { - component.onRightClick(world, player, x, y, z); - } - } - - public void markDirty() - { - this.queuedInventoryUpdate = true; - } - - private boolean queuedInventoryUpdate = false; - - public void onUpdate() - { - if (BinnieCore.proxy.isSimulating(getWorld())) { - for (MachineComponent component : getComponents()) { - component.onUpdate(); - } - } else { - for (IRender.DisplayTick renders : getInterfaces(IRender.DisplayTick.class)) { - renders.onDisplayTick(getWorld(), getTileEntity().xCoord, getTileEntity().yCoord, getTileEntity().zCoord, getWorld().rand); - } - } - if (this.queuedInventoryUpdate) - { - for (MachineComponent component : getComponents()) { - component.onInventoryUpdate(); - } - this.queuedInventoryUpdate = false; - } - } - - public IInventory getInventory() - { - return (IInventory)getInterface(IInventory.class); - } - - public ITankMachine getTankContainer() - { - return (ITankMachine)getInterface(ITankMachine.class); - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - for (MachineComponent component : getComponents()) { - component.readFromNBT(nbttagcompound); - } - this.owner = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("owner")); - markDirty(); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - for (MachineComponent component : getComponents()) { - component.writeToNBT(nbttagcompound); - } - if (this.owner != null) - { - NBTTagCompound nbt = new NBTTagCompound(); - NBTUtil.func_152460_a(nbt, this.owner); - nbttagcompound.setTag("owner", nbt); - } - } - - public MachinePackage getPackage() - { - return this.machinePackage; - } - - public static IMachine getMachine(Object inventory) - { - if ((inventory != null) && ((inventory instanceof IMachine))) { - return (IMachine)inventory; - } - if ((inventory != null) && ((inventory instanceof TileEntityMachine))) { - return ((TileEntityMachine)inventory).getMachine(); - } - if ((inventory != null) && ((inventory instanceof MachineComponent))) { - return ((MachineComponent)inventory).getMachine(); - } - return null; - } - - public static <T> T getInterface(Class<T> interfac, Object inventory) - { - IMachine machine = getMachine(inventory); - if (machine != null) { - return machine.getInterface(interfac); - } - if (interfac.isInstance(inventory)) { - return interfac.cast(inventory); - } - return null; - } - - public MachineUtil getMachineUtil() - { - return new MachineUtil(this); - } - - public World getWorld() - { - return getTileEntity().getWorldObj(); - } - - public void onBlockDestroy() - { - for (MachineComponent component : getComponents()) { - component.onDestruction(); - } - } - - private int nextProgressBarID = 0; - - public int getUniqueProgressBarID() - { - return this.nextProgressBarID++; - } - - private GameProfile owner = null; - - public GameProfile getOwner() - { - return this.owner; - } - - public void setOwner(GameProfile owner) - { - this.owner = owner; - } - - public Packet getDescriptionPacket() - { - NBTTagCompound nbt = new NBTTagCompound(); - - syncToNBT(nbt); - if (nbt.hasNoTags()) { - return null; - } - return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageTileNBT(BinnieCorePacketID.TileDescriptionSync.ordinal(), getTileEntity(), nbt).GetMessage()); - } - - public void syncToNBT(NBTTagCompound nbt) - { - for (INetwork.TilePacketSync comp : getInterfaces(INetwork.TilePacketSync.class)) { - comp.syncToNBT(nbt); - } - } - - public void syncFromNBT(NBTTagCompound nbt) - { - for (INetwork.TilePacketSync comp : getInterfaces(INetwork.TilePacketSync.class)) { - comp.syncFromNBT(nbt); - } - } - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) - { - for (INetwork.RecieveGuiNBT recieve : getInterfaces(INetwork.RecieveGuiNBT.class)) { - recieve.recieveGuiNBT(side, player, name, nbt); - } - } - - public void sendGuiNBT(Map<String, NBTTagCompound> nbt) - { - for (INetwork.SendGuiNBT recieve : getInterfaces(INetwork.SendGuiNBT.class)) { - recieve.sendGuiNBT(nbt); - } - } -} diff --git a/src/Java/binnie/core/machines/MachineComponent.java b/src/Java/binnie/core/machines/MachineComponent.java deleted file mode 100644 index 3b90497fc3..0000000000 --- a/src/Java/binnie/core/machines/MachineComponent.java +++ /dev/null @@ -1,61 +0,0 @@ -package binnie.core.machines; - -import binnie.Binnie; -import binnie.core.network.packet.MachinePayload; -import forestry.api.core.INBTTagable; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; - -public class MachineComponent - implements INBTTagable -{ - private IMachine machine; - - public MachineComponent(IMachine machine) - { - setMachine(machine); - machine.addComponent(this); - } - - public void setMachine(IMachine machine) - { - this.machine = machine; - } - - public IMachine getMachine() - { - return this.machine; - } - - public void readFromNBT(NBTTagCompound nbttagcompound) {} - - public void writeToNBT(NBTTagCompound nbttagcompound) {} - - public void onUpdate() {} - - public Class[] getComponentInterfaces() - { - return Binnie.Machine.getComponentInterfaces(getClass()); - } - - public void onInventoryUpdate() {} - - public final MachinePayload getPayload() - { - return new MachinePayload(Binnie.Machine.getNetworkID(getClass())); - } - - public void recieveData(MachinePayload payload) {} - - public MachineUtil getUtil() - { - return getMachine().getMachineUtil(); - } - - public void onDestruction() {} - - public IInventory getInventory() - { - return (IInventory)getMachine().getInterface(IInventory.class); - } -} diff --git a/src/Java/binnie/core/machines/MachineGroup.java b/src/Java/binnie/core/machines/MachineGroup.java deleted file mode 100644 index 03984f1f10..0000000000 --- a/src/Java/binnie/core/machines/MachineGroup.java +++ /dev/null @@ -1,113 +0,0 @@ -package binnie.core.machines; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import cpw.mods.fml.common.registry.GameRegistry; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; -import net.minecraft.creativetab.CreativeTabs; - -public class MachineGroup -{ - private AbstractMod mod; - private String blockName; - private String uid; - - public MachineGroup(AbstractMod mod, String uid, String blockName, IMachineType[] types) - { - this.mod = mod; - this.uid = uid; - this.blockName = blockName; - for (IMachineType type : types) { - if ((type.getPackageClass() != null) && (type.isActive())) { - try - { - MachinePackage pack = (MachinePackage)type.getPackageClass().newInstance(); - pack.assignMetadata(type.ordinal()); - pack.setActive(type.isActive()); - addPackage(pack); - } - catch (Exception e) - { - throw new RuntimeException("Failed to create machine package " + type.toString(), e); - } - } - } - Binnie.Machine.registerMachineGroup(this); - - this.block = new BlockMachine(this, blockName); - if (this.block != null) - { - GameRegistry.registerBlock(this.block, ItemMachine.class, blockName); - for (MachinePackage pack : getPackages()) { - pack.register(); - } - } - } - - private Map<String, MachinePackage> packages = new LinkedHashMap(); - private Map<Integer, MachinePackage> packagesID = new LinkedHashMap(); - private BlockMachine block; - - private void addPackage(MachinePackage pack) - { - this.packages.put(pack.getUID(), pack); - this.packagesID.put(pack.getMetadata(), pack); - pack.setGroup(this); - } - - public Collection<MachinePackage> getPackages() - { - return this.packages.values(); - } - - public boolean customRenderer = true; - - public BlockMachine getBlock() - { - return this.block; - } - - public MachinePackage getPackage(int metadata) - { - return (MachinePackage)this.packagesID.get(Integer.valueOf(metadata)); - } - - public MachinePackage getPackage(String name) - { - return (MachinePackage)this.packages.get(name); - } - - public String getUID() - { - return this.mod.getModID() + "." + this.uid; - } - - public String getShortUID() - { - return this.uid; - } - - private boolean renderedTileEntity = true; - - boolean isTileEntityRenderered() - { - return this.renderedTileEntity; - } - - public void renderAsBlock() - { - this.renderedTileEntity = false; - } - - public void setCreativeTab(CreativeTabs tab) - { - this.block.setCreativeTab(tab); - } - - public AbstractMod getMod() - { - return this.mod; - } -} diff --git a/src/Java/binnie/core/machines/MachinePackage.java b/src/Java/binnie/core/machines/MachinePackage.java deleted file mode 100644 index 943db084b6..0000000000 --- a/src/Java/binnie/core/machines/MachinePackage.java +++ /dev/null @@ -1,74 +0,0 @@ -package binnie.core.machines; - -import binnie.Binnie; -import binnie.core.language.ManagerLanguage; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.tileentity.TileEntity; - -public abstract class MachinePackage -{ - private String uid; - private boolean active = true; - boolean powered = false; - private int metadata = -1; - private MachineGroup group; - - public String getUID() - { - return this.uid; - } - - protected MachinePackage(String uid, boolean powered) - { - this.uid = uid; - this.powered = powered; - } - - public abstract void createMachine(Machine paramMachine); - - public abstract TileEntity createTileEntity(); - - public abstract void register(); - - public final String getDisplayName() - { - return Binnie.Language.localise(this.group.getMod(), "machine." + this.group.getShortUID() + "." + getUID()); - } - - public final Integer getMetadata() - { - return Integer.valueOf(this.metadata); - } - - public void assignMetadata(int meta) - { - this.metadata = meta; - } - - public MachineGroup getGroup() - { - return this.group; - } - - public void setGroup(MachineGroup group) - { - this.group = group; - } - - public abstract void renderMachine(Machine paramMachine, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat, RenderBlocks paramRenderBlocks); - - public boolean isActive() - { - return this.active; - } - - public void setActive(boolean active) - { - this.active = active; - } - - public final String getInformation() - { - return Binnie.Language.localise(this.group.getMod(), "machine." + this.group.getShortUID() + "." + getUID() + ".info"); - } -} diff --git a/src/Java/binnie/core/machines/MachineRendererBlock.java b/src/Java/binnie/core/machines/MachineRendererBlock.java deleted file mode 100644 index 9506746df4..0000000000 --- a/src/Java/binnie/core/machines/MachineRendererBlock.java +++ /dev/null @@ -1,41 +0,0 @@ -package binnie.core.machines; - -import binnie.core.BinnieCore; -import binnie.core.proxy.BinnieProxy; -import binnie.core.resource.BinnieResource; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class MachineRendererBlock -{ - public static MachineRendererBlock instance = new MachineRendererBlock(); - private BinnieResource texture; - private ModelBlock model; - - public MachineRendererBlock() - { - this.model = new ModelBlock(); - } - - public void renderMachine(BinnieResource texture, double x, double y, double z, float var8) - { - this.texture = texture; - - GL11.glPushMatrix(); - - GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - - BinnieCore.proxy.bindTexture(texture); - - GL11.glPushMatrix(); - - this.model.render((float)x, (float)y, (float)z, 0.0625F, 0.0625F, 0.0625F); - - GL11.glPopMatrix(); - - GL11.glPopMatrix(); - } -} diff --git a/src/Java/binnie/core/machines/MachineUtil.java b/src/Java/binnie/core/machines/MachineUtil.java deleted file mode 100644 index 97ff515061..0000000000 --- a/src/Java/binnie/core/machines/MachineUtil.java +++ /dev/null @@ -1,216 +0,0 @@ -package binnie.core.machines; - -import binnie.core.BinnieCore; -import binnie.core.machines.inventory.IChargedSlots; -import binnie.core.machines.power.IPoweredMachine; -import binnie.core.machines.power.IProcess; -import binnie.core.machines.power.ITankMachine; -import binnie.core.machines.power.PowerInterface; -import binnie.core.machines.power.PowerSystem; -import binnie.core.proxy.BinnieProxy; -import binnie.core.util.ItemStackSet; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidTank; - -public class MachineUtil -{ - private IMachine machine; - - public MachineUtil(IMachine machine) - { - this.machine = machine; - } - - public IInventory getInventory() - { - return (IInventory)this.machine.getInterface(IInventory.class); - } - - public ITankMachine getTankContainer() - { - return (ITankMachine)this.machine.getInterface(ITankMachine.class); - } - - public IPoweredMachine getPoweredMachine() - { - return (IPoweredMachine)this.machine.getInterface(IPoweredMachine.class); - } - - public boolean isSlotEmpty(int slot) - { - return getInventory().getStackInSlot(slot) == null; - } - - public IFluidTank getTank(int id) - { - return getTankContainer().getTanks()[id]; - } - - public boolean spaceInTank(int id, int amount) - { - IFluidTank tank = getTank(id); - int space = tank.getCapacity() - tank.getFluidAmount(); - return amount <= space; - } - - public ItemStack getStack(int slot) - { - return getInventory().getStackInSlot(slot); - } - - public void deleteStack(int slot) - { - setStack(slot, null); - } - - public ItemStack decreaseStack(int slotWood, int amount) - { - return getInventory().decrStackSize(slotWood, amount); - } - - public void setStack(int slot, ItemStack stack) - { - getInventory().setInventorySlotContents(slot, stack); - } - - public void fillTank(int id, FluidStack liquidStack) - { - IFluidTank tank = getTank(id); - tank.fill(liquidStack, true); - } - - public void addStack(int slot, ItemStack addition) - { - if (isSlotEmpty(slot)) - { - setStack(slot, addition); - } - else - { - ItemStack merge = getStack(slot); - if ((merge.isItemEqual(addition)) && (merge.stackSize + addition.stackSize <= merge.getMaxStackSize())) - { - merge.stackSize += addition.stackSize; - setStack(slot, merge); - } - } - } - - public FluidStack drainTank(int tank, int amount) - { - return getTank(tank).drain(amount, true); - } - - public boolean liquidInTank(int tank, int amount) - { - return (getTank(tank).drain(amount, false) != null) && (getTank(tank).drain(amount, false).amount == amount); - } - - public void damageItem(int slot, int damage) - { - ItemStack item = getStack(slot); - if (damage < 0) { - item.setItemDamage(Math.max(0, item.getItemDamage() + damage)); - } else if (item.attemptDamageItem(damage, new Random())) { - setStack(slot, null); - } - setStack(slot, item); - } - - public boolean isTankEmpty(int tankInput) - { - return getTank(tankInput).getFluidAmount() == 0; - } - - public FluidStack getFluid(int tankInput) - { - return getTank(tankInput).getFluid() == null ? null : getTank(tankInput).getFluid(); - } - - public ItemStack[] getStacks(int[] slotGrains) - { - ItemStack[] stacks = new ItemStack[slotGrains.length]; - for (int i = 0; i < slotGrains.length; i++) { - stacks[i] = getStack(slotGrains[i]); - } - return stacks; - } - - public ItemStack hasIngredients(int recipe, int[] inventory) - { - return null; - } - - public boolean hasIngredients(int[] recipe, int[] inventory) - { - ItemStackSet requiredStacks = new ItemStackSet(); - for (ItemStack stack : getStacks(recipe)) { - requiredStacks.add(stack); - } - ItemStackSet inventoryStacks = new ItemStackSet(); - for (ItemStack stack : getStacks(inventory)) { - inventoryStacks.add(stack); - } - requiredStacks.removeAll(inventoryStacks); - - return requiredStacks.isEmpty(); - } - - public void useEnergyMJ(float powerUsage) - { - getPoweredMachine().getInterface().useEnergy(PowerSystem.MJ, powerUsage, true); - } - - public boolean hasEnergyMJ(float powerUsage) - { - return getPoweredMachine().getInterface().useEnergy(PowerSystem.MJ, powerUsage, false) >= powerUsage; - } - - public float getSlotCharge(int slot) - { - return ((IChargedSlots)this.machine.getInterface(IChargedSlots.class)).getCharge(slot); - } - - public void useCharge(int slot, float loss) - { - ((IChargedSlots)this.machine.getInterface(IChargedSlots.class)).alterCharge(slot, -loss); - } - - public Random getRandom() - { - return new Random(); - } - - public void refreshBlock() - { - this.machine.getWorld().markBlockForUpdate(this.machine.getTileEntity().xCoord, this.machine.getTileEntity().yCoord, this.machine.getTileEntity().zCoord); - } - - public IProcess getProcess() - { - return (IProcess)this.machine.getInterface(IProcess.class); - } - - public List<ItemStack> getNonNullStacks(int[] slotacclimatiser) - { - List<ItemStack> stacks = new ArrayList(); - for (ItemStack stack : getStacks(slotacclimatiser)) { - if (stack != null) { - stacks.add(stack); - } - } - return stacks; - } - - public boolean isServer() - { - return BinnieCore.proxy.isSimulating(this.machine.getWorld()); - } -} diff --git a/src/Java/binnie/core/machines/ManagerMachine.java b/src/Java/binnie/core/machines/ManagerMachine.java deleted file mode 100644 index 53920e5496..0000000000 --- a/src/Java/binnie/core/machines/ManagerMachine.java +++ /dev/null @@ -1,108 +0,0 @@ -package binnie.core.machines; - -import binnie.core.BinnieCore; -import binnie.core.ManagerBase; -import binnie.core.machines.inventory.ValidatorIcon; -import binnie.core.proxy.BinnieProxy; -import forestry.api.core.INBTTagable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class ManagerMachine - extends ManagerBase -{ - private Map<Class<?>, Class<?>[]> componentInterfaceMap = new HashMap(); - private Map<String, MachineGroup> machineGroups = new HashMap(); - private Map<Integer, Class<?>> networkIDToComponent = new HashMap(); - private Map<Class<?>, Integer> componentToNetworkID = new HashMap(); - private int nextNetworkID = 0; - private int machineRenderID; - - public void registerMachineGroup(MachineGroup group) - { - this.machineGroups.put(group.getUID(), group); - } - - public MachineGroup getGroup(String name) - { - return (MachineGroup)this.machineGroups.get(name); - } - - public MachinePackage getPackage(String group, String name) - { - MachineGroup machineGroup = getGroup(group); - return machineGroup == null ? null : machineGroup.getPackage(name); - } - - private void registerComponentClass(Class<? extends MachineComponent> component) - { - if (this.componentInterfaceMap.containsKey(component)) { - return; - } - Set<Class<?>> interfaces = new HashSet(); - - Class<?> currentClass = component; - while (currentClass != null) - { - for (Class<?> clss : currentClass.getInterfaces()) { - interfaces.add(clss); - } - currentClass = currentClass.getSuperclass(); - if (currentClass == Object.class) { - currentClass = null; - } - } - interfaces.remove(INBTTagable.class); - - this.componentInterfaceMap.put(component, interfaces.toArray(new Class[0])); - - int networkID = this.nextNetworkID++; - - this.networkIDToComponent.put(Integer.valueOf(networkID), component); - this.componentToNetworkID.put(component, Integer.valueOf(networkID)); - } - - public int getNetworkID(Class<?> component) - { - return ((Integer)this.componentToNetworkID.get(component)).intValue(); - } - - public Class<?> getComponentClass(int networkID) - { - return (Class)this.networkIDToComponent.get(Integer.valueOf(networkID)); - } - - public int getMachineRenderID() - { - return this.machineRenderID; - } - - public void init() - { - this.machineRenderID = BinnieCore.proxy.getUniqueRenderID(); - - binnie.core.machines.inventory.SlotValidator.IconBee = new ValidatorIcon(BinnieCore.instance, "validator/bee.0", "validator/bee.1"); - - binnie.core.machines.inventory.SlotValidator.IconFrame = new ValidatorIcon(BinnieCore.instance, "validator/frame.0", "validator/frame.1"); - - binnie.core.machines.inventory.SlotValidator.IconCircuit = new ValidatorIcon(BinnieCore.instance, "validator/circuit.0", "validator/circuit.1"); - - binnie.core.machines.inventory.SlotValidator.IconBlock = new ValidatorIcon(BinnieCore.instance, "validator/block.0", "validator/block.1"); - } - - public void postInit() - { - BinnieCore.proxy.registerBlockRenderer(BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine")); - BinnieCore.proxy.registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine")); - } - - public Class<?>[] getComponentInterfaces(Class<? extends MachineComponent> clss) - { - if (!this.componentInterfaceMap.containsKey(clss)) { - registerComponentClass(clss); - } - return (Class[])this.componentInterfaceMap.get(clss); - } -} diff --git a/src/Java/binnie/core/machines/ModelBlock.java b/src/Java/binnie/core/machines/ModelBlock.java deleted file mode 100644 index 7258ec8654..0000000000 --- a/src/Java/binnie/core/machines/ModelBlock.java +++ /dev/null @@ -1,42 +0,0 @@ -package binnie.core.machines; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -class ModelBlock - extends ModelBase -{ - private ModelRenderer Block; - - public ModelBlock() - { - this.textureWidth = 64; - this.textureHeight = 32; - - this.Block = new ModelRenderer(this, 0, 0); - this.Block.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16); - this.Block.setRotationPoint(-8.0F, 8.0F, -8.0F); - this.Block.setTextureSize(64, 32); - this.Block.mirror = true; - setRotation(this.Block, 0.0F, 0.0F, 0.0F); - } - - public void render(float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(null, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - this.Block.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } -} diff --git a/src/Java/binnie/core/machines/RendererMachine.java b/src/Java/binnie/core/machines/RendererMachine.java deleted file mode 100644 index 18ad4afe92..0000000000 --- a/src/Java/binnie/core/machines/RendererMachine.java +++ /dev/null @@ -1,68 +0,0 @@ -package binnie.core.machines; - -import binnie.Binnie; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class RendererMachine - extends TileEntitySpecialRenderer - implements ISimpleBlockRenderingHandler -{ - RenderBlocks blockRenderer; - - public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float var8) - { - renderTileEntity((TileEntityMachine)entity, x, y, z, var8, this.blockRenderer); - } - - public void renderTileEntity(TileEntityMachine entity, double x, double y, double z, float var8, RenderBlocks renderer) - { - if ((entity != null) && (entity.getMachine() != null)) - { - MachinePackage machinePackage = entity.getMachine().getPackage(); - machinePackage.renderMachine(entity.getMachine(), x, y, z, var8, renderer); - } - } - - public void renderInvBlock(RenderBlocks renderblocks, Block block, int i, int j) - { - TileEntity entity = block.createTileEntity(null, i); - renderTileEntity((TileEntityMachine)entity, 0.0D, -0.1D, 0.0D, 0.0625F, renderblocks); - } - - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) - { - if (modelID == Binnie.Machine.getMachineRenderID()) { - renderInvBlock(renderer, block, metadata, modelID); - } - } - - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - TileEntityMachine tile = (TileEntityMachine)world.getTileEntity(x, y, z); - if ((tile != null) && (tile.getMachine() != null) && (tile.getMachine().getPackage() != null) && (tile.getMachine().getPackage().getGroup() != null) && (!tile.getMachine().getPackage().getGroup().customRenderer)) { - renderTileEntity(tile, x, y, z, 1.0F, renderer); - } - return true; - } - - public boolean shouldRender3DInInventory(int i) - { - return true; - } - - public int getRenderId() - { - return Binnie.Machine.getMachineRenderID(); - } - - public void func_147496_a(World par1World) - { - this.blockRenderer = new RenderBlocks(par1World); - } -} diff --git a/src/Java/binnie/core/machines/TileEntityMachine.java b/src/Java/binnie/core/machines/TileEntityMachine.java deleted file mode 100644 index 27038b1c1c..0000000000 --- a/src/Java/binnie/core/machines/TileEntityMachine.java +++ /dev/null @@ -1,111 +0,0 @@ -package binnie.core.machines; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import binnie.Binnie; -import binnie.core.machines.base.TileEntityMachineBase; -import binnie.core.machines.component.IInteraction; -import binnie.core.network.INetworkedEntity; -import binnie.core.network.packet.PacketPayload; - -public class TileEntityMachine - extends TileEntityMachineBase - implements INetworkedEntity -{ - private Machine machine; - - public void updateEntity() - { - super.updateEntity(); - if (this.machine != null) { - this.machine.onUpdate(); - } - } - - public boolean canUpdate() - { - return super.canUpdate(); - } - - public TileEntityMachine(MachinePackage pack) - { - setMachine(pack); - } - - public TileEntityMachine() {} - - public void setMachine(MachinePackage pack) - { - if (pack != null) { - this.machine = new Machine(pack, this); - } - } - - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - String name = nbtTagCompound.getString("name"); - String group = nbtTagCompound.getString("group"); - MachinePackage pack = Binnie.Machine.getPackage(group, name); - if (pack == null) - { - invalidate(); - return; - } - setMachine(pack); - getMachine().readFromNBT(nbtTagCompound); - } - - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - String name = this.machine.getPackage().getUID(); - String group = this.machine.getPackage().getGroup().getUID(); - nbtTagCompound.setString("group", group); - nbtTagCompound.setString("name", name); - getMachine().writeToNBT(nbtTagCompound); - } - - public void writeToPacket(PacketPayload payload) - { - this.machine.writeToPacket(payload); - } - - public void readFromPacket(PacketPayload payload) - { - this.machine.readFromPacket(payload); - } - - public Machine getMachine() - { - return this.machine; - } - - public void onBlockDestroy() - { - if (getMachine() != null) { - getMachine().onBlockDestroy(); - } - } - - public final Packet getDescriptionPacket() - { - return getMachine() != null ? getMachine().getDescriptionPacket() : null; - } - - public void invalidate() - { - super.invalidate(); - for (IInteraction.Invalidation c : getMachine().getInterfaces(IInteraction.Invalidation.class)) { - c.onInvalidation(); - } - } - - public void onChunkUnload() - { - super.onChunkUnload(); - for (IInteraction.ChunkUnload c : getMachine().getInterfaces(IInteraction.ChunkUnload.class)) { - c.onChunkUnload(); - } - } -} diff --git a/src/Java/binnie/core/machines/base/DefaultInventory.java b/src/Java/binnie/core/machines/base/DefaultInventory.java deleted file mode 100644 index b72ebd3b57..0000000000 --- a/src/Java/binnie/core/machines/base/DefaultInventory.java +++ /dev/null @@ -1,82 +0,0 @@ -package binnie.core.machines.base; - -import binnie.core.machines.inventory.IInventoryMachine; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -class DefaultInventory - implements IInventoryMachine -{ - public int getSizeInventory() - { - return 0; - } - - public ItemStack getStackInSlot(int i) - { - return null; - } - - public ItemStack decrStackSize(int i, int j) - { - return null; - } - - public ItemStack getStackInSlotOnClosing(int i) - { - return null; - } - - public void setInventorySlotContents(int i, ItemStack itemstack) {} - - public int getInventoryStackLimit() - { - return 64; - } - - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return false; - } - - public boolean isItemValidForSlot(int i, ItemStack itemstack) - { - return false; - } - - public int[] getAccessibleSlotsFromSide(int var1) - { - return new int[0]; - } - - public boolean canInsertItem(int i, ItemStack itemstack, int j) - { - return false; - } - - public boolean canExtractItem(int i, ItemStack itemstack, int j) - { - return false; - } - - public boolean isReadOnly(int slot) - { - return false; - } - - public String getInventoryName() - { - return ""; - } - - public boolean hasCustomInventoryName() - { - return false; - } - - public void markDirty() {} - - public void openInventory() {} - - public void closeInventory() {} -} diff --git a/src/Java/binnie/core/machines/base/DefaultPower.java b/src/Java/binnie/core/machines/base/DefaultPower.java deleted file mode 100644 index 527ce0801a..0000000000 --- a/src/Java/binnie/core/machines/base/DefaultPower.java +++ /dev/null @@ -1,70 +0,0 @@ -package binnie.core.machines.base; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import binnie.core.machines.power.IPoweredMachine; -import binnie.core.machines.power.PowerInfo; -import binnie.core.machines.power.PowerInterface; - -class DefaultPower - implements IPoweredMachine -{ - public PowerInfo getPowerInfo() - { - return new PowerInfo(this, 0.0F); - } - - - public double getDemandedEnergy() - { - return 0.0D; - } - - - public int getSinkTier() - { - return 0; - } - - - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) - { - return 0.0D; - } - - - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) - { - return false; - } - - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) - { - return 0; - } - - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) - { - return 0; - } - - public int getEnergyStored(ForgeDirection from) - { - return 0; - } - - public int getMaxEnergyStored(ForgeDirection from) - { - return 0; - } - - public boolean canConnectEnergy(ForgeDirection from) - { - return false; - } - - public PowerInterface getInterface() - { - return null; - } -} diff --git a/src/Java/binnie/core/machines/base/DefaultTankContainer.java b/src/Java/binnie/core/machines/base/DefaultTankContainer.java deleted file mode 100644 index a0c93b1168..0000000000 --- a/src/Java/binnie/core/machines/base/DefaultTankContainer.java +++ /dev/null @@ -1,79 +0,0 @@ -package binnie.core.machines.base; - -import binnie.core.machines.inventory.TankSlot; -import binnie.core.machines.power.ITankMachine; -import binnie.core.machines.power.TankInfo; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; - -class DefaultTankContainer - implements ITankMachine -{ - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - return 0; - } - - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - return null; - } - - public TankInfo[] getTankInfos() - { - return new TankInfo[0]; - } - - public boolean isTankReadOnly(int tank) - { - return false; - } - - public boolean isLiquidValidForTank(FluidStack liquid, int tank) - { - return false; - } - - public TankSlot addTank(int index, String name, int capacity) - { - return null; - } - - public IFluidTank getTank(int index) - { - return null; - } - - public TankSlot getTankSlot(int slot) - { - return null; - } - - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - return null; - } - - public boolean canFill(ForgeDirection from, Fluid fluid) - { - return false; - } - - public boolean canDrain(ForgeDirection from, Fluid fluid) - { - return false; - } - - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - return new FluidTankInfo[0]; - } - - public IFluidTank[] getTanks() - { - return new IFluidTank[0]; - } -} diff --git a/src/Java/binnie/core/machines/base/TileEntityMachineBase.java b/src/Java/binnie/core/machines/base/TileEntityMachineBase.java deleted file mode 100644 index 471bb4ab68..0000000000 --- a/src/Java/binnie/core/machines/base/TileEntityMachineBase.java +++ /dev/null @@ -1,256 +0,0 @@ -package binnie.core.machines.base; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; -import binnie.core.machines.Machine; -import binnie.core.machines.inventory.IInventoryMachine; -import binnie.core.machines.inventory.TankSlot; -import binnie.core.machines.power.IPoweredMachine; -import binnie.core.machines.power.ITankMachine; -import binnie.core.machines.power.PowerInfo; -import binnie.core.machines.power.PowerInterface; -import binnie.core.machines.power.TankInfo; - -public class TileEntityMachineBase - extends TileEntity - implements IInventoryMachine, ITankMachine, IPoweredMachine -{ - public IInventoryMachine getInventory() - { - IInventoryMachine inv = (IInventoryMachine)Machine.getInterface(IInventoryMachine.class, this); - return (inv == null) || (inv == this) ? new DefaultInventory() : inv; - } - - public ITankMachine getTankContainer() - { - ITankMachine inv = (ITankMachine)Machine.getInterface(ITankMachine.class, this); - return (inv == null) || (inv == this) ? new DefaultTankContainer() : inv; - } - - public IPoweredMachine getPower() - { - IPoweredMachine inv = (IPoweredMachine)Machine.getInterface(IPoweredMachine.class, this); - return (inv == null) || (inv == this) ? new DefaultPower() : inv; - } - - public int getSizeInventory() - { - return getInventory().getSizeInventory(); - } - - public ItemStack getStackInSlot(int index) - { - return getInventory().getStackInSlot(index); - } - - public ItemStack decrStackSize(int index, int amount) - { - return getInventory().decrStackSize(index, amount); - } - - public ItemStack getStackInSlotOnClosing(int var1) - { - return getInventory().getStackInSlotOnClosing(var1); - } - - public void setInventorySlotContents(int index, ItemStack itemStack) - { - getInventory().setInventorySlotContents(index, itemStack); - } - - public String getInventoryName() - { - return getInventory().getInventoryName(); - } - - public int getInventoryStackLimit() - { - return getInventory().getInventoryStackLimit(); - } - - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - if (isInvalid()) { - return false; - } - if (getWorldObj().getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) { - return false; - } - if (entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) > 64.0D) { - return false; - } - return getInventory().isUseableByPlayer(entityplayer); - } - - public void openInventory() - { - getInventory().openInventory(); - } - - public void closeInventory() - { - getInventory().closeInventory(); - } - - public boolean hasCustomInventoryName() - { - return getInventory().hasCustomInventoryName(); - } - - public void markDirty() - { - super.markDirty(); - getInventory().markDirty(); - } - - public boolean isItemValidForSlot(int slot, ItemStack itemStack) - { - return getInventory().isItemValidForSlot(slot, itemStack); - } - - public int[] getAccessibleSlotsFromSide(int var1) - { - return getInventory().getAccessibleSlotsFromSide(var1); - } - - public boolean canInsertItem(int i, ItemStack itemstack, int j) - { - return getInventory().canInsertItem(i, itemstack, j); - } - - public boolean canExtractItem(int i, ItemStack itemstack, int j) - { - return getInventory().canExtractItem(i, itemstack, j); - } - - public boolean isReadOnly(int slot) - { - return getInventory().isReadOnly(slot); - } - - public PowerInfo getPowerInfo() - { - return getPower().getPowerInfo(); - } - - public TankInfo[] getTankInfos() - { - return getTankContainer().getTankInfos(); - } - - public boolean isTankReadOnly(int tank) - { - return getTankContainer().isTankReadOnly(tank); - } - - public boolean isLiquidValidForTank(FluidStack liquid, int tank) - { - return getTankContainer().isLiquidValidForTank(liquid, tank); - } - - public TankSlot addTank(int index, String name, int capacity) - { - return getTankContainer().addTank(index, name, capacity); - } - - public IFluidTank getTank(int index) - { - return getTankContainer().getTank(index); - } - - public TankSlot getTankSlot(int index) - { - return getTankContainer().getTankSlot(index); - } - - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - return getTankContainer().fill(from, resource, doFill); - } - - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - return getTankContainer().drain(from, resource, doDrain); - } - - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - return getTankContainer().drain(from, maxDrain, doDrain); - } - - public boolean canFill(ForgeDirection from, Fluid fluid) - { - return getTankContainer().canFill(from, fluid); - } - - public boolean canDrain(ForgeDirection from, Fluid fluid) - { - return getTankContainer().canDrain(from, fluid); - } - - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - return getTankContainer().getTankInfo(from); - } - - public IFluidTank[] getTanks() - { - return getTankContainer().getTanks(); - } - - public double getDemandedEnergy() - { - return getPower().getDemandedEnergy(); - } - - public int getSinkTier() - { - return getPower().getSinkTier(); - } - - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) - { - return getPower().injectEnergy(directionFrom, amount, voltage); - } - - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) - { - return getPower().acceptsEnergyFrom(emitter, direction); - } - - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) - { - return getPower().receiveEnergy(from, maxReceive, simulate); - } - - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) - { - return getPower().extractEnergy(from, maxExtract, simulate); - } - - public int getEnergyStored(ForgeDirection from) - { - return getPower().getEnergyStored(from); - } - - public int getMaxEnergyStored(ForgeDirection from) - { - return getPower().getMaxEnergyStored(from); - } - - public boolean canConnectEnergy(ForgeDirection from) - { - return getPower().canConnectEnergy(from); - } - - public PowerInterface getInterface() - { - return getPower().getInterface(); - } -} diff --git a/src/Java/binnie/core/machines/component/ComponentRecipe.java b/src/Java/binnie/core/machines/component/ComponentRecipe.java deleted file mode 100644 index 502967e83a..0000000000 --- a/src/Java/binnie/core/machines/component/ComponentRecipe.java +++ /dev/null @@ -1,14 +0,0 @@ -package binnie.core.machines.component; - -import binnie.core.machines.Machine; -import binnie.core.machines.MachineComponent; - -public abstract class ComponentRecipe - extends MachineComponent - implements IComponentRecipe -{ - public ComponentRecipe(Machine machine) - { - super(machine); - } -} diff --git a/src/Java/binnie/core/machines/component/IBuildcraft.java b/src/Java/binnie/core/machines/component/IBuildcraft.java deleted file mode 100644 index 42c4b315e6..0000000000 --- a/src/Java/binnie/core/machines/component/IBuildcraft.java +++ /dev/null @@ -1,20 +0,0 @@ -package binnie.core.machines.component; - -import binnie.core.triggers.TriggerData; -import buildcraft.api.statements.IActionExternal; -import buildcraft.api.statements.IActionReceptor; -import java.util.List; - -public abstract interface IBuildcraft -{ - public static abstract interface TriggerProvider - { - public abstract void getTriggers(List<TriggerData> paramList); - } - - public static abstract interface ActionProvider - extends IActionReceptor - { - public abstract void getActions(List<IActionExternal> paramList); - } -} diff --git a/src/Java/binnie/core/machines/component/IComponentRecipe.java b/src/Java/binnie/core/machines/component/IComponentRecipe.java deleted file mode 100644 index f512d1090f..0000000000 --- a/src/Java/binnie/core/machines/component/IComponentRecipe.java +++ /dev/null @@ -1,12 +0,0 @@ -package binnie.core.machines.component; - -import net.minecraft.item.ItemStack; - -public abstract interface IComponentRecipe -{ - public abstract boolean isRecipe(); - - public abstract ItemStack doRecipe(boolean paramBoolean); - - public abstract ItemStack getProduct(); -} diff --git a/src/Java/binnie/core/machines/component/IInteraction.java b/src/Java/binnie/core/machines/component/IInteraction.java deleted file mode 100644 index 7556b5d567..0000000000 --- a/src/Java/binnie/core/machines/component/IInteraction.java +++ /dev/null @@ -1,22 +0,0 @@ -package binnie.core.machines.component; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public abstract interface IInteraction -{ - public static abstract interface ChunkUnload - { - public abstract void onChunkUnload(); - } - - public static abstract interface Invalidation - { - public abstract void onInvalidation(); - } - - public static abstract interface RightClick - { - public abstract void onRightClick(World paramWorld, EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2, int paramInt3); - } -} diff --git a/src/Java/binnie/core/machines/component/IRender.java b/src/Java/binnie/core/machines/component/IRender.java deleted file mode 100644 index 0b79e985bb..0000000000 --- a/src/Java/binnie/core/machines/component/IRender.java +++ /dev/null @@ -1,28 +0,0 @@ -package binnie.core.machines.component; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.Random; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.world.World; - -public abstract interface IRender -{ - public static abstract interface DisplayTick - { - @SideOnly(Side.CLIENT) - public abstract void onDisplayTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom); - } - - public static abstract interface RandomDisplayTick - { - @SideOnly(Side.CLIENT) - public abstract void onRandomDisplayTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom); - } - - public static abstract interface Render - { - @SideOnly(Side.CLIENT) - public abstract void renderInWorld(RenderItem paramRenderItem, double paramDouble1, double paramDouble2, double paramDouble3); - } -} diff --git a/src/Java/binnie/core/machines/inventory/AccessDirection.java b/src/Java/binnie/core/machines/inventory/AccessDirection.java deleted file mode 100644 index 10abf8d7f0..0000000000 --- a/src/Java/binnie/core/machines/inventory/AccessDirection.java +++ /dev/null @@ -1,97 +0,0 @@ -package binnie.core.machines.inventory; - - enum AccessDirection -{ - Both, In, Out, Neither; - - private AccessDirection() {} - - boolean canInsert() - { - return (this == Both) || (this == In); - } - - boolean canExtract() - { - return (this == Both) || (this == Out); - } - - boolean canAccess() - { - return this != Neither; - } - - AccessDirection changeInsert(boolean b) - { - if (b) - { - if (this == Out) { - return Both; - } - if (this == Neither) { - return In; - } - } - else - { - if (this == Both) { - return Out; - } - if (this == In) { - return Neither; - } - } - return this; - } - - AccessDirection changeExtract(boolean b) - { - if (b) - { - if (this == In) { - return Both; - } - if (this == Neither) { - return Out; - } - } - else - { - if (this == Both) { - return In; - } - if (this == Out) { - return Neither; - } - } - return this; - } - - public String getTextColour() - { - switch (1.$SwitchMap$binnie$core$machines$inventory$AccessDirection[ordinal()]) - { - case 1: - return "§a"; - case 2: - return "§e"; - case 3: - return "§c"; - } - return "§b"; - } - - public int getShadeColour() - { - switch (1.$SwitchMap$binnie$core$machines$inventory$AccessDirection[ordinal()]) - { - case 1: - return 1431699285; - case 2: - return 1442840405; - case 3: - return 1442796885; - } - return 1431699455; - } -} diff --git a/src/Java/binnie/core/machines/inventory/BaseSlot.java b/src/Java/binnie/core/machines/inventory/BaseSlot.java deleted file mode 100644 index fe5cde21d3..0000000000 --- a/src/Java/binnie/core/machines/inventory/BaseSlot.java +++ /dev/null @@ -1,148 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.util.IValidator; -import forestry.api.core.INBTTagable; -import java.util.Collection; -import java.util.EnumSet; -import net.minecraftforge.common.util.ForgeDirection; - -abstract class BaseSlot<T> - implements INBTTagable, IValidator<T> -{ - private SidedAccess access = new SidedAccess(); - Validator<T> validator = null; - private boolean readOnly = false; - private int index; - - public BaseSlot(int index, String unlocName) - { - setIndex(index); - setUnlocalisedName(unlocName); - } - - public void setReadOnly() - { - this.readOnly = true; - forbidInsertion(); - } - - public boolean isValid(T item) - { - if (item == null) { - return true; - } - if (this.validator != null) { - return this.validator.isValid(item); - } - return true; - } - - public abstract T getContent(); - - public abstract void setContent(T paramT); - - public void setValidator(Validator<T> val) - { - this.validator = val; - } - - public boolean isEmpty() - { - return getContent() == null; - } - - public boolean isReadOnly() - { - return this.readOnly; - } - - public int getIndex() - { - return this.index; - } - - private void setIndex(int index) - { - this.index = index; - } - - public boolean canInsert() - { - return !this.access.getInsertionSides().isEmpty(); - } - - public boolean canExtract() - { - return !this.access.getExtractionSides().isEmpty(); - } - - public void forbidInteraction() - { - forbidInsertion(); - forbidExtraction(); - } - - public void setInputSides(EnumSet<ForgeDirection> sides) - { - for (ForgeDirection side : EnumSet.complementOf(sides)) { - if (side != ForgeDirection.UNKNOWN) { - this.access.setInsert(side, false); - } - } - } - - public void setOutputSides(EnumSet<ForgeDirection> sides) - { - for (ForgeDirection side : EnumSet.complementOf(sides)) { - if (side != ForgeDirection.UNKNOWN) { - this.access.setExtract(side, false); - } - } - } - - public void forbidExtraction() - { - this.access.setExtract(false); - this.access.forbidExtractChange(); - } - - public void forbidInsertion() - { - this.access.setInsert(false); - this.access.forbidInsertChange(); - } - - public boolean canInsert(ForgeDirection dir) - { - return this.access.canInsert(dir); - } - - public boolean canExtract(ForgeDirection dir) - { - return this.access.canExtract(dir); - } - - public Collection<ForgeDirection> getInputSides() - { - return this.access.getInsertionSides(); - } - - public Collection<ForgeDirection> getOutputSides() - { - return this.access.getExtractionSides(); - } - - protected String unlocName = ""; - - public void setUnlocalisedName(String name) - { - this.unlocName = name; - } - - public abstract String getName(); - - public Validator<T> getValidator() - { - return this.validator; - } -} diff --git a/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java b/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java deleted file mode 100644 index ceaab46538..0000000000 --- a/src/Java/binnie/core/machines/inventory/ComponentChargedSlots.java +++ /dev/null @@ -1,115 +0,0 @@ -package binnie.core.machines.inventory; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import binnie.core.machines.Machine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.network.INetwork; -import cpw.mods.fml.relauncher.Side; - -public class ComponentChargedSlots - extends MachineComponent - implements INetwork.GuiNBT, IChargedSlots -{ - public ComponentChargedSlots(Machine machine) - { - super(machine); - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - this.charges.clear(); - NBTTagList list = nbttagcompound.getTagList("charges", 10); - for (int i = 0; i < list.tagCount(); i++) - { - NBTTagCompound tag = list.getCompoundTagAt(i); - this.charges.put(Integer.valueOf(tag.getByte("i")), Float.valueOf(tag.getByte("v") / 100.0F)); - } - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - - NBTTagList chargeList = new NBTTagList(); - for (Map.Entry<Integer, Float> entry : this.charges.entrySet()) - { - NBTTagCompound chargesNBT = new NBTTagCompound(); - chargesNBT.setByte("i", (byte)(0 + ((Integer)entry.getKey()).intValue())); - chargesNBT.setByte("v", (byte)(int)(((Float)entry.getValue()).floatValue() * 100.0F)); - chargeList.appendTag(chargesNBT); - } - nbttagcompound.setTag("charges", chargeList); - } - - private Map<Integer, Float> charges = new HashMap(); - - public void addCharge(int slot) - { - this.charges.put(Integer.valueOf(slot), Float.valueOf(0.0F)); - } - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) - { - Iterator i$; - if (name.equals("slot-charges")) { - for (i$ = this.charges.keySet().iterator(); i$.hasNext();) - { - int i = ((Integer)i$.next()).intValue(); - this.charges.put(Integer.valueOf(i), Float.valueOf(nbt.getShort("" + i) / 100.0F)); - } - } - } - - public void sendGuiNBT(Map<String, NBTTagCompound> nbt) - { - NBTTagCompound tag = new NBTTagCompound(); - for (Iterator i$ = this.charges.keySet().iterator(); i$.hasNext();) - { - int i = ((Integer)i$.next()).intValue(); - tag.setShort("" + i, (short)(int)(((Float)this.charges.get(Integer.valueOf(i))).floatValue() * 100.0F)); - } - nbt.put("slot-charges", tag); - } - - public float getCharge(int slot) - { - return this.charges.containsKey(Integer.valueOf(slot)) ? ((Float)this.charges.get(Integer.valueOf(slot))).floatValue() : 0.0F; - } - - public void setCharge(int slot, float charge) - { - if (charge > 1.0F) { - charge = 1.0F; - } - if (charge < 0.0F) { - charge = 0.0F; - } - if (this.charges.containsKey(Integer.valueOf(slot))) { - this.charges.put(Integer.valueOf(slot), Float.valueOf(charge)); - } - } - - public void onUpdate() - { - for (Iterator i$ = this.charges.keySet().iterator(); i$.hasNext();) - { - int slot = ((Integer)i$.next()).intValue(); - if ((getCharge(slot) <= 0.0F) && - (getUtil().decreaseStack(slot, 1) != null)) { - setCharge(slot, 1.0F); - } - } - } - - public void alterCharge(int slot, float charge) - { - setCharge(slot, getCharge(slot) + charge); - } -} diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventory.java b/src/Java/binnie/core/machines/inventory/ComponentInventory.java deleted file mode 100644 index 66566e511c..0000000000 --- a/src/Java/binnie/core/machines/inventory/ComponentInventory.java +++ /dev/null @@ -1,22 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.machines.IMachine; -import binnie.core.machines.MachineComponent; -import net.minecraft.inventory.IInventory; - -public abstract class ComponentInventory - extends MachineComponent - implements IInventory -{ - public ComponentInventory(IMachine machine) - { - super(machine); - } - - public void markDirty() - { - if (getMachine() != null) { - getMachine().markDirty(); - } - } -} diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java b/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java deleted file mode 100644 index 42334f4485..0000000000 --- a/src/Java/binnie/core/machines/inventory/ComponentInventorySlots.java +++ /dev/null @@ -1,247 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.machines.IMachine; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class ComponentInventorySlots - extends ComponentInventory - implements IInventoryMachine, IInventorySlots -{ - public ComponentInventorySlots(IMachine machine) - { - super(machine); - } - - private Map<Integer, InventorySlot> inventory = new LinkedHashMap(); - - public int getSizeInventory() - { - int size = 0; - for (Integer index : this.inventory.keySet()) { - size = Math.max(size, index.intValue() + 1); - } - return size; - } - - public ItemStack getStackInSlot(int index) - { - if (this.inventory.containsKey(Integer.valueOf(index))) { - return ((InventorySlot)this.inventory.get(Integer.valueOf(index))).getContent(); - } - return null; - } - - public ItemStack decrStackSize(int index, int amount) - { - if (this.inventory.containsKey(Integer.valueOf(index))) - { - ItemStack stack = ((InventorySlot)this.inventory.get(Integer.valueOf(index))).decrStackSize(amount); - markDirty(); - return stack; - } - return null; - } - - public ItemStack getStackInSlotOnClosing(int var1) - { - return null; - } - - public void setInventorySlotContents(int index, ItemStack itemStack) - { - if ((this.inventory.containsKey(Integer.valueOf(index))) && ((itemStack == null) || (((InventorySlot)this.inventory.get(Integer.valueOf(index))).isValid(itemStack)))) { - ((InventorySlot)this.inventory.get(Integer.valueOf(index))).setContent(itemStack); - } - markDirty(); - } - - protected void transferItem(int indexFrom, int indexTo) - { - if ((this.inventory.containsKey(Integer.valueOf(indexFrom))) && (this.inventory.containsKey(Integer.valueOf(indexTo)))) - { - ItemStack newStack = ((InventorySlot)this.inventory.get(Integer.valueOf(indexFrom))).getContent().copy(); - ((InventorySlot)this.inventory.get(Integer.valueOf(indexFrom))).setContent(null); - ((InventorySlot)this.inventory.get(Integer.valueOf(indexTo))).setContent(newStack); - } - markDirty(); - } - - public String getInventoryName() - { - return ""; - } - - public int getInventoryStackLimit() - { - return 64; - } - - public boolean isUseableByPlayer(EntityPlayer var1) - { - return true; - } - - public void openInventory() {} - - public void closeInventory() {} - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - if (nbttagcompound.hasKey("inventory")) - { - NBTTagList inventoryNBT = nbttagcompound.getTagList("inventory", 10); - for (int i = 0; i < inventoryNBT.tagCount(); i++) - { - NBTTagCompound slotNBT = inventoryNBT.getCompoundTagAt(i); - int index = slotNBT.getInteger("id"); - if (slotNBT.hasKey("Slot")) { - index = slotNBT.getByte("Slot") & 0xFF; - } - if (this.inventory.containsKey(Integer.valueOf(index))) { - ((InventorySlot)this.inventory.get(Integer.valueOf(index))).readFromNBT(slotNBT); - } - } - } - markDirty(); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - - NBTTagList inventoryNBT = new NBTTagList(); - for (Map.Entry<Integer, InventorySlot> entry : this.inventory.entrySet()) - { - NBTTagCompound slotNBT = new NBTTagCompound(); - slotNBT.setInteger("id", ((Integer)entry.getKey()).intValue()); - ((InventorySlot)entry.getValue()).writeToNBT(slotNBT); - inventoryNBT.appendTag(slotNBT); - } - nbttagcompound.setTag("inventory", inventoryNBT); - } - - public final InventorySlot addSlot(int index, String unlocName) - { - this.inventory.put(Integer.valueOf(index), new InventorySlot(index, unlocName)); - return getSlot(index); - } - - public final InventorySlot[] addSlotArray(int[] indexes, String unlocName) - { - for (int k : indexes) { - addSlot(k, unlocName); - } - return getSlots(indexes); - } - - public InventorySlot getSlot(int index) - { - if (this.inventory.containsKey(Integer.valueOf(index))) { - return (InventorySlot)this.inventory.get(Integer.valueOf(index)); - } - return null; - } - - public InventorySlot[] getAllSlots() - { - return (InventorySlot[])this.inventory.values().toArray(new InventorySlot[0]); - } - - public InventorySlot[] getSlots(int[] indexes) - { - List<InventorySlot> list = new ArrayList(); - for (int i : indexes) { - if (getSlot(i) != null) { - list.add(getSlot(i)); - } - } - return (InventorySlot[])list.toArray(new InventorySlot[0]); - } - - public boolean isReadOnly(int slot) - { - InventorySlot iSlot = getSlot(slot); - return iSlot == null ? true : iSlot.isReadOnly(); - } - - public boolean hasCustomInventoryName() - { - return true; - } - - public boolean isItemValidForSlot(int slot, ItemStack itemStack) - { - InventorySlot iSlot = getSlot(slot); - return iSlot != null; - } - - public void onDestruction() - { - for (InventorySlot slot : this.inventory.values()) - { - ItemStack stack = slot.getContent(); - if ((!slot.isRecipe()) && (stack != null)) - { - float f = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F; - float f1 = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F; - float f2 = getMachine().getWorld().rand.nextFloat() * 0.8F + 0.1F; - if (stack.stackSize == 0) { - stack.stackSize = 1; - } - EntityItem entityitem = new EntityItem(getMachine().getWorld(), getMachine().getTileEntity().xCoord + f, getMachine().getTileEntity().yCoord + f1, getMachine().getTileEntity().zCoord + f2, stack.copy()); - - - - - float accel = 0.05F; - entityitem.motionX = ((float)getMachine().getWorld().rand.nextGaussian() * accel); - - entityitem.motionY = ((float)getMachine().getWorld().rand.nextGaussian() * accel + 0.2F); - - entityitem.motionZ = ((float)getMachine().getWorld().rand.nextGaussian() * accel); - - getMachine().getWorld().spawnEntityInWorld(entityitem); - } - } - } - - public int[] getAccessibleSlotsFromSide(int var1) - { - List<Integer> slots = new ArrayList(); - for (InventorySlot slot : this.inventory.values()) { - if ((slot.canInsert()) || (slot.canExtract())) { - slots.add(Integer.valueOf(slot.getIndex())); - } - } - int[] ids = new int[slots.size()]; - for (int i = 0; i < slots.size(); i++) { - ids[i] = ((Integer)slots.get(i)).intValue(); - } - return ids; - } - - public boolean canInsertItem(int i, ItemStack itemstack, int j) - { - return (isItemValidForSlot(i, itemstack)) && (getSlot(i).canInsert(ForgeDirection.getOrientation(j))); - } - - public boolean canExtractItem(int i, ItemStack itemstack, int j) - { - return getSlot(i).canExtract(ForgeDirection.getOrientation(j)); - } -} diff --git a/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java b/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java deleted file mode 100644 index e8bbf00f88..0000000000 --- a/src/Java/binnie/core/machines/inventory/ComponentInventoryTransfer.java +++ /dev/null @@ -1,162 +0,0 @@ -package binnie.core.machines.inventory; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import binnie.core.machines.IMachine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.transfer.TransferRequest; - -public class ComponentInventoryTransfer - extends MachineComponent -{ - public ComponentInventoryTransfer(IMachine machine) - { - super(machine); - } - - public abstract class Transfer - { - protected ComponentInventoryTransfer.Condition condition; - protected IMachine machine; - - private Transfer(IMachine machine) - { - this.machine = machine; - } - - public final void transfer(IInventory inv) - { - if ((this.condition == null) || (fufilled(inv))) { - doTransfer(inv); - } - } - - protected boolean fufilled(IInventory inv) - { - return true; - } - - protected void doTransfer(IInventory inv) {} - - public final Transfer setCondition(ComponentInventoryTransfer.Condition condition) - { - this.condition = condition; - condition.transfer = this; - return this; - } - - public final IMachine getMachine() - { - return this.machine; - } - } - - private class Restock - extends ComponentInventoryTransfer.Transfer - { - int[] buffer; - int destination; - int limit; - - private Restock(IMachine machine, int[] buffer, int destination, int limit) - { - super(machine); - this.buffer = buffer; - this.destination = destination; - this.limit = limit; - } - - private Restock(IMachine machine, int[] buffer, int destination) - { - this(machine, buffer, destination, 64); - } - - protected void doTransfer(IInventory inv) - { - if (inv.getStackInSlot(this.destination) == null) { - for (int i : this.buffer) { - if (inv.getStackInSlot(i) != null) - { - ItemStack newStack = inv.decrStackSize(i, this.limit); - if (newStack != null) - { - inv.setInventorySlotContents(this.destination, newStack); - return; - } - } - } - } - } - } - - private class Storage - extends ComponentInventoryTransfer.Transfer - { - int source; - int[] destination; - - private Storage(IMachine machine, int source, int[] destination) - { - super(machine); - this.source = source; - this.destination = destination; - } - - protected void doTransfer(IInventory inv) - { - if (inv.getStackInSlot(this.source) != null) { - inv.setInventorySlotContents(this.source, new TransferRequest(inv.getStackInSlot(this.source), inv).setTargetSlots(this.destination).ignoreValidation().transfer(true)); - } - } - - protected boolean fufilled(IInventory inv) - { - ItemStack stack = inv.getStackInSlot(this.source); - return (stack != null) && (this.condition.fufilled(stack)); - } - } - - private List<Transfer> transfers = new ArrayList(); - - public void addRestock(int[] buffer, int destination, int limit) - { - this.transfers.add(new Restock(getMachine(), buffer, destination, limit)); - } - - public void addRestock(int[] buffer, int destination) - { - this.transfers.add(new Restock(getMachine(), buffer, destination)); - } - - public void addStorage(int source, int[] destination) - { - this.transfers.add(new Storage(getMachine(), source, destination)); - } - - public void performTransfer(int source, int[] destination) - { - new Storage(getMachine(), source, destination).transfer((IInventory)getMachine().getInterface(IInventoryMachine.class)); - } - - public void onUpdate() - { - for (Transfer transfer : this.transfers) { - transfer.transfer((IInventory)getMachine().getInterface(IInventoryMachine.class)); - } - } - - public void addStorage(int source, int[] destination, Condition condition) - { - this.transfers.add(new Storage(getMachine(), source, destination).setCondition(condition)); - } - - public static abstract class Condition - { - public ComponentInventoryTransfer.Transfer transfer; - - public abstract boolean fufilled(ItemStack paramItemStack); - } -} diff --git a/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java b/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java deleted file mode 100644 index 0dee156475..0000000000 --- a/src/Java/binnie/core/machines/inventory/ComponentTankContainer.java +++ /dev/null @@ -1,207 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.machines.IMachine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.power.ITankMachine; -import binnie.core.machines.power.TankInfo; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; - -public class ComponentTankContainer - extends MachineComponent - implements ITankMachine -{ - private Map<Integer, TankSlot> tanks = new LinkedHashMap(); - - public ComponentTankContainer(IMachine machine) - { - super(machine); - } - - public final TankSlot addTank(int index, String name, int capacity) - { - TankSlot tank = new TankSlot(index, name, capacity); - this.tanks.put(Integer.valueOf(index), tank); - return tank; - } - - public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - int index = getTankIndexToFill(from, resource); - if (this.tanks.containsKey(Integer.valueOf(index))) { - return fill(index, resource, doFill); - } - return 0; - } - - public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - int index = getTankIndexToDrain(from, null); - if (this.tanks.containsKey(Integer.valueOf(index))) { - return drain(index, maxDrain, doDrain); - } - return null; - } - - private final int fill(int tankIndex, FluidStack resource, boolean doFill) - { - if (!this.tanks.containsKey(Integer.valueOf(tankIndex))) { - return 0; - } - if (!isLiquidValidForTank(resource, tankIndex)) { - return 0; - } - TankSlot tank = (TankSlot)this.tanks.get(Integer.valueOf(tankIndex)); - int filled = tank.getTank().fill(resource, doFill); - if (filled > 0) { - markDirty(); - } - return filled; - } - - private final FluidStack drain(int tankIndex, int maxDrain, boolean doDrain) - { - if (!this.tanks.containsKey(Integer.valueOf(tankIndex))) { - return null; - } - TankSlot tank = (TankSlot)this.tanks.get(Integer.valueOf(tankIndex)); - FluidStack drained = tank.getTank().drain(maxDrain, doDrain); - if (drained != null) { - markDirty(); - } - return drained; - } - - private int getTankIndexToFill(ForgeDirection from, FluidStack resource) - { - for (TankSlot tank : this.tanks.values()) { - if ((tank.isValid(resource)) && (tank.canInsert(from)) && ((tank.getContent() == null) || (tank.getContent().isFluidEqual(resource)))) { - return tank.getIndex(); - } - } - return -1; - } - - private int getTankIndexToDrain(ForgeDirection from, FluidStack resource) - { - for (TankSlot tank : this.tanks.values()) { - if ((tank.getContent() != null) && - (tank.canExtract(from)) && ((resource == null) || (resource.isFluidEqual(tank.getContent())))) { - return tank.getIndex(); - } - } - return -1; - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - if (nbttagcompound.hasKey("liquidTanks")) - { - NBTTagList tanksNBT = nbttagcompound.getTagList("liquidTanks", 10); - for (int i = 0; i < tanksNBT.tagCount(); i++) - { - NBTTagCompound tankNBT = tanksNBT.getCompoundTagAt(i); - int index = tankNBT.getInteger("index"); - if (this.tanks.containsKey(Integer.valueOf(index))) { - ((TankSlot)this.tanks.get(Integer.valueOf(index))).readFromNBT(tankNBT); - } - } - } - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - - NBTTagList tanksNBT = new NBTTagList(); - for (Map.Entry<Integer, TankSlot> entry : this.tanks.entrySet()) - { - NBTTagCompound tankNBT = new NBTTagCompound(); - tankNBT.setInteger("index", ((Integer)entry.getKey()).intValue()); - ((TankSlot)entry.getValue()).writeToNBT(tankNBT); - tanksNBT.appendTag(tankNBT); - } - nbttagcompound.setTag("liquidTanks", tanksNBT); - } - - public boolean isTankReadOnly(int tank) - { - return ((TankSlot)this.tanks.get(Integer.valueOf(tank))).isReadOnly(); - } - - public boolean isLiquidValidForTank(FluidStack liquid, int tank) - { - TankSlot slot = getTankSlot(tank); - return slot != null; - } - - public TankInfo[] getTankInfos() - { - return TankInfo.get(this); - } - - public IFluidTank getTank(int index) - { - return getTanks()[index]; - } - - public IFluidTank[] getTanks() - { - List<IFluidTank> ltanks = new ArrayList(); - for (TankSlot tank : this.tanks.values()) { - ltanks.add(tank.getTank()); - } - return (IFluidTank[])ltanks.toArray(new IFluidTank[0]); - } - - public TankSlot getTankSlot(int index) - { - return (TankSlot)this.tanks.get(Integer.valueOf(index)); - } - - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - int index = getTankIndexToDrain(from, null); - if (this.tanks.containsKey(Integer.valueOf(index))) { - return drain(index, resource.amount, doDrain); - } - return null; - } - - public boolean canFill(ForgeDirection from, Fluid fluid) - { - return fill(from, new FluidStack(fluid, 1), false) > 0; - } - - public boolean canDrain(ForgeDirection from, Fluid fluid) - { - return drain(from, new FluidStack(fluid, 1), false) != null; - } - - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - FluidTankInfo[] info = new FluidTankInfo[getTanks().length]; - for (int i = 0; i < info.length; i++) { - info[i] = new FluidTankInfo(getTanks()[i]); - } - return info; - } - - public void markDirty() - { - if (getMachine() != null) { - getMachine().markDirty(); - } - } -} diff --git a/src/Java/binnie/core/machines/inventory/IChargedSlots.java b/src/Java/binnie/core/machines/inventory/IChargedSlots.java deleted file mode 100644 index e3fcae1f51..0000000000 --- a/src/Java/binnie/core/machines/inventory/IChargedSlots.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core.machines.inventory; - -public abstract interface IChargedSlots -{ - public abstract float getCharge(int paramInt); - - public abstract void setCharge(int paramInt, float paramFloat); - - public abstract void alterCharge(int paramInt, float paramFloat); -} diff --git a/src/Java/binnie/core/machines/inventory/IInventoryMachine.java b/src/Java/binnie/core/machines/inventory/IInventoryMachine.java deleted file mode 100644 index 5c0c0a997f..0000000000 --- a/src/Java/binnie/core/machines/inventory/IInventoryMachine.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.machines.inventory; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; - -public abstract interface IInventoryMachine - extends IInventory, ISidedInventory, IValidatedInventory -{} diff --git a/src/Java/binnie/core/machines/inventory/IInventorySlots.java b/src/Java/binnie/core/machines/inventory/IInventorySlots.java deleted file mode 100644 index c860f00a63..0000000000 --- a/src/Java/binnie/core/machines/inventory/IInventorySlots.java +++ /dev/null @@ -1,14 +0,0 @@ -package binnie.core.machines.inventory; - -public abstract interface IInventorySlots -{ - public abstract InventorySlot addSlot(int paramInt, String paramString); - - public abstract InventorySlot[] addSlotArray(int[] paramArrayOfInt, String paramString); - - public abstract InventorySlot getSlot(int paramInt); - - public abstract InventorySlot[] getSlots(int[] paramArrayOfInt); - - public abstract InventorySlot[] getAllSlots(); -} diff --git a/src/Java/binnie/core/machines/inventory/IValidatedInventory.java b/src/Java/binnie/core/machines/inventory/IValidatedInventory.java deleted file mode 100644 index 56543612c8..0000000000 --- a/src/Java/binnie/core/machines/inventory/IValidatedInventory.java +++ /dev/null @@ -1,9 +0,0 @@ -package binnie.core.machines.inventory; - -import net.minecraft.inventory.IInventory; - -abstract interface IValidatedInventory - extends IInventory -{ - public abstract boolean isReadOnly(int paramInt); -} diff --git a/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java b/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java deleted file mode 100644 index 6ca868ce02..0000000000 --- a/src/Java/binnie/core/machines/inventory/IValidatedTankContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core.machines.inventory; - -import net.minecraftforge.fluids.FluidStack; - -public abstract interface IValidatedTankContainer -{ - public abstract boolean isTankReadOnly(int paramInt); - - public abstract boolean isLiquidValidForTank(FluidStack paramFluidStack, int paramInt); -} diff --git a/src/Java/binnie/core/machines/inventory/InventorySlot.java b/src/Java/binnie/core/machines/inventory/InventorySlot.java deleted file mode 100644 index bfa904176a..0000000000 --- a/src/Java/binnie/core/machines/inventory/InventorySlot.java +++ /dev/null @@ -1,115 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.Binnie; -import binnie.core.BinnieCore; -import binnie.core.language.ManagerLanguage; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class InventorySlot - extends BaseSlot<ItemStack> -{ - public static enum Type - { - Standard, Recipe; - - private Type() {} - } - - private ItemStack itemStack = null; - private Type type = Type.Standard; - - public InventorySlot(int index, String unlocName) - { - super(index, unlocName); - } - - public ItemStack getContent() - { - return this.itemStack; - } - - public ItemStack getItemStack() - { - return getContent(); - } - - public void setContent(ItemStack itemStack) - { - this.itemStack = itemStack; - } - - public ItemStack decrStackSize(int amount) - { - if (this.itemStack == null) { - return null; - } - if (this.itemStack.stackSize <= amount) - { - ItemStack returnStack = this.itemStack.copy(); - this.itemStack = null; - return returnStack; - } - ItemStack returnStack = this.itemStack.copy(); - this.itemStack.stackSize -= amount; - returnStack.stackSize = amount; - return returnStack; - } - - public void readFromNBT(NBTTagCompound slotNBT) - { - if (slotNBT.hasKey("item")) - { - NBTTagCompound itemNBT = slotNBT.getCompoundTag("item"); - this.itemStack = ItemStack.loadItemStackFromNBT(itemNBT); - } - else - { - this.itemStack = null; - } - } - - public void writeToNBT(NBTTagCompound slotNBT) - { - NBTTagCompound itemNBT = new NBTTagCompound(); - if (this.itemStack != null) { - this.itemStack.writeToNBT(itemNBT); - } - slotNBT.setTag("item", itemNBT); - } - - public void setItemStack(ItemStack duplicate) - { - setContent(duplicate); - } - - public SlotValidator getValidator() - { - return (SlotValidator)this.validator; - } - - public void setType(Type type) - { - this.type = type; - if (type == Type.Recipe) - { - setReadOnly(); - forbidInteraction(); - } - } - - public Type getType() - { - return this.type; - } - - public boolean isRecipe() - { - return this.type == Type.Recipe; - } - - public String getName() - { - return Binnie.Language.localise(BinnieCore.instance, "gui.slot." + this.unlocName); - } -} diff --git a/src/Java/binnie/core/machines/inventory/MachineSide.java b/src/Java/binnie/core/machines/inventory/MachineSide.java deleted file mode 100644 index cba1c7417b..0000000000 --- a/src/Java/binnie/core/machines/inventory/MachineSide.java +++ /dev/null @@ -1,79 +0,0 @@ -package binnie.core.machines.inventory; - -import java.util.Collection; -import java.util.EnumSet; -import net.minecraftforge.common.util.ForgeDirection; - -public class MachineSide -{ - private static EnumSet<ForgeDirection> All = EnumSet.of(ForgeDirection.UP, new ForgeDirection[] { ForgeDirection.DOWN, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST }); - public static EnumSet<ForgeDirection> TopAndBottom = EnumSet.of(ForgeDirection.UP, ForgeDirection.DOWN); - public static EnumSet<ForgeDirection> None = EnumSet.noneOf(ForgeDirection.class); - public static EnumSet<ForgeDirection> Top = EnumSet.of(ForgeDirection.UP); - public static EnumSet<ForgeDirection> Bottom = EnumSet.of(ForgeDirection.DOWN); - public static EnumSet<ForgeDirection> Sides = EnumSet.of(ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST); - - public static String asString(Collection<ForgeDirection> sides) - { - if (sides.containsAll(All)) { - return "Any"; - } - if (sides.isEmpty()) { - return "None"; - } - String text = ""; - if (sides.contains(ForgeDirection.UP)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "Up"; - } - if (sides.contains(ForgeDirection.DOWN)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "Down"; - } - if (sides.containsAll(Sides)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "Sides"; - } - else - { - if (sides.contains(ForgeDirection.NORTH)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "North"; - } - if (sides.contains(ForgeDirection.EAST)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "East"; - } - if (sides.contains(ForgeDirection.SOUTH)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "South"; - } - if (sides.contains(ForgeDirection.WEST)) - { - if (sides.size() > 0) { - text = text + ", "; - } - text = text + "West"; - } - } - return text; - } -} diff --git a/src/Java/binnie/core/machines/inventory/SetList.java b/src/Java/binnie/core/machines/inventory/SetList.java deleted file mode 100644 index 41c455a2fc..0000000000 --- a/src/Java/binnie/core/machines/inventory/SetList.java +++ /dev/null @@ -1,36 +0,0 @@ -package binnie.core.machines.inventory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Set; - -public class SetList<E> - extends ArrayList<E> - implements Set<E> -{ - private static final long serialVersionUID = 1277112003159980135L; - - public boolean add(E e) - { - return contains(e) ? false : super.add(e); - } - - public void add(int index, E e) - { - if (!contains(e)) { - super.add(index, e); - } - } - - public boolean addAll(Collection<? extends E> c) - { - return addAll(size(), c); - } - - public boolean addAll(int index, Collection<? extends E> c) - { - Collection<E> copy = new ArrayList(c); - copy.removeAll(this); - return super.addAll(index, copy); - } -} diff --git a/src/Java/binnie/core/machines/inventory/SidedAccess.java b/src/Java/binnie/core/machines/inventory/SidedAccess.java deleted file mode 100644 index ee505891e2..0000000000 --- a/src/Java/binnie/core/machines/inventory/SidedAccess.java +++ /dev/null @@ -1,106 +0,0 @@ -package binnie.core.machines.inventory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.minecraftforge.common.util.ForgeDirection; - -class SidedAccess -{ - private Map<ForgeDirection, AccessDirection> accesses = new HashMap(); - private AccessDirection base = AccessDirection.Both; - private boolean insertLocked = false; - private boolean extractLocked = false; - - public AccessDirection getAccess(ForgeDirection side) - { - return this.accesses.containsKey(side) ? (AccessDirection)this.accesses.get(side) : this.base; - } - - public boolean canInsert(ForgeDirection side) - { - return getAccess(side).canInsert(); - } - - public boolean canExtract(ForgeDirection side) - { - return getAccess(side).canExtract(); - } - - public boolean canAccess(ForgeDirection side) - { - return getAccess(side).canAccess(); - } - - public boolean canChangeInsert() - { - return !this.insertLocked; - } - - public boolean canChangeExtract() - { - return !this.extractLocked; - } - - public void forbidInsertChange() - { - this.insertLocked = true; - } - - public void forbidExtractChange() - { - this.extractLocked = true; - } - - public Collection<ForgeDirection> getInsertionSides() - { - List<ForgeDirection> dirs = new ArrayList(); - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - if (getAccess(dir).canInsert()) { - dirs.add(dir); - } - } - return dirs; - } - - public Collection<ForgeDirection> getExtractionSides() - { - List<ForgeDirection> dirs = new ArrayList(); - for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - if (getAccess(dir).canExtract()) { - dirs.add(dir); - } - } - return dirs; - } - - public void setInsert(ForgeDirection side, boolean b) - { - if (getAccess(side).canInsert() != b) { - this.accesses.put(side, getAccess(side).changeInsert(b)); - } - } - - public void setExtract(ForgeDirection side, boolean b) - { - if (getAccess(side).canExtract() != b) { - this.accesses.put(side, getAccess(side).changeExtract(b)); - } - } - - public void setInsert(boolean b) - { - if (this.base.canInsert() != b) { - this.base = this.base.changeInsert(b); - } - } - - public void setExtract(boolean b) - { - if (this.base.canExtract() != b) { - this.base = this.base.changeExtract(b); - } - } -} diff --git a/src/Java/binnie/core/machines/inventory/SlotValidator.java b/src/Java/binnie/core/machines/inventory/SlotValidator.java deleted file mode 100644 index 0e0aab4e03..0000000000 --- a/src/Java/binnie/core/machines/inventory/SlotValidator.java +++ /dev/null @@ -1,66 +0,0 @@ -package binnie.core.machines.inventory; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import forestry.api.genetics.AlleleManager; - -public abstract class SlotValidator - extends Validator<ItemStack> -{ - public static ValidatorIcon IconBee; - public static ValidatorIcon IconFrame; - public static ValidatorIcon IconCircuit; - public static ValidatorIcon IconBlock; - private ValidatorIcon icon; - - public SlotValidator(ValidatorIcon icon) - { - this.icon = icon; - } - - public IIcon getIcon(boolean input) - { - return this.icon == null ? null : this.icon.getIcon(input).getIcon(); - } - - public static class Item - extends SlotValidator - { - private ItemStack target; - - public Item(ItemStack target, ValidatorIcon icon) - { - super(icon); - this.target = target; - } - - public boolean isValid(ItemStack itemStack) - { - return itemStack.isItemEqual(this.target); - } - - public String getTooltip() - { - return this.target.getDisplayName(); - } - } - - public static class Individual - extends SlotValidator - { - public Individual() - { - super(IconBee); - } - - public boolean isValid(ItemStack itemStack) - { - return AlleleManager.alleleRegistry.getIndividual(itemStack) != null; - } - - public String getTooltip() - { - return "Breedable Individual"; - } - } -} diff --git a/src/Java/binnie/core/machines/inventory/TankSlot.java b/src/Java/binnie/core/machines/inventory/TankSlot.java deleted file mode 100644 index 275ebfd646..0000000000 --- a/src/Java/binnie/core/machines/inventory/TankSlot.java +++ /dev/null @@ -1,58 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.Binnie; -import binnie.core.BinnieCore; -import binnie.core.language.ManagerLanguage; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.IFluidTank; - -public class TankSlot - extends BaseSlot<FluidStack> -{ - public static final String NameJuice = "Juice Tank"; - public static final String NameWater = "Water Tank"; - public static String NameCupboard = "Cupboard Slot"; - private FluidTank tank; - - public TankSlot(int index, String name, int capacity) - { - super(index, name); - this.tank = new FluidTank(capacity); - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - FluidStack liquid = FluidStack.loadFluidStackFromNBT(nbttagcompound); - - setContent(liquid); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - if (getContent() != null) { - getContent().writeToNBT(nbttagcompound); - } - } - - public FluidStack getContent() - { - return this.tank.getFluid(); - } - - public void setContent(FluidStack itemStack) - { - this.tank.setFluid(itemStack); - } - - public IFluidTank getTank() - { - return this.tank; - } - - public String getName() - { - return Binnie.Language.localise(BinnieCore.instance, "gui.slot." + this.unlocName); - } -} diff --git a/src/Java/binnie/core/machines/inventory/TransferHandler.java b/src/Java/binnie/core/machines/inventory/TransferHandler.java deleted file mode 100644 index 1fa4b2cac5..0000000000 --- a/src/Java/binnie/core/machines/inventory/TransferHandler.java +++ /dev/null @@ -1,227 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.machines.Machine; -import binnie.core.machines.power.ITankMachine; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidTank; - -public class TransferHandler -{ - public static ItemStack transfer(ItemStack item, IInventory origin, IInventory destination, boolean doAdd) - { - ItemStack ret = transferItemToInventory(item, destination, doAdd); - if ((destination instanceof ITankMachine)) - { - ret = transferContainerIntoTank(ret, origin, (ITankMachine)destination, doAdd); - ret = transferTankIntoContainer(ret, origin, (ITankMachine)destination, doAdd); - } - return ret; - } - - public static ItemStack transferItemToInventory(ItemStack item, IInventory destination, boolean doAdd) - { - if ((item == null) || (destination == null)) { - return item; - } - ItemStack addition = item.copy(); - for (int i = 0; i < destination.getSizeInventory(); i++) - { - addition = transferToInventory(addition, destination, new int[] { i }, doAdd, false); - if (addition == null) { - return null; - } - } - return addition; - } - - public static ItemStack transferToInventory(ItemStack item, IInventory destination, int[] targetSlots, boolean doAdd, boolean ignoreValidation) - { - for (int i : targetSlots) { - if ((destination.isItemValidForSlot(i, item)) || (ignoreValidation)) - { - if (destination.getStackInSlot(i) == null) - { - if (doAdd) { - destination.setInventorySlotContents(i, item.copy()); - } - return null; - } - if (item.isStackable()) - { - ItemStack merged = destination.getStackInSlot(i).copy(); - ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy()); - item = newStacks[0]; - if (doAdd) { - destination.setInventorySlotContents(i, newStacks[1]); - } - if (item == null) { - return null; - } - } - } - } - return item; - } - - public static ItemStack[] mergeStacks(ItemStack itemstack, ItemStack merged) - { - if ((ItemStack.areItemStackTagsEqual(itemstack, merged)) && (itemstack.isItemEqual(merged))) - { - int space = merged.getMaxStackSize() - merged.stackSize; - if (space > 0) { - if (itemstack.stackSize > space) - { - itemstack.stackSize -= space; - merged.stackSize += space; - } - else if (itemstack.stackSize <= space) - { - merged.stackSize += itemstack.stackSize; - itemstack = null; - } - } - } - return new ItemStack[] { itemstack, merged }; - } - - public static ItemStack transferContainerIntoTank(ItemStack item, IInventory origin, ITankMachine destination, boolean doAdd) - { - if (item == null) { - return null; - } - IFluidTank[] tanks = destination.getTanks(); - ItemStack stack = item.copy(); - for (int i = 0; i < tanks.length; i++) { - stack = transferToTank(stack, origin, destination, i, doAdd); - } - return stack; - } - - public static ItemStack transferTankIntoContainer(ItemStack item, IInventory origin, ITankMachine destination, boolean doAdd) - { - if (item == null) { - return null; - } - IFluidTank[] tanks = destination.getTanks(); - ItemStack stack = item.copy(); - for (int i = 0; i < tanks.length; i++) { - stack = transferFromTank(stack, origin, destination, i, doAdd); - } - return stack; - } - - public static ItemStack transferToTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if (item == null) { - return item; - } - FluidStack containerLiquid = null; - FluidContainerRegistry.FluidContainerData containerLiquidData = null; - for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.filledContainer.isItemEqual(item)) - { - containerLiquidData = data; - containerLiquid = data.fluid.copy(); - break; - } - } - if (containerLiquid == null) { - return item; - } - IFluidTank tank = destination.getTanks()[tankID]; - - IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination); - if ((validated != null) && - (!validated.isLiquidValidForTank(containerLiquid, tankID))) { - return item; - } - FluidStack largeAmountOfLiquid = containerLiquid.copy(); - largeAmountOfLiquid.amount = tank.getCapacity(); - int amountAdded = tank.fill(largeAmountOfLiquid, false); - - int numberOfContainersToAdd = amountAdded / containerLiquid.amount; - if (numberOfContainersToAdd > item.stackSize) { - numberOfContainersToAdd = item.stackSize; - } - ItemStack leftOverContainers = item.copy(); - leftOverContainers.stackSize -= numberOfContainersToAdd; - if (leftOverContainers.stackSize <= 0) { - leftOverContainers = null; - } - ItemStack emptyContainers = containerLiquidData.emptyContainer.copy(); - emptyContainers.stackSize = 0; - emptyContainers.stackSize += numberOfContainersToAdd; - if (emptyContainers.stackSize <= 0) { - emptyContainers = null; - } - ItemStack containersThatCantBeDumped = transferItemToInventory(emptyContainers, origin, false); - if (containersThatCantBeDumped != null) { - return item; - } - if (doAdd) - { - FluidStack liquidToFillTank = containerLiquid.copy(); - liquidToFillTank.amount *= numberOfContainersToAdd; - tank.fill(liquidToFillTank, true); - transferItemToInventory(emptyContainers, origin, true); - } - return leftOverContainers; - } - - public static ItemStack transferFromTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if (item == null) { - return item; - } - IFluidTank tank = destination.getTanks()[tankID]; - FluidStack liquidInTank = tank.getFluid(); - if (liquidInTank == null) { - return item; - } - FluidContainerRegistry.FluidContainerData containerLiquidData = null; - for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if ((data.emptyContainer.isItemEqual(item)) && (liquidInTank.isFluidEqual(data.fluid))) - { - containerLiquidData = data; - break; - } - } - if (containerLiquidData == null) { - return item; - } - int maximumExtractedLiquid = item.stackSize * containerLiquidData.fluid.amount; - - FluidStack drainedLiquid = tank.drain(maximumExtractedLiquid, false); - int amountInTank = drainedLiquid == null ? 0 : drainedLiquid.amount; - - int numberOfContainersToFill = amountInTank / containerLiquidData.fluid.amount; - if (numberOfContainersToFill > item.stackSize) { - numberOfContainersToFill = item.stackSize; - } - ItemStack leftOverContainers = item.copy(); - leftOverContainers.stackSize -= numberOfContainersToFill; - if (leftOverContainers.stackSize <= 0) { - leftOverContainers = null; - } - ItemStack filledContainers = containerLiquidData.filledContainer.copy(); - filledContainers.stackSize = 0; - filledContainers.stackSize += numberOfContainersToFill; - if (filledContainers.stackSize <= 0) { - filledContainers = null; - } - ItemStack containersThatCantBeDumped = transferItemToInventory(filledContainers, origin, false); - if (containersThatCantBeDumped != null) { - return item; - } - if (doAdd) - { - tank.drain(maximumExtractedLiquid, true); - transferItemToInventory(filledContainers, origin, true); - } - return leftOverContainers; - } -} diff --git a/src/Java/binnie/core/machines/inventory/Validator.java b/src/Java/binnie/core/machines/inventory/Validator.java deleted file mode 100644 index f8dddf7fae..0000000000 --- a/src/Java/binnie/core/machines/inventory/Validator.java +++ /dev/null @@ -1,9 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.core.util.IValidator; - -public abstract class Validator<T> - implements IValidator<T> -{ - public abstract String getTooltip(); -} diff --git a/src/Java/binnie/core/machines/inventory/ValidatorIcon.java b/src/Java/binnie/core/machines/inventory/ValidatorIcon.java deleted file mode 100644 index ff7f1ecb1e..0000000000 --- a/src/Java/binnie/core/machines/inventory/ValidatorIcon.java +++ /dev/null @@ -1,25 +0,0 @@ -package binnie.core.machines.inventory; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.resource.BinnieIcon; -import binnie.core.resource.ManagerResource; -import java.util.ArrayList; -import java.util.List; - -public class ValidatorIcon -{ - private List<BinnieIcon> iconsInput = new ArrayList(); - private List<BinnieIcon> iconsOutput = new ArrayList(); - - public ValidatorIcon(AbstractMod mod, String pathInput, String pathOutput) - { - this.iconsInput.add(Binnie.Resource.getItemIcon(mod, pathInput)); - this.iconsOutput.add(Binnie.Resource.getItemIcon(mod, pathOutput)); - } - - public BinnieIcon getIcon(boolean input) - { - return input ? (BinnieIcon)this.iconsInput.get(0) : (BinnieIcon)this.iconsOutput.get(0); - } -} diff --git a/src/Java/binnie/core/machines/network/INetwork.java b/src/Java/binnie/core/machines/network/INetwork.java deleted file mode 100644 index 90b5621bed..0000000000 --- a/src/Java/binnie/core/machines/network/INetwork.java +++ /dev/null @@ -1,30 +0,0 @@ -package binnie.core.machines.network; - -import cpw.mods.fml.relauncher.Side; -import java.util.Map; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; - -public abstract interface INetwork -{ - public static abstract interface SendGuiNBT - { - public abstract void sendGuiNBT(Map<String, NBTTagCompound> paramMap); - } - - public static abstract interface TilePacketSync - { - public abstract void syncToNBT(NBTTagCompound paramNBTTagCompound); - - public abstract void syncFromNBT(NBTTagCompound paramNBTTagCompound); - } - - public static abstract interface RecieveGuiNBT - { - public abstract void recieveGuiNBT(Side paramSide, EntityPlayer paramEntityPlayer, String paramString, NBTTagCompound paramNBTTagCompound); - } - - public static abstract interface GuiNBT - extends INetwork.RecieveGuiNBT, INetwork.SendGuiNBT - {} -} diff --git a/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java b/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java deleted file mode 100644 index 5392ea7012..0000000000 --- a/src/Java/binnie/core/machines/power/ComponentPowerReceptor.java +++ /dev/null @@ -1,183 +0,0 @@ -package binnie.core.machines.power; - -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergyTile; - -import java.util.LinkedList; -import java.util.List; - -import miscutil.core.lib.LoadedMods; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; -import binnie.core.machines.IMachine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.component.IBuildcraft; -import binnie.core.machines.component.IInteraction; -import binnie.core.triggers.TriggerData; -import binnie.core.triggers.TriggerPower; - -public class ComponentPowerReceptor - extends MachineComponent - implements IPoweredMachine, IBuildcraft.TriggerProvider, IInteraction.ChunkUnload, IInteraction.Invalidation -{ - private boolean registeredToIC2EnergyNet = false; - float previousPower = 0.0F; - LinkedList<Float> inputs = new LinkedList(); - static final int inputAverageTicks = 20; - private PowerInterface container; - - public ComponentPowerReceptor(IMachine machine) - { - this(machine, 1000); - } - - public ComponentPowerReceptor(IMachine machine, int storage) - { - super(machine); - this.container = new PowerInterface(storage); - if (!this.registeredToIC2EnergyNet) { - addToEnergyNet(); - } - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - this.container.readFromNBT(nbttagcompound); - if (!this.registeredToIC2EnergyNet) { - addToEnergyNet(); - } - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - this.container.writeToNBT(nbttagcompound); - } - - public void onUpdate() - { - if ((!this.registeredToIC2EnergyNet) && (!getMachine().getTileEntity().isInvalid())) { - addToEnergyNet(); - } - } - - public PowerInfo getPowerInfo() - { - return new PowerInfo(this, 0.0F); - } - - public final void getTriggers(List<TriggerData> triggers) - { - triggers.add(TriggerPower.powerNone(this)); - triggers.add(TriggerPower.powerLow(this)); - triggers.add(TriggerPower.powerMedium(this)); - triggers.add(TriggerPower.powerHigh(this)); - triggers.add(TriggerPower.powerFull(this)); - } - - public double getDemandedEnergy() - { - return this.container.getEnergySpace(PowerSystem.EU); - } - - - public int getSinkTier() - { - return 1; - } - - - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) - { - this.container.addEnergy(PowerSystem.EU, amount, true); - return 0.0D; - } - - - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) - { - return acceptsPowerSystem(PowerSystem.EU); - } - - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) - { - return (int)this.container.addEnergy(PowerSystem.RF, maxReceive, !simulate); - } - - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) - { - return 0; - } - - public int getEnergyStored(ForgeDirection from) - { - return (int)this.container.getEnergy(PowerSystem.RF); - } - - public int getMaxEnergyStored(ForgeDirection from) - { - return (int)this.container.getCapacity(PowerSystem.RF); - } - - public boolean canConnectEnergy(ForgeDirection from) - { - boolean can = acceptsPowerSystem(PowerSystem.RF); - return can; - } - - public PowerInterface getInterface() - { - return this.container; - } - - private boolean acceptsPowerSystem(PowerSystem system) - { - return true; - } - - public void onInvalidation() - { - removeFromEnergyNet(); - } - - public void onChunkUnload() - { - removeFromEnergyNet(); - } - - private void addToEnergyNet() - { - if (getMachine().getWorld() == null) { - return; - } - if (LoadedMods.IndustrialCraft2) { - do_addToEnergyNet(); - } - } - - private void removeFromEnergyNet() - { - if (getMachine().getWorld() == null) { - return; - } - if (LoadedMods.IndustrialCraft2) { - do_removeFromEnergyNet(); - } - } - - private void do_addToEnergyNet() - { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile)getMachine().getTileEntity())); - this.registeredToIC2EnergyNet = true; - } - - private void do_removeFromEnergyNet() - { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile)getMachine().getTileEntity())); - this.registeredToIC2EnergyNet = false; - } -} diff --git a/src/Java/binnie/core/machines/power/ComponentProcess.java b/src/Java/binnie/core/machines/power/ComponentProcess.java deleted file mode 100644 index b49e919e2d..0000000000 --- a/src/Java/binnie/core/machines/power/ComponentProcess.java +++ /dev/null @@ -1,90 +0,0 @@ -package binnie.core.machines.power; - -import binnie.core.machines.IMachine; -import net.minecraft.nbt.NBTTagCompound; - -public abstract class ComponentProcess - extends ComponentProcessIndefinate - implements IProcessTimed -{ - private float progressAmount = 0.0F; - - public ComponentProcess(IMachine machine) - { - super(machine, 0.0F); - } - - public float getEnergyPerTick() - { - return getProcessEnergy() / getProcessLength(); - } - - public float getProgressPerTick() - { - return 100.0F / getProcessLength(); - } - - protected void onStartTask() - { - this.progressAmount += 0.01F; - } - - protected void onCancelTask() - { - this.progressAmount = 0.0F; - } - - public void onUpdate() - { - super.onUpdate(); - if (this.progressAmount >= 100.0F) - { - onFinishTask(); - this.progressAmount = 0.0F; - } - } - - public void alterProgress(float f) - { - this.progressAmount += f; - } - - public void setProgress(float f) - { - this.progressAmount = f; - } - - protected void progressTick() - { - super.progressTick(); - alterProgress(getProgressPerTick()); - } - - public boolean inProgress() - { - return this.progressAmount > 0.0F; - } - - public float getProgress() - { - return this.progressAmount; - } - - protected void onFinishTask() {} - - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.progressAmount = nbt.getFloat("progress"); - } - - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setFloat("progress", this.progressAmount); - } - - public abstract int getProcessLength(); - - public abstract int getProcessEnergy(); -} diff --git a/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java b/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java deleted file mode 100644 index b4c81e0d62..0000000000 --- a/src/Java/binnie/core/machines/power/ComponentProcessIndefinate.java +++ /dev/null @@ -1,119 +0,0 @@ -package binnie.core.machines.power; - -import net.minecraft.nbt.NBTTagCompound; -import binnie.core.machines.IMachine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.network.INetwork; - -public abstract class ComponentProcessIndefinate - extends MachineComponent - implements IProcess, INetwork.TilePacketSync -{ - private float energyPerTick = 0.1F; - private boolean inProgress; - - public void syncFromNBT(NBTTagCompound nbt) - { - this.inProgress = nbt.getBoolean("progress"); - } - - public void syncToNBT(NBTTagCompound nbt) - { - nbt.setBoolean("progress", this.inProgress); - } - - public ComponentProcessIndefinate(IMachine machine, float energyPerTick) - { - super(machine); - this.energyPerTick = energyPerTick; - } - - protected final IPoweredMachine getPower() - { - return (IPoweredMachine)getMachine().getInterface(IPoweredMachine.class); - } - - public float getEnergyPerTick() - { - return this.energyPerTick; - } - - private float actionPauseProcess = 0.0F; - private float actionCancelTask = 0.0F; - - public void onUpdate() - { - float energyAvailable = (float)getPower().getInterface().useEnergy(PowerSystem.RF, getEnergyPerTick(), false); - if (canWork() == null) - { - if ((!isInProgress()) && (canProgress() == null)) - { - onStartTask(); - } - else if (canProgress() == null) - { - progressTick(); - onTickTask(); - } - } - else if (isInProgress()) { - onCancelTask(); - } - if (this.actionPauseProcess > 0.0F) { - this.actionPauseProcess -= 1.0F; - } - if (this.actionCancelTask > 0.0F) { - this.actionCancelTask -= 1.0F; - } - super.onUpdate(); - if (this.inProgress != inProgress()) - { - this.inProgress = inProgress(); - getUtil().refreshBlock(); - } - } - - protected void progressTick() - { - getPower().getInterface().useEnergy(PowerSystem.RF, getEnergyPerTick(), true); - } - - public ErrorState canWork() - { - return this.actionCancelTask == 0.0F ? null : new ErrorState("Task Cancelled", "Cancelled by Buildcraft Gate"); - } - - public ErrorState canProgress() - { - if (this.actionPauseProcess != 0.0F) { - return new ErrorState("Process Paused", "Paused by Buildcraft Gate"); - } - return getPower().getInterface().getEnergy(PowerSystem.RF) < getEnergyPerTick() ? new ErrorState.InsufficientPower() : null; - } - - public final boolean isInProgress() - { - return this.inProgress; - } - - int clientEnergyPerSecond = 0; - int clientInProgress; - - protected abstract boolean inProgress(); - - protected void onCancelTask() {} - - protected void onStartTask() {} - - protected void onTickTask() {} - - public String getTooltip() - { - return "Processing"; - } - - public final ProcessInfo getInfo() - { - return new ProcessInfo(this); - } -} diff --git a/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java b/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java deleted file mode 100644 index b269763136..0000000000 --- a/src/Java/binnie/core/machines/power/ComponentProcessSetCost.java +++ /dev/null @@ -1,27 +0,0 @@ -package binnie.core.machines.power; - -import binnie.core.machines.IMachine; - -public class ComponentProcessSetCost - extends ComponentProcess -{ - private int processLength; - private int processEnergy; - - public ComponentProcessSetCost(IMachine machine, int rfCost, int timePeriod) - { - super(machine); - this.processLength = timePeriod; - this.processEnergy = rfCost; - } - - public int getProcessLength() - { - return this.processLength; - } - - public int getProcessEnergy() - { - return this.processEnergy; - } -} diff --git a/src/Java/binnie/core/machines/power/ErrorState.java b/src/Java/binnie/core/machines/power/ErrorState.java deleted file mode 100644 index 65a3946829..0000000000 --- a/src/Java/binnie/core/machines/power/ErrorState.java +++ /dev/null @@ -1,187 +0,0 @@ -package binnie.core.machines.power; - -import net.minecraft.nbt.NBTTagCompound; -import forestry.api.core.INBTTagable; - -public class ErrorState - implements INBTTagable -{ - private String name = ""; - private String desc = ""; - private int[] data = new int[0]; - private boolean progress = false; - - public ErrorState(String name, String desc) - { - this.name = name; - this.desc = desc; - } - - public ErrorState(String name, String desc, int[] data) - { - this.name = name; - this.desc = desc; - this.data = data; - } - - public String toString() - { - return this.name; - } - - public String getTooltip() - { - return this.desc; - } - - public int[] getData() - { - return this.data; - } - - public boolean isProgress() - { - return this.progress; - } - - public void setIsProgress() - { - this.progress = true; - } - - public static class Item - extends ErrorState - { - public Item(String name, String desc, int[] slots) - { - super(name, desc, slots); - } - } - - public static class Tank - extends ErrorState - { - public Tank(String name, String desc, int[] slots) - { - super(name, desc, slots); - } - } - - public static class NoItem - extends ErrorState.Item - { - public NoItem(String desc, int slot) - { - this(desc, new int[] { slot }); - } - - public NoItem(String desc, int[] slots) - { - super("null", desc, slots); - } - } - - public static class InvalidItem - extends ErrorState.Item - { - public InvalidItem(String desc, int slot) - { - this("Invalid Item", desc, slot); - } - - public InvalidItem(String name, String desc, int slot) - { - super(name, desc, new int[] { slot }); - } - } - - public static class NoSpace - extends ErrorState.Item - { - public NoSpace(String desc, int[] slots) - { - super("null", desc, slots); - } - } - - public static class InsufficientPower - extends ErrorState - { - public InsufficientPower() - { - super("Not enough power to operate", "."); - } - } - - public static class TankSpace - extends ErrorState.Tank - { - public TankSpace(String desc, int tank) - { - super("null", desc, new int[] { tank }); - } - } - - public static class InsufficientLiquid - extends ErrorState.Tank - { - public InsufficientLiquid(String desc, int tank) - { - super("null", desc, new int[] { tank }); - } - } - - public static class InvalidRecipe - extends ErrorState.Item - { - public InvalidRecipe(String string, int[] slots) - { - super("null", string, slots); - } - } - - public void readFromNBT(NBTTagCompound nbt) - { - this.name = nbt.getString("name"); - this.desc = nbt.getString("desc"); - this.data = nbt.getIntArray("data"); - this.itemError = nbt.getBoolean("item"); - this.tankError = nbt.getBoolean("tank"); - this.powerError = nbt.getBoolean("power"); - } - - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setString("name", toString()); - nbt.setString("desc", getTooltip()); - nbt.setIntArray("data", this.data); - if (isItemError()) { - nbt.setBoolean("item", true); - } - if (isTankError()) { - nbt.setBoolean("tank", true); - } - if (isPowerError()) { - nbt.setBoolean("power", true); - } - } - - private boolean itemError = false; - private boolean tankError = false; - private boolean powerError = false; - - public boolean isItemError() - { - return (this.itemError) || ((this instanceof Item)); - } - - public boolean isTankError() - { - return (this.tankError) || ((this instanceof Tank)); - } - - public boolean isPowerError() - { - return (this.powerError) || ((this instanceof InsufficientPower)); - } -} diff --git a/src/Java/binnie/core/machines/power/IErrorStateSource.java b/src/Java/binnie/core/machines/power/IErrorStateSource.java deleted file mode 100644 index bd2cd87d24..0000000000 --- a/src/Java/binnie/core/machines/power/IErrorStateSource.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.machines.power; - -public abstract interface IErrorStateSource -{ - public abstract ErrorState canWork(); - - public abstract ErrorState canProgress(); -} diff --git a/src/Java/binnie/core/machines/power/IPoweredMachine.java b/src/Java/binnie/core/machines/power/IPoweredMachine.java deleted file mode 100644 index 61b505e3d3..0000000000 --- a/src/Java/binnie/core/machines/power/IPoweredMachine.java +++ /dev/null @@ -1,12 +0,0 @@ -package binnie.core.machines.power; - -import ic2.api.energy.tile.IEnergySink; -import cofh.api.energy.IEnergyHandler; - -public abstract interface IPoweredMachine - extends IEnergySink, IEnergyHandler -{ - public abstract PowerInfo getPowerInfo(); - - public abstract PowerInterface getInterface(); -} diff --git a/src/Java/binnie/core/machines/power/IProcess.java b/src/Java/binnie/core/machines/power/IProcess.java deleted file mode 100644 index 83337cd980..0000000000 --- a/src/Java/binnie/core/machines/power/IProcess.java +++ /dev/null @@ -1,13 +0,0 @@ -package binnie.core.machines.power; - -public abstract interface IProcess - extends IErrorStateSource -{ - public abstract float getEnergyPerTick(); - - public abstract String getTooltip(); - - public abstract boolean isInProgress(); - - public abstract ProcessInfo getInfo(); -} diff --git a/src/Java/binnie/core/machines/power/IProcessTimed.java b/src/Java/binnie/core/machines/power/IProcessTimed.java deleted file mode 100644 index 1489d8837f..0000000000 --- a/src/Java/binnie/core/machines/power/IProcessTimed.java +++ /dev/null @@ -1,13 +0,0 @@ -package binnie.core.machines.power; - -abstract interface IProcessTimed - extends IProcess, IErrorStateSource -{ - public abstract int getProcessLength(); - - public abstract int getProcessEnergy(); - - public abstract float getProgress(); - - public abstract float getProgressPerTick(); -} diff --git a/src/Java/binnie/core/machines/power/ITankMachine.java b/src/Java/binnie/core/machines/power/ITankMachine.java deleted file mode 100644 index fa92845cb7..0000000000 --- a/src/Java/binnie/core/machines/power/ITankMachine.java +++ /dev/null @@ -1,20 +0,0 @@ -package binnie.core.machines.power; - -import binnie.core.machines.inventory.IValidatedTankContainer; -import binnie.core.machines.inventory.TankSlot; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fluids.IFluidTank; - -public abstract interface ITankMachine - extends IFluidHandler, IValidatedTankContainer -{ - public abstract TankInfo[] getTankInfos(); - - public abstract IFluidTank[] getTanks(); - - public abstract TankSlot addTank(int paramInt1, String paramString, int paramInt2); - - public abstract IFluidTank getTank(int paramInt); - - public abstract TankSlot getTankSlot(int paramInt); -} diff --git a/src/Java/binnie/core/machines/power/PowerInfo.java b/src/Java/binnie/core/machines/power/PowerInfo.java deleted file mode 100644 index 2c57f2c898..0000000000 --- a/src/Java/binnie/core/machines/power/PowerInfo.java +++ /dev/null @@ -1,41 +0,0 @@ -package binnie.core.machines.power; - -import forestry.api.core.INBTTagable; -import net.minecraft.nbt.NBTTagCompound; - -public class PowerInfo - implements INBTTagable -{ - private float currentEnergy = 0.0F; - private float maxEnergy = 0.0F; - - public PowerInfo(IPoweredMachine machine, float currentInput) - { - this.currentEnergy = ((float)machine.getInterface().getEnergy(PowerSystem.RF)); - this.maxEnergy = ((float)machine.getInterface().getCapacity(PowerSystem.RF)); - } - - public PowerInfo() {} - - public int getStoredEnergy() - { - return (int)this.currentEnergy; - } - - public int getMaxEnergy() - { - return (int)this.maxEnergy; - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - this.currentEnergy = nbttagcompound.getInteger("current"); - this.maxEnergy = nbttagcompound.getInteger("max"); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - nbttagcompound.setInteger("current", getStoredEnergy()); - nbttagcompound.setInteger("max", getMaxEnergy()); - } -} diff --git a/src/Java/binnie/core/machines/power/PowerInterface.java b/src/Java/binnie/core/machines/power/PowerInterface.java deleted file mode 100644 index e7e91bc18a..0000000000 --- a/src/Java/binnie/core/machines/power/PowerInterface.java +++ /dev/null @@ -1,90 +0,0 @@ -package binnie.core.machines.power; - -import forestry.api.core.INBTTagable; -import net.minecraft.nbt.NBTTagCompound; - -public class PowerInterface - implements INBTTagable -{ - private int capacity; - private int energy; - - public PowerInterface(int capacity) - { - this.capacity = (capacity * 100); - this.energy = 0; - } - - public int getCapacity() - { - return this.capacity; - } - - public int getEnergy() - { - return this.energy; - } - - public int addEnergy(int amount, boolean shouldDo) - { - int added = Math.min(getEnergySpace(), amount); - if (shouldDo) { - this.energy += added; - } - return added; - } - - public int useEnergy(int amount, boolean simulate) - { - int added = Math.min(getEnergy(), amount); - if (simulate) { - this.energy -= added; - } - return added; - } - - public int getEnergySpace() - { - return getCapacity() - getEnergy(); - } - - public double addEnergy(PowerSystem unit, double amount, boolean simulate) - { - return unit.convertTo(addEnergy(unit.convertFrom(amount), simulate)); - } - - public double useEnergy(PowerSystem unit, double amount, boolean simulate) - { - return unit.convertTo(useEnergy(unit.convertFrom(amount), simulate)); - } - - public double getEnergy(PowerSystem unit) - { - return unit.convertTo(getEnergy()); - } - - public double getCapacity(PowerSystem unit) - { - return unit.convertTo(getCapacity()); - } - - public double getEnergySpace(PowerSystem unit) - { - return unit.convertTo(getEnergySpace()); - } - - public void readFromNBT(NBTTagCompound nbt) - { - this.energy = nbt.getInteger("Energy"); - if (this.energy > this.capacity) { - this.energy = this.capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setInteger("Energy", getEnergy()); - } -} diff --git a/src/Java/binnie/core/machines/power/PowerSystem.java b/src/Java/binnie/core/machines/power/PowerSystem.java deleted file mode 100644 index 58c1cf9709..0000000000 --- a/src/Java/binnie/core/machines/power/PowerSystem.java +++ /dev/null @@ -1,44 +0,0 @@ -package binnie.core.machines.power; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public enum PowerSystem -{ - MJ(100.0D), RF(10.0D), EU(40.0D); - - double conversion; - - private PowerSystem(double conversion) - { - this.conversion = conversion; - } - - public double convertTo(int value) - { - return value / this.conversion; - } - - public int convertFrom(double value) - { - return (int)(value * this.conversion); - } - - public static PowerSystem get(int i) - { - return values()[(i % values().length)]; - } - - public String getUnitName() - { - return name(); - } - - public ItemStack saveTo(ItemStack stack) - { - NBTTagCompound tag = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound(); - tag.setByte("power-system", (byte)ordinal()); - stack.setTagCompound(tag); - return stack; - } -} diff --git a/src/Java/binnie/core/machines/power/ProcessInfo.java b/src/Java/binnie/core/machines/power/ProcessInfo.java deleted file mode 100644 index 7b4a9bd8a4..0000000000 --- a/src/Java/binnie/core/machines/power/ProcessInfo.java +++ /dev/null @@ -1,67 +0,0 @@ -package binnie.core.machines.power; - -import forestry.api.core.INBTTagable; -import net.minecraft.nbt.NBTTagCompound; - -public class ProcessInfo - implements INBTTagable -{ - private float currentProgress = 0.0F; - private int processEnergy = 0; - private int processTime = 0; - private float energyPerTick = 0.0F; - - public ProcessInfo(IProcess process) - { - this.energyPerTick = process.getEnergyPerTick(); - if ((process instanceof IProcessTimed)) - { - IProcessTimed time = (IProcessTimed)process; - this.currentProgress = time.getProgress(); - this.processEnergy = time.getProcessEnergy(); - this.processTime = time.getProcessLength(); - } - else - { - this.currentProgress = (process.isInProgress() ? 100.0F : 0.0F); - } - } - - public ProcessInfo() {} - - public float getCurrentProgress() - { - return this.currentProgress; - } - - public int getProcessEnergy() - { - return this.processEnergy; - } - - public int getProcessTime() - { - return this.processTime; - } - - public float getEnergyPerTick() - { - return this.energyPerTick; - } - - public void readFromNBT(NBTTagCompound nbttagcompound) - { - this.energyPerTick = nbttagcompound.getFloat("ept"); - this.processEnergy = nbttagcompound.getInteger("e"); - this.processTime = nbttagcompound.getInteger("t"); - this.currentProgress = nbttagcompound.getFloat("p"); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) - { - nbttagcompound.setFloat("ept", this.energyPerTick); - nbttagcompound.setFloat("p", this.currentProgress); - nbttagcompound.setInteger("e", this.processEnergy); - nbttagcompound.setInteger("t", this.processTime); - } -} diff --git a/src/Java/binnie/core/machines/power/TankInfo.java b/src/Java/binnie/core/machines/power/TankInfo.java deleted file mode 100644 index d9e0b350d7..0000000000 --- a/src/Java/binnie/core/machines/power/TankInfo.java +++ /dev/null @@ -1,76 +0,0 @@ -package binnie.core.machines.power; - -import forestry.api.core.INBTTagable; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidTank; - -public class TankInfo - implements INBTTagable -{ - public FluidStack liquid; - private float capacity = 0.0F; - - public TankInfo(IFluidTank tank) - { - this.capacity = tank.getCapacity(); - this.liquid = tank.getFluid(); - } - - public TankInfo() {} - - public float getAmount() - { - return this.liquid == null ? 0.0F : this.liquid.amount; - } - - public float getCapacity() - { - return this.capacity; - } - - public boolean isEmpty() - { - return this.liquid == null; - } - - public IIcon getIcon() - { - return this.liquid.getFluid().getStillIcon(); - } - - public String getName() - { - return this.liquid == null ? "" : this.liquid.getFluid().getLocalizedName(); - } - - public void readFromNBT(NBTTagCompound nbt) - { - this.capacity = nbt.getInteger("capacity"); - if (nbt.hasKey("liquid")) { - this.liquid = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("liquid")); - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setInteger("capacity", (int)getCapacity()); - if (this.liquid == null) { - return; - } - NBTTagCompound tag = new NBTTagCompound(); - this.liquid.writeToNBT(tag); - nbt.setTag("liquid", tag); - } - - public static TankInfo[] get(ITankMachine machine) - { - TankInfo[] info = new TankInfo[machine.getTanks().length]; - for (int i = 0; i < info.length; i++) { - info[i] = new TankInfo(machine.getTanks()[i]); - } - return info; - } -} diff --git a/src/Java/binnie/core/machines/storage/Compartment.java b/src/Java/binnie/core/machines/storage/Compartment.java deleted file mode 100644 index 4ed8406346..0000000000 --- a/src/Java/binnie/core/machines/storage/Compartment.java +++ /dev/null @@ -1,64 +0,0 @@ -package binnie.core.machines.storage; - -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import binnie.core.BinnieCore; -import binnie.core.machines.IMachineType; -import binnie.core.machines.Machine; -import binnie.core.machines.MachinePackage; -import binnie.core.machines.TileEntityMachine; -import binnie.core.resource.BinnieResource; -import binnie.core.resource.IBinnieTexture; - - enum Compartment - implements IMachineType -{ - Compartment(StandardCompartment.PackageCompartment.class), CompartmentCopper(StandardCompartment.PackageCompartmentCopper.class), CompartmentBronze(StandardCompartment.PackageCompartmentBronze.class), CompartmentIron(StandardCompartment.PackageCompartmentIron.class), CompartmentGold(StandardCompartment.PackageCompartmentGold.class), CompartmentDiamond(StandardCompartment.PackageCompartmentDiamond.class); - - Class<? extends MachinePackage> clss; - - private Compartment(Class<? extends MachinePackage> clss) - { - this.clss = clss; - } - - public Class<? extends MachinePackage> getPackageClass() - { - return this.clss; - } - - public static abstract class PackageCompartment - extends MachinePackage - { - private BinnieResource renderTexture; - - protected PackageCompartment(String uid, IBinnieTexture renderTexture) - { - super(uid, false); - this.renderTexture = renderTexture.getTexture(); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - - public void renderMachine(Machine machine, double x, double y, double z, float var8, RenderBlocks renderer) - { - MachineRendererCompartment.instance.renderMachine(machine, 16777215, this.renderTexture, x, y, z, var8); - } - } - - public boolean isActive() - { - return true; - } - - public ItemStack get(int i) - { - return new ItemStack(BinnieCore.packageCompartment.getBlock(), i, ordinal()); - } -} diff --git a/src/Java/binnie/core/machines/storage/CompartmentTab.java b/src/Java/binnie/core/machines/storage/CompartmentTab.java deleted file mode 100644 index 025f73db31..0000000000 --- a/src/Java/binnie/core/machines/storage/CompartmentTab.java +++ /dev/null @@ -1,77 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.craftgui.minecraft.EnumColor; -import forestry.api.core.INBTTagable; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -class CompartmentTab - implements INBTTagable -{ - private String name; - private ItemStack icon; - private EnumColor color; - private int id; - - public CompartmentTab(int id) - { - this.name = ""; - this.icon = new ItemStack(Items.paper); - this.color = EnumColor.White; - this.id = id; - } - - public void readFromNBT(NBTTagCompound nbt) - { - this.name = nbt.getString("name"); - this.icon = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("icon")); - this.color = EnumColor.values()[nbt.getByte("color")]; - this.id = nbt.getByte("id"); - } - - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setString("name", this.name); - NBTTagCompound n = new NBTTagCompound(); - this.icon.writeToNBT(n); - nbt.setTag("icon", n); - nbt.setByte("color", (byte)this.color.ordinal()); - nbt.setByte("id", (byte)this.id); - } - - public String getName() - { - return this.name; - } - - public ItemStack getIcon() - { - return this.icon; - } - - public EnumColor getColor() - { - return this.color; - } - - public int getId() - { - return this.id; - } - - public void setName(String name) - { - this.name = (name == null ? "" : name); - } - - public void setIcon(ItemStack icon) - { - this.icon = icon; - } - - public void setColor(EnumColor color) - { - this.color = color; - } -} diff --git a/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java b/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java deleted file mode 100644 index abb2307687..0000000000 --- a/src/Java/binnie/core/machines/storage/ComponentBinnieCoreGUI.java +++ /dev/null @@ -1,27 +0,0 @@ -package binnie.core.machines.storage; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import binnie.core.BinnieCore; -import binnie.core.gui.BinnieCoreGUI; -import binnie.core.machines.Machine; -import binnie.core.machines.MachineComponent; -import binnie.core.machines.component.IInteraction; - -class ComponentBinnieCoreGUI - extends MachineComponent - implements IInteraction.RightClick -{ - private BinnieCoreGUI id; - - public ComponentBinnieCoreGUI(Machine machine, BinnieCoreGUI id) - { - super(machine); - this.id = id; - } - - public void onRightClick(World world, EntityPlayer player, int x, int y, int z) - { - BinnieCore.proxy.openGui(this.id, player, x, y, z); - } -} diff --git a/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java b/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java deleted file mode 100644 index efe77be7e7..0000000000 --- a/src/Java/binnie/core/machines/storage/ComponentCompartmentInventory.java +++ /dev/null @@ -1,128 +0,0 @@ -package binnie.core.machines.storage; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import binnie.core.machines.IMachine; -import binnie.core.machines.inventory.ComponentInventorySlots; -import binnie.core.machines.network.INetwork; -import cpw.mods.fml.relauncher.Side; - -class ComponentCompartmentInventory - extends ComponentInventorySlots - implements INetwork.GuiNBT -{ - private int numberOfTabs; - private int slotsPerPage; - - public ComponentCompartmentInventory(IMachine machine, int sections) - { - this(machine, sections, 4); - } - - public ComponentCompartmentInventory(IMachine machine, int tabs, int pageSize) - { - super(machine); - - this.numberOfTabs = tabs; - this.slotsPerPage = pageSize; - for (int i = 0; i < this.numberOfTabs * this.slotsPerPage; i++) { - addSlot(i, "compartment"); - } - } - - public int getPageSize() - { - return this.slotsPerPage; - } - - public int getTabNumber() - { - return this.numberOfTabs; - } - - public int[] getSlotsForTab(int currentTab) - { - int[] slots = new int[this.slotsPerPage]; - for (int i = 0; i < this.slotsPerPage; i++) { - slots[i] = (i + currentTab * this.slotsPerPage); - } - return slots; - } - - private Map<Integer, CompartmentTab> tabs = new HashMap(); - - public CompartmentTab getTab(int i) - { - if (!this.tabs.containsKey(Integer.valueOf(i))) { - this.tabs.put(Integer.valueOf(i), new CompartmentTab(i)); - } - return (CompartmentTab)this.tabs.get(Integer.valueOf(i)); - } - - public void sendGuiNBT(Map<String, NBTTagCompound> nbt) - { - NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.numberOfTabs; i++) - { - NBTTagCompound nbt2 = new NBTTagCompound(); - getTab(i).writeToNBT(nbt2); - list.appendTag(nbt2); - } - NBTTagCompound tag = new NBTTagCompound(); - tag.setTag("tabs", list); - nbt.put("comp-tabs", tag); - } - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) - { - if (name.equals("comp-tabs")) - { - NBTTagList tags = nbt.getTagList("tabs", 10); - for (int i = 0; i < tags.tagCount(); i++) - { - NBTTagCompound tag = tags.getCompoundTagAt(i); - CompartmentTab tab = new CompartmentTab(0); - tab.readFromNBT(tag); - this.tabs.put(Integer.valueOf(tab.getId()), tab); - } - } - if (name.equals("comp-change-tab")) - { - NBTTagCompound tag = nbt; - CompartmentTab tab = new CompartmentTab(0); - tab.readFromNBT(tag); - this.tabs.put(Integer.valueOf(tab.getId()), tab); - getMachine().getTileEntity().markDirty(); - } - } - - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagList tags = nbt.getTagList("tabs", 10); - for (int i = 0; i < tags.tagCount(); i++) - { - NBTTagCompound tag = tags.getCompoundTagAt(i); - CompartmentTab tab = new CompartmentTab(0); - tab.readFromNBT(tag); - this.tabs.put(Integer.valueOf(tab.getId()), tab); - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.numberOfTabs; i++) - { - NBTTagCompound nbt2 = new NBTTagCompound(); - getTab(i).writeToNBT(nbt2); - list.appendTag(nbt2); - } - nbt.setTag("tabs", list); - } -} diff --git a/src/Java/binnie/core/machines/storage/ControlColourSelector.java b/src/Java/binnie/core/machines/storage/ControlColourSelector.java deleted file mode 100644 index c5320a2629..0000000000 --- a/src/Java/binnie/core/machines/storage/ControlColourSelector.java +++ /dev/null @@ -1,47 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.core.IControlValue; -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.ITooltip; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.Tooltip; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.minecraft.EnumColor; - -class ControlColourSelector - extends Control - implements ITooltip, IControlValue<EnumColor> -{ - private EnumColor value; - - public ControlColourSelector(IWidget parent, float x, float y, float w, float h, EnumColor value) - { - super(parent, x, y, w, h); - setValue(value); - addAttribute(Attribute.MouseOver); - } - - public void getTooltip(Tooltip tooltip) - { - tooltip.add(this.value.toString()); - } - - public EnumColor getValue() - { - return this.value; - } - - public void setValue(EnumColor value) - { - this.value = value; - setColour(getValue().getColour()); - } - - public void onRenderBackground() - { - super.onRenderBackground(); - CraftGUI.Render.gradientRect(getArea(), -16777216 + this.value.getColour(), -16777216 + this.value.getColour()); - } -} diff --git a/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java b/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java deleted file mode 100644 index 133b5293ff..0000000000 --- a/src/Java/binnie/core/machines/storage/MachineRendererCompartment.java +++ /dev/null @@ -1,50 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.core.BinnieCore; -import binnie.core.machines.Machine; -import binnie.core.proxy.BinnieProxy; -import binnie.core.resource.BinnieResource; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.tileentity.TileEntity; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -class MachineRendererCompartment -{ - public static MachineRendererCompartment instance = new MachineRendererCompartment(); - private ModelCompartment model; - - public MachineRendererCompartment() - { - this.model = new ModelCompartment(); - } - - public void renderMachine(Machine machine, int colour, BinnieResource texture, double x, double y, double z, float var8) - { - GL11.glPushMatrix(); - - int i1 = 0; - - int ix = machine.getTileEntity().xCoord; - int iy = machine.getTileEntity().yCoord; - int iz = machine.getTileEntity().zCoord; - if (machine.getTileEntity() != null) { - i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz; - } - float phase = (float)Math.max(0.0D, Math.sin((System.currentTimeMillis() + i1) * 0.003D)); - - GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - - BinnieCore.proxy.bindTexture(texture); - - GL11.glPushMatrix(); - - this.model.render(null, (float)x, (float)y, (float)z, 0.0625F, 0.0625F, 0.0625F); - - GL11.glPopMatrix(); - - GL11.glPopMatrix(); - } -} diff --git a/src/Java/binnie/core/machines/storage/ModelCompartment.java b/src/Java/binnie/core/machines/storage/ModelCompartment.java deleted file mode 100644 index 9e5aef450a..0000000000 --- a/src/Java/binnie/core/machines/storage/ModelCompartment.java +++ /dev/null @@ -1,171 +0,0 @@ -package binnie.core.machines.storage; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -class ModelCompartment - extends ModelBase -{ - private ModelRenderer Column1; - private ModelRenderer Column4; - private ModelRenderer Column2; - private ModelRenderer Column3; - private ModelRenderer Lid_1; - private ModelRenderer Body_1; - private ModelRenderer Lock_1; - private ModelRenderer Lid_2; - private ModelRenderer Body_2; - private ModelRenderer Lock_2; - private ModelRenderer Body; - private ModelRenderer Lid_3; - private ModelRenderer Body_3; - private ModelRenderer Lock_3; - private ModelRenderer Lid_4; - private ModelRenderer Body_4; - private ModelRenderer Lock_4; - - public ModelCompartment() - { - this.textureWidth = 128; - this.textureHeight = 128; - - this.Column1 = new ModelRenderer(this, 0, 0); - this.Column1.addBox(-8.0F, 8.0F, -8.0F, 4, 16, 4); - this.Column1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Column1.setTextureSize(128, 128); - this.Column1.mirror = true; - setRotation(this.Column1, 0.0F, 0.0F, 0.0F); - this.Column4 = new ModelRenderer(this, 0, 0); - this.Column4.addBox(4.0F, 8.0F, -8.0F, 4, 16, 4); - this.Column4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Column4.setTextureSize(128, 128); - this.Column4.mirror = true; - setRotation(this.Column4, 0.0F, 0.0F, 0.0F); - this.Column2 = new ModelRenderer(this, 0, 0); - this.Column2.addBox(-8.0F, 8.0F, 4.0F, 4, 16, 4); - this.Column2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Column2.setTextureSize(128, 128); - this.Column2.mirror = true; - setRotation(this.Column2, 0.0F, 0.0F, 0.0F); - this.Column3 = new ModelRenderer(this, 0, 0); - this.Column3.addBox(4.0F, 8.0F, 4.0F, 4, 16, 4); - this.Column3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Column3.setTextureSize(128, 128); - this.Column3.mirror = true; - setRotation(this.Column3, 0.0F, 0.0F, 0.0F); - this.Lid_1 = new ModelRenderer(this, 48, 0); - this.Lid_1.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3); - this.Lid_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lid_1.setTextureSize(128, 128); - this.Lid_1.mirror = true; - setRotation(this.Lid_1, 0.0F, 0.0F, 0.0F); - this.Body_1 = new ModelRenderer(this, 0, 24); - this.Body_1.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3); - this.Body_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body_1.setTextureSize(128, 128); - this.Body_1.mirror = true; - setRotation(this.Body_1, 0.0F, 0.0F, 0.0F); - this.Lock_1 = new ModelRenderer(this, 22, 24); - this.Lock_1.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1); - this.Lock_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lock_1.setTextureSize(128, 128); - this.Lock_1.mirror = true; - setRotation(this.Lock_1, 0.0F, 0.0F, 0.0F); - this.Lid_2 = new ModelRenderer(this, 48, 0); - this.Lid_2.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3); - this.Lid_2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lid_2.setTextureSize(128, 128); - this.Lid_2.mirror = true; - setRotation(this.Lid_2, 0.0F, 1.570796F, 0.0F); - this.Body_2 = new ModelRenderer(this, 0, 24); - this.Body_2.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3); - this.Body_2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body_2.setTextureSize(128, 128); - this.Body_2.mirror = true; - setRotation(this.Body_2, 0.0F, 1.570796F, 0.0F); - this.Lock_2 = new ModelRenderer(this, 22, 24); - this.Lock_2.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1); - this.Lock_2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lock_2.setTextureSize(128, 128); - this.Lock_2.mirror = true; - setRotation(this.Lock_2, 0.0F, 1.570796F, 0.0F); - this.Body = new ModelRenderer(this, 16, 0); - this.Body.addBox(-4.0F, 8.0F, -4.0F, 8, 16, 8); - this.Body.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body.setTextureSize(128, 128); - this.Body.mirror = true; - setRotation(this.Body, 0.0F, 0.0F, 0.0F); - this.Lid_3 = new ModelRenderer(this, 48, 0); - this.Lid_3.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3); - this.Lid_3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lid_3.setTextureSize(128, 128); - this.Lid_3.mirror = true; - setRotation(this.Lid_3, 0.0F, 3.141593F, 0.0F); - this.Body_3 = new ModelRenderer(this, 0, 24); - this.Body_3.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3); - this.Body_3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body_3.setTextureSize(128, 128); - this.Body_3.mirror = true; - setRotation(this.Body_3, 0.0F, 3.141593F, 0.0F); - this.Lock_3 = new ModelRenderer(this, 22, 24); - this.Lock_3.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1); - this.Lock_3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lock_3.setTextureSize(128, 128); - this.Lock_3.mirror = true; - setRotation(this.Lock_3, 0.0F, 3.141593F, 0.0F); - this.Lid_4 = new ModelRenderer(this, 48, 0); - this.Lid_4.addBox(-4.0F, 9.0F, -7.0F, 8, 5, 3); - this.Lid_4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lid_4.setTextureSize(128, 128); - this.Lid_4.mirror = true; - setRotation(this.Lid_4, 0.0F, -1.570796F, 0.0F); - this.Body_4 = new ModelRenderer(this, 0, 24); - this.Body_4.addBox(-4.0F, 14.0F, -7.0F, 8, 10, 3); - this.Body_4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body_4.setTextureSize(128, 128); - this.Body_4.mirror = true; - setRotation(this.Body_4, 0.0F, -1.570796F, 0.0F); - this.Lock_4 = new ModelRenderer(this, 22, 24); - this.Lock_4.addBox(-1.0F, 12.0F, -8.0F, 2, 4, 1); - this.Lock_4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Lock_4.setTextureSize(128, 128); - this.Lock_4.mirror = true; - setRotation(this.Lock_4, 0.0F, -1.570796F, 0.0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - this.Column1.render(f5); - this.Column4.render(f5); - this.Column2.render(f5); - this.Column3.render(f5); - this.Lid_1.render(f5); - this.Body_1.render(f5); - this.Lock_1.render(f5); - this.Lid_2.render(f5); - this.Body_2.render(f5); - this.Lock_2.render(f5); - this.Body.render(f5); - this.Lid_3.render(f5); - this.Body_3.render(f5); - this.Lock_3.render(f5); - this.Lid_4.render(f5); - this.Body_4.render(f5); - this.Lock_4.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } -} diff --git a/src/Java/binnie/core/machines/storage/ModuleStorage.java b/src/Java/binnie/core/machines/storage/ModuleStorage.java deleted file mode 100644 index 7f8bb38ac4..0000000000 --- a/src/Java/binnie/core/machines/storage/ModuleStorage.java +++ /dev/null @@ -1,39 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.core.BinnieCore; -import binnie.core.IInitializable; -import binnie.core.machines.MachineGroup; -import cpw.mods.fml.common.registry.GameRegistry; -import java.util.ArrayList; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; - -public class ModuleStorage - implements IInitializable -{ - public void preInit() - { - BinnieCore.packageCompartment = new MachineGroup(BinnieCore.instance, "storage", "storage", Compartment.values()); - BinnieCore.packageCompartment.setCreativeTab(CreativeTabs.tabBlock); - } - - public void init() {} - - public void postInit() - { - String ironGear = OreDictionary.getOres("gearIron").isEmpty() ? "ingotIron" : "gearIron"; - String goldGear = OreDictionary.getOres("gearGold").isEmpty() ? "ingotGold" : "gearGold"; - String diamondGear = "gemDiamond"; - - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.Compartment.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Items.book, Character.valueOf('c'), Blocks.chest, Character.valueOf('p'), Blocks.stone_button })); - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentCopper.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.Compartment.get(1), Character.valueOf('c'), "gearCopper", Character.valueOf('p'), Blocks.stone_button })); - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentBronze.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentCopper.get(1), Character.valueOf('c'), "gearBronze", Character.valueOf('p'), Items.gold_nugget })); - - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentIron.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentCopper.get(1), Character.valueOf('c'), ironGear, Character.valueOf('p'), Items.gold_nugget })); - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentGold.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentIron.get(1), Character.valueOf('c'), goldGear, Character.valueOf('p'), Items.emerald })); - GameRegistry.addRecipe(new ShapedOreRecipe(Compartment.CompartmentDiamond.get(1), new Object[] { "pcp", "cbc", "pcp", Character.valueOf('b'), Compartment.CompartmentGold.get(1), Character.valueOf('c'), diamondGear, Character.valueOf('p'), Items.emerald })); - } -} diff --git a/src/Java/binnie/core/machines/storage/StandardCompartment.java b/src/Java/binnie/core/machines/storage/StandardCompartment.java deleted file mode 100644 index 341657cb9e..0000000000 --- a/src/Java/binnie/core/machines/storage/StandardCompartment.java +++ /dev/null @@ -1,142 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.core.gui.BinnieCoreGUI; -import binnie.core.machines.Machine; -import binnie.core.machines.TileEntityMachine; -import binnie.core.texture.BinnieCoreTexture; -import net.minecraft.tileentity.TileEntity; - -class StandardCompartment -{ - public static class PackageCompartment - extends Compartment.PackageCompartment - { - public PackageCompartment() - { - super(BinnieCoreTexture.Compartment); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 4, 25); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } - - public static class PackageCompartmentCopper - extends Compartment.PackageCompartment - { - public PackageCompartmentCopper() - { - super(BinnieCoreTexture.CompartmentCopper); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 6, 25); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } - - public static class PackageCompartmentBronze - extends Compartment.PackageCompartment - { - public PackageCompartmentBronze() - { - super(BinnieCoreTexture.CompartmentBronze); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 8, 25); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } - - public static class PackageCompartmentIron - extends Compartment.PackageCompartment - { - public PackageCompartmentIron() - { - super(BinnieCoreTexture.CompartmentIron); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 4, 50); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } - - public static class PackageCompartmentGold - extends Compartment.PackageCompartment - { - public PackageCompartmentGold() - { - super(BinnieCoreTexture.CompartmentGold); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 6, 50); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } - - public static class PackageCompartmentDiamond - extends Compartment.PackageCompartment - { - public PackageCompartmentDiamond() - { - super(BinnieCoreTexture.CompartmentDiamond); - } - - public void createMachine(Machine machine) - { - new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment); - new ComponentCompartmentInventory(machine, 8, 50); - } - - public TileEntity createTileEntity() - { - return new TileEntityMachine(this); - } - - public void register() {} - } -} diff --git a/src/Java/binnie/core/machines/storage/WindowCompartment.java b/src/Java/binnie/core/machines/storage/WindowCompartment.java deleted file mode 100644 index 6c28ed0714..0000000000 --- a/src/Java/binnie/core/machines/storage/WindowCompartment.java +++ /dev/null @@ -1,594 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.machines.IMachine; -import binnie.core.machines.Machine; -import binnie.core.machines.MachinePackage; -import binnie.core.machines.transfer.TransferRequest; -import binnie.craftgui.controls.ControlCheckbox; -import binnie.craftgui.controls.ControlText; -import binnie.craftgui.controls.ControlTextEdit; -import binnie.craftgui.controls.button.ControlButton; -import binnie.craftgui.controls.core.Control; -import binnie.craftgui.controls.page.ControlPage; -import binnie.craftgui.controls.page.ControlPages; -import binnie.craftgui.controls.scroll.ControlScrollableContent; -import binnie.craftgui.controls.tab.ControlTab; -import binnie.craftgui.controls.tab.ControlTabBar; -import binnie.craftgui.core.Attribute; -import binnie.craftgui.core.CraftGUI; -import binnie.craftgui.core.IWidget; -import binnie.craftgui.core.geometry.CraftGUIUtil; -import binnie.craftgui.core.geometry.IArea; -import binnie.craftgui.core.geometry.IBorder; -import binnie.craftgui.core.geometry.IPoint; -import binnie.craftgui.core.geometry.Position; -import binnie.craftgui.core.renderer.Renderer; -import binnie.craftgui.events.EventHandler.Origin; -import binnie.craftgui.events.EventMouse.Down; -import binnie.craftgui.events.EventMouse.Down.Handler; -import binnie.craftgui.events.EventTextEdit; -import binnie.craftgui.events.EventTextEdit.Handler; -import binnie.craftgui.events.EventValueChanged; -import binnie.craftgui.events.EventValueChanged.Handler; -import binnie.craftgui.genetics.machine.WindowMachine; -import binnie.craftgui.minecraft.Dialog; -import binnie.craftgui.minecraft.EnumColor; -import binnie.craftgui.minecraft.IWindowAffectsShiftClick; -import binnie.craftgui.minecraft.MinecraftGUI.PanelType; -import binnie.craftgui.minecraft.Window; -import binnie.craftgui.minecraft.control.ControlItemDisplay; -import binnie.craftgui.minecraft.control.ControlPlayerInventory; -import binnie.craftgui.minecraft.control.ControlSlide; -import binnie.craftgui.minecraft.control.ControlSlot; -import binnie.craftgui.minecraft.control.ControlSlotArray; -import binnie.craftgui.minecraft.control.ControlTabIcon; -import binnie.craftgui.resource.Texture; -import binnie.craftgui.resource.minecraft.CraftGUITexture; -import binnie.craftgui.window.Panel; -import binnie.craftgui.window.Panel.IPanelType; -import cpw.mods.fml.relauncher.Side; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class WindowCompartment - extends WindowMachine - implements IWindowAffectsShiftClick -{ - public static Window create(EntityPlayer player, IInventory inventory, Side side) - { - return new WindowCompartment(player, inventory, side); - } - - public WindowCompartment(EntityPlayer player, IInventory inventory, Side side) - { - super(320, 226, player, inventory, side); - } - - private final Map<Panel, Integer> panels = new HashMap(); - private ControlTextEdit tabName; - private ControlItemDisplay tabIcon; - private ControlColourSelector tabColour; - boolean dueUpdate; - - public void initialiseClient() - { - setTitle(Machine.getMachine(getInventory()).getPackage().getDisplayName()); - - int x = 16; - int y = 32; - - ComponentCompartmentInventory inv = (ComponentCompartmentInventory)Machine.getMachine(getInventory()).getInterface(ComponentCompartmentInventory.class); - - - - Integer[] tabs1 = new Integer[0]; - Integer[] tabs2 = new Integer[0]; - if (inv.getTabNumber() == 4) - { - tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1) }; - tabs2 = new Integer[] { Integer.valueOf(2), Integer.valueOf(3) }; - } - if (inv.getTabNumber() == 6) - { - tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2) }; - tabs2 = new Integer[] { Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5) }; - } - if (inv.getTabNumber() == 8) - { - tabs1 = new Integer[] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) }; - tabs2 = new Integer[] { Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6), Integer.valueOf(7) }; - } - boolean doubleTabbed = tabs2.length > 0; - - int compartmentPageWidth = 16 + 18 * inv.getPageSize() / 5; - int compartmentPageHeight = 106; - int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24); - int compartmentHeight = compartmentPageHeight; - - - - Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight); - - final ControlTabBar<Integer> tab = new ControlTabBar(controlCompartment, 0.0F, 0.0F, 24.0F, compartmentPageHeight, Position.Left) - { - public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value) - { - new ControlTabIcon(this, x, y, w, h, value) - { - public ItemStack getItemStack() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getIcon(); - } - - public String getName() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getName(); - } - - public int getOutlineColour() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getColor().getColour(); - } - - public boolean hasOutline() - { - return true; - } - }; - } - }; - String[] tabHelp = { "Compartment Tab", "Tabs that divide the inventory into sections. Each one can be labelled seperately." }; - - tab.addHelp(tabHelp); - - tab.setValues(Arrays.asList(tabs1)); - tab.setValue(Integer.valueOf(0)); - - tab.addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - NBTTagCompound nbt = new NBTTagCompound(); - int i = ((Integer)event.getValue()).intValue(); - nbt.setByte("i", (byte)i); - Window.get(tab).sendClientAction("tab-change", nbt); - WindowCompartment.this.currentTab = i; - } - }.setOrigin(EventHandler.Origin.DirectChild, tab)); - - - - - x += 24; - - ControlPages<Integer> compartmentPages = new ControlPages(controlCompartment, 24.0F, 0.0F, compartmentPageWidth, compartmentPageHeight); - - ControlPage[] page = new ControlPage[inv.getTabNumber()]; - for (int p = 0; p < inv.getTabNumber(); p++) { - page[p] = new ControlPage(compartmentPages, Integer.valueOf(p)); - } - CraftGUIUtil.linkWidgets(tab, compartmentPages); - - int i = 0; - for (int p = 0; p < inv.getTabNumber(); p++) - { - ControlPage thisPage = page[p]; - - Panel panel = new Panel(thisPage, 0.0F, 0.0F, thisPage.w(), thisPage.h(), MinecraftGUI.PanelType.Black) - { - public void onRenderForeground() - { - Texture iTexture = CraftGUI.Render.getTexture(CraftGUITexture.TabOutline); - - CraftGUI.Render.colour(WindowCompartment.this.getTab(((Integer)WindowCompartment.this.panels.get(this)).intValue()).getColor().getColour()); - - CraftGUI.Render.texture(iTexture, getArea().inset(3)); - } - }; - this.panels.put(panel, Integer.valueOf(p)); - - int[] slotsIDs = new int[inv.getPageSize()]; - for (int k = 0; k < inv.getPageSize(); k++) { - slotsIDs[k] = (i++); - } - new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5).create(slotsIDs); - } - x += compartmentPageWidth; - if (tabs2.length > 0) - { - ControlTabBar<Integer> tab2 = new ControlTabBar(controlCompartment, 24 + compartmentPageWidth, 0.0F, 24.0F, compartmentPageHeight, Position.Right) - { - public ControlTab<Integer> createTab(float x, float y, float w, float h, Integer value) - { - new ControlTabIcon(this, x, y, w, h, value) - { - public ItemStack getItemStack() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getIcon(); - } - - public String getName() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getName(); - } - - public int getOutlineColour() - { - return WindowCompartment.this.getTab(((Integer)this.value).intValue()).getColor().getColour(); - } - - public boolean hasOutline() - { - return true; - } - }; - } - }; - tab2.setValues(Arrays.asList(tabs2)); - tab2.setValue(Integer.valueOf(0)); - tab2.addHelp(tabHelp); - - tab2.addEventHandler(new EventValueChanged.Handler() - { - public void onEvent(EventValueChanged event) - { - NBTTagCompound nbt = new NBTTagCompound(); - int i = ((Integer)event.getValue()).intValue(); - nbt.setByte("i", (byte)i); - Window.get(tab).sendClientAction("tab-change", nbt); - WindowCompartment.this.currentTab = i; - } - }.setOrigin(EventHandler.Origin.DirectChild, tab2)); - - - - - CraftGUIUtil.linkWidgets(tab2, compartmentPages); - - x += 24; - } - x += 16; - - setSize(new IPoint(Math.max(32 + compartmentWidth, 252), h())); - - controlCompartment.setPosition(new IPoint((w() - controlCompartment.w()) / 2.0F, controlCompartment.y())); - - - - ControlPlayerInventory invent = new ControlPlayerInventory(this, true); - - ControlSlide slide = new ControlSlide(this, 0.0F, 134.0F, 136.0F, 92.0F, Position.Left); - slide.setLabel("Tab Properties"); - slide.setSlide(false); - - slide.addHelp("Tab Properties"); - slide.addHelp("The label, colour and icon of the Tab can be altered here. Clicking on the icon with a held item will change it."); - - Panel tabPropertyPanel = new Panel(slide, 16.0F, 8.0F, 112.0F, 76.0F, MinecraftGUI.PanelType.Gray); - - int y2 = 4; - - new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Tab Name:"); - y2 += 12;this.tabName = new ControlTextEdit(tabPropertyPanel, 4.0F, y2, 104.0F, 12.0F); - - this.tabName.addSelfEventHandler(new EventTextEdit.Handler() - { - public void onEvent(EventTextEdit event) - { - CompartmentTab tab = WindowCompartment.this.getCurrentTab(); - tab.setName((String)event.getValue()); - NBTTagCompound nbt = new NBTTagCompound(); - tab.writeToNBT(nbt); - WindowCompartment.this.sendClientAction("comp-change-tab", nbt); - } - }.setOrigin(EventHandler.Origin.Self, this.tabName)); - - - - - y2 += 20; - - new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Tab Icon: "); - this.tabIcon = new ControlItemDisplay(tabPropertyPanel, 58.0F, y2 - 4); - this.tabIcon.setItemStack(new ItemStack(Items.paper)); - this.tabIcon.addAttribute(Attribute.MouseOver); - this.tabIcon.addSelfEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - if (WindowCompartment.this.getHeldItemStack() == null) { - return; - } - CompartmentTab tab = WindowCompartment.this.getCurrentTab(); - ItemStack stack = WindowCompartment.this.getHeldItemStack().copy(); - stack.stackSize = 1; - tab.setIcon(stack); - NBTTagCompound nbt = new NBTTagCompound(); - tab.writeToNBT(nbt); - WindowCompartment.this.sendClientAction("comp-change-tab", nbt); - } - }); - this.tabColour = new ControlColourSelector(tabPropertyPanel, 82.0F, y2 - 4, 16.0F, 16.0F, EnumColor.White); - - this.tabIcon.addHelp("Icon for Current Tab"); - this.tabIcon.addHelp("Click here with an item to change"); - - y2 += 20; - - new ControlText(tabPropertyPanel, new IPoint(4.0F, y2), "Colour: "); - - int cw = 8; - - Panel panelColour = new Panel(tabPropertyPanel, 40.0F, y2 - 4, cw * 8 + 2, cw * 2 + 1, MinecraftGUI.PanelType.Gray); - for (int cc = 0; cc < 16; cc++) - { - final ControlColourSelector color = new ControlColourSelector(panelColour, 1 + cw * (cc % 8), 1 + cw * (cc / 8), cw, cw, EnumColor.values()[cc]); - color.addSelfEventHandler(new EventMouse.Down.Handler() - { - public void onEvent(EventMouse.Down event) - { - CompartmentTab tab = WindowCompartment.this.getCurrentTab(); - tab.setColor(color.getValue()); - NBTTagCompound nbt = new NBTTagCompound(); - tab.writeToNBT(nbt); - WindowCompartment.this.sendClientAction("comp-change-tab", nbt); - } - }); - color.addHelp("Colour Selector"); - color.addHelp("Select a colour to highlight the current tab"); - } - y2 += 20; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ControlButton searchButton = new ControlButton(controlCompartment, compartmentWidth - 24 - 64 - 8, compartmentPageHeight, 64.0F, 16.0F, "Search") - { - protected void onMouseClick(EventMouse.Down event) - { - WindowCompartment.this.createSearchDialog(); - } - - public void onRenderBackground() - { - Object texture = isMouseOver() ? CraftGUITexture.TabHighlighted : CraftGUITexture.Tab; - CraftGUI.Render.texture(CraftGUI.Render.getTexture(texture).crop(Position.Bottom, 8.0F), getArea()); - } - }; - searchButton.addHelp("Search Button"); - searchButton.addHelp("Clicking this will open the Search dialog. This allows you to search the inventory for specific items."); - } - - public void createSearchDialog() - { - new Dialog(this, 252.0F, 192.0F) - { - Control slotGrid; - String textSearch = ""; - boolean sortByName = false; - boolean includeItems = true; - boolean includeBlocks = true; - - public void onClose() {} - - public void initialise() - { - ControlScrollableContent<IWidget> scroll = new ControlScrollableContent(this, 124.0F, 16.0F, 116.0F, 92.0F, 6.0F) - { - public void onRenderBackground() - { - CraftGUI.Render.colour(11184810); - CraftGUI.Render.texture(CraftGUITexture.Outline, getArea().inset(new IBorder(0.0F, 6.0F, 0.0F, 0.0F))); - } - }; - this.slotGrid = new Control(scroll, 1.0F, 1.0F, 108.0F, 18.0F); - - scroll.setScrollableContent(this.slotGrid); - - new ControlPlayerInventory(this, true); - - new ControlTextEdit(this, 16.0F, 16.0F, 100.0F, 14.0F).addEventHandler(new EventTextEdit.Handler() - { - public void onEvent(EventTextEdit event) - { - WindowCompartment.10.this.textSearch = ((String)event.value); - WindowCompartment.10.this.updateSearch(); - } - }); - this.includeItems = true; - this.includeBlocks = true; - - new ControlCheckbox(this, 16.0F, 40.0F, 100.0F, "Sort A-Z", this.sortByName) - { - protected void onValueChanged(boolean value) - { - WindowCompartment.10.this.sortByName = value; - WindowCompartment.10.this.updateSearch(); - } - }; - new ControlCheckbox(this, 16.0F, 64.0F, 100.0F, "Include Items", this.includeItems) - { - protected void onValueChanged(boolean value) - { - WindowCompartment.10.this.includeItems = value; - WindowCompartment.10.this.updateSearch(); - } - }; - new ControlCheckbox(this, 16.0F, 88.0F, 100.0F, "Include Blocks", this.includeBlocks) - { - protected void onValueChanged(boolean value) - { - WindowCompartment.10.this.includeBlocks = value; - WindowCompartment.10.this.updateSearch(); - } - }; - updateSearch(); - } - - private void updateSearch() - { - Map<Integer, String> slotIds = new HashMap(); - IInventory inv = WindowCompartment.this.getInventory(); - for (int i = 0; i < inv.getSizeInventory(); i++) - { - ItemStack stack = inv.getStackInSlot(i); - if (stack != null) - { - String name = stack.getDisplayName().toLowerCase(); - if ((this.textSearch == null) || (name.contains(this.textSearch))) { - if ((this.includeBlocks) || (Block.getBlockFromItem(stack.getItem()) == Blocks.air)) { - if ((this.includeItems) || (Block.getBlockFromItem(stack.getItem()) != Blocks.air)) { - slotIds.put(Integer.valueOf(i), name); - } - } - } - } - } - if (this.sortByName) - { - List list = new LinkedList(slotIds.entrySet()); - Collections.sort(list, new Comparator() - { - public int compare(Object o1, Object o2) - { - return -((Comparable)((Map.Entry)o2).getValue()).compareTo(((Map.Entry)o1).getValue()); - } - }); - Map result = new LinkedHashMap(); - for (Iterator it = list.iterator(); it.hasNext();) - { - Map.Entry entry = (Map.Entry)it.next(); - result.put(entry.getKey(), entry.getValue()); - } - slotIds = result; - } - int y = 0; - int x = 0; - int width = 108; - int height = 2 + 18 * (1 + (slotIds.size() - 1) / 6); - this.slotGrid.deleteAllChildren(); - this.slotGrid.setSize(new IPoint(width, height)); - for (Iterator i$ = slotIds.keySet().iterator(); i$.hasNext();) - { - int k = ((Integer)i$.next()).intValue(); - new ControlSlot(this.slotGrid, x, y).assign(k); - x += 18; - if (x >= 108) - { - x = 0; - y += 18; - } - } - while ((y < 108) || (x != 0)) - { - new ControlSlot(this.slotGrid, x, y); - x += 18; - if (x >= 108) - { - x = 0; - y += 18; - } - } - } - }; - } - - public void onUpdateClient() - { - super.onUpdateClient(); - updateTabs(); - } - - public void updateTabs() - { - this.tabName.setValue(getCurrentTab().getName()); - this.tabIcon.setItemStack(getCurrentTab().getIcon()); - this.tabColour.setValue(getCurrentTab().getColor()); - } - - private int currentTab = 0; - - public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) - { - super.recieveGuiNBT(side, player, name, action); - if (name.equals("tab-change")) { - this.currentTab = action.getByte("i"); - } - } - - public String getTitle() - { - return "Compartment"; - } - - protected AbstractMod getMod() - { - return BinnieCore.instance; - } - - protected String getName() - { - return "compartment"; - } - - public void alterRequest(TransferRequest request) - { - if (request.getDestination() == getInventory()) - { - ComponentCompartmentInventory inv = (ComponentCompartmentInventory)Machine.getMachine(getInventory()).getInterface(ComponentCompartmentInventory.class); - request.setTargetSlots(inv.getSlotsForTab(this.currentTab)); - } - } - - public CompartmentTab getTab(int i) - { - return ((ComponentCompartmentInventory)Machine.getInterface(ComponentCompartmentInventory.class, getInventory())).getTab(i); - } - - public CompartmentTab getCurrentTab() - { - return getTab(this.currentTab); - } -} diff --git a/src/Java/binnie/core/machines/storage/WindowTest.java b/src/Java/binnie/core/machines/storage/WindowTest.java deleted file mode 100644 index 55c2a0b9db..0000000000 --- a/src/Java/binnie/core/machines/storage/WindowTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package binnie.core.machines.storage; - -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.craftgui.genetics.machine.WindowMachine; -import binnie.craftgui.minecraft.Window; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; - -public class WindowTest - extends WindowMachine -{ - public static Window create(EntityPlayer player, IInventory inventory, Side side) - { - return new WindowCompartment(player, inventory, side); - } - - public WindowTest(EntityPlayer player, IInventory inventory, Side side) - { - super(320, 240, player, inventory, side); - } - - public void initialiseClient() {} - - public String getTitle() - { - return "Test"; - } - - protected AbstractMod getMod() - { - return BinnieCore.instance; - } - - protected String getName() - { - return "Test"; - } -} diff --git a/src/Java/binnie/core/machines/transfer/TransferHandler.java b/src/Java/binnie/core/machines/transfer/TransferHandler.java deleted file mode 100644 index 8d8c2bdb57..0000000000 --- a/src/Java/binnie/core/machines/transfer/TransferHandler.java +++ /dev/null @@ -1,3 +0,0 @@ -package binnie.core.machines.transfer; - -public class TransferHandler {} diff --git a/src/Java/binnie/core/machines/transfer/TransferRequest.java b/src/Java/binnie/core/machines/transfer/TransferRequest.java deleted file mode 100644 index 8059a6b512..0000000000 --- a/src/Java/binnie/core/machines/transfer/TransferRequest.java +++ /dev/null @@ -1,419 +0,0 @@ -package binnie.core.machines.transfer; - -import binnie.core.machines.Machine; -import binnie.core.machines.inventory.IInventorySlots; -import binnie.core.machines.inventory.IValidatedTankContainer; -import binnie.core.machines.inventory.InventorySlot; -import binnie.core.machines.power.ITankMachine; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.fluids.IFluidTank; - -public class TransferRequest -{ - private ItemStack itemToTransfer = null; - private ItemStack returnItem = null; - private IInventory origin; - private IInventory destination; - private int[] targetSlots = new int[0]; - private int[] targetTanks = new int[0]; - private boolean transferLiquids = true; - private boolean ignoreReadOnly = false; - - public TransferRequest(ItemStack toTransfer, IInventory destination) - { - int[] target = new int[destination.getSizeInventory()]; - for (int i = 0; i < target.length; i++) { - target[i] = i; - } - int[] targetTanks = new int[0]; - if ((destination instanceof ITankMachine)) - { - targetTanks = new int[((ITankMachine)destination).getTanks().length]; - for (int i = 0; i < targetTanks.length; i++) { - targetTanks[i] = i; - } - } - if (toTransfer != null) - { - setItemToTransfer(toTransfer.copy()); - setReturnItem(toTransfer.copy()); - } - setOrigin(null); - setDestination(destination); - setTargetSlots(target); - setTargetTanks(targetTanks); - this.transferLiquids = true; - } - - private void setItemToTransfer(ItemStack itemToTransfer) - { - this.itemToTransfer = itemToTransfer; - } - - private void setReturnItem(ItemStack returnItem) - { - this.returnItem = returnItem; - } - - public TransferRequest setOrigin(IInventory origin) - { - this.origin = origin; - return this; - } - - private void setDestination(IInventory destination) - { - this.destination = destination; - } - - public TransferRequest setTargetSlots(int[] targetSlots) - { - this.targetSlots = targetSlots; - return this; - } - - public TransferRequest setTargetTanks(int[] targetTanks) - { - this.targetTanks = targetTanks; - return this; - } - - public TransferRequest ignoreValidation() - { - this.ignoreReadOnly = true; - return this; - } - - public ItemStack getReturnItem() - { - return this.returnItem; - } - - public ItemStack transfer(boolean doAdd) - { - ItemStack item = this.returnItem; - if ((item == null) || (this.destination == null)) { - return null; - } - if ((this.transferLiquids) && ((this.destination instanceof ITankMachine))) { - for (int tankID : this.targetTanks) - { - item = transferToTank(item, this.origin, (ITankMachine)this.destination, tankID, doAdd); - if (item != null) { - item = transferFromTank(item, this.origin, (ITankMachine)this.destination, tankID, doAdd); - } - } - } - if (item != null) { - for (int slot : this.targetSlots) { - if ((this.destination.isItemValidForSlot(slot, item)) || (this.ignoreReadOnly)) { - if ((!(this.destination instanceof IInventorySlots)) || (((IInventorySlots)this.destination).getSlot(slot) == null) || (!((IInventorySlots)this.destination).getSlot(slot).isRecipe())) { - if (this.destination.getStackInSlot(slot) != null) { - if (item.isStackable()) - { - ItemStack merged = this.destination.getStackInSlot(slot).copy(); - ItemStack[] newStacks = mergeStacks(item.copy(), merged.copy()); - item = newStacks[0]; - if (!areItemsEqual(merged, newStacks[1])) { - this.insertedSlots.add(new TransferSlot(slot, this.destination)); - } - if (doAdd) { - this.destination.setInventorySlotContents(slot, newStacks[1]); - } - if (item == null) { - return null; - } - } - } - } - } - } - } - if (item != null) { - for (int slot : this.targetSlots) { - if ((this.destination.isItemValidForSlot(slot, item)) || (this.ignoreReadOnly)) { - if ((!(this.destination instanceof IInventorySlots)) || (((IInventorySlots)this.destination).getSlot(slot) == null) || (!((IInventorySlots)this.destination).getSlot(slot).isRecipe())) { - if ((this.destination.getStackInSlot(slot) == null) && (item != null)) - { - this.insertedSlots.add(new TransferSlot(slot, this.destination)); - if (doAdd) { - this.destination.setInventorySlotContents(slot, item.copy()); - } - return null; - } - } - } - } - } - setReturnItem(item); - return getReturnItem(); - } - - private static boolean areItemsEqual(ItemStack merged, ItemStack itemstack) - { - return (ItemStack.areItemStackTagsEqual(itemstack, merged)) && (itemstack.isItemEqual(merged)); - } - - public static ItemStack[] mergeStacks(ItemStack itemstack, ItemStack merged) - { - if (areItemsEqual(itemstack, merged)) - { - int space = merged.getMaxStackSize() - merged.stackSize; - if (space > 0) { - if (itemstack.stackSize > space) - { - itemstack.stackSize -= space; - merged.stackSize += space; - } - else if (itemstack.stackSize <= space) - { - merged.stackSize += itemstack.stackSize; - itemstack = null; - } - } - } - return new ItemStack[] { itemstack, merged }; - } - - private ItemStack transferToTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - item = transferToTankUsingContainerData(item, origin, destination, tankID, doAdd); - item = transferToTankUsingFluidContainer(item, origin, destination, tankID, doAdd); - return item; - } - - private ItemStack transferToTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if ((item == null) || (!(item.getItem() instanceof IFluidContainerItem))) { - return item; - } - IFluidContainerItem fluidContainer = (IFluidContainerItem)item.getItem(); - FluidStack fluid = fluidContainer.getFluid(item); - if (fluid == null) { - return item; - } - IFluidTank tank = destination.getTanks()[tankID]; - - IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination); - if ((validated != null) && ((!validated.isLiquidValidForTank(fluid, tankID)) || (validated.isTankReadOnly(tankID)))) { - return item; - } - int maxFill = tank.fill(fluid, false); - - FluidStack toTake = fluidContainer.drain(item, maxFill, true); - if (doAdd) { - tank.fill(toTake, true); - } - return item; - } - - private ItemStack transferToTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if (item == null) { - return item; - } - FluidStack containerLiquid = null; - FluidContainerRegistry.FluidContainerData containerLiquidData = null; - for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.filledContainer.isItemEqual(item)) - { - containerLiquidData = data; - containerLiquid = data.fluid.copy(); - break; - } - } - if (containerLiquid == null) { - return item; - } - IFluidTank tank = destination.getTanks()[tankID]; - - IValidatedTankContainer validated = (IValidatedTankContainer)Machine.getInterface(IValidatedTankContainer.class, destination); - if ((validated != null) && ( - (!validated.isLiquidValidForTank(containerLiquid, tankID)) || (validated.isTankReadOnly(tankID)))) { - return item; - } - FluidStack largeAmountOfLiquid = containerLiquid.copy(); - largeAmountOfLiquid.amount = tank.getCapacity(); - int amountAdded = tank.fill(largeAmountOfLiquid, false); - - int numberOfContainersToAdd = amountAdded / containerLiquid.amount; - if (numberOfContainersToAdd > item.stackSize) { - numberOfContainersToAdd = item.stackSize; - } - ItemStack leftOverContainers = item.copy(); - leftOverContainers.stackSize -= numberOfContainersToAdd; - if (leftOverContainers.stackSize <= 0) { - leftOverContainers = null; - } - ItemStack emptyContainers = containerLiquidData.emptyContainer.copy(); - emptyContainers.stackSize = 0; - emptyContainers.stackSize += numberOfContainersToAdd; - if (emptyContainers.stackSize <= 0) { - emptyContainers = null; - } - TransferRequest containersDump = new TransferRequest(emptyContainers, origin); - - ItemStack containersThatCantBeDumped = containersDump.transfer(false); - if (containersThatCantBeDumped != null) { - return item; - } - if (doAdd) - { - FluidStack liquidToFillTank = containerLiquid.copy(); - liquidToFillTank.amount *= numberOfContainersToAdd; - tank.fill(liquidToFillTank, true); - containersDump.transfer(true); - } - return leftOverContainers; - } - - private ItemStack transferFromTank(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - item = transferFromTankUsingContainerData(item, origin, destination, tankID, doAdd); - item = transferFromTankUsingFluidContainer(item, origin, destination, tankID, doAdd); - return item; - } - - private ItemStack transferFromTankUsingFluidContainer(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if ((item == null) || (!(item.getItem() instanceof IFluidContainerItem))) { - return item; - } - IFluidContainerItem fluidContainer = (IFluidContainerItem)item.getItem(); - - IFluidTank tank = destination.getTanks()[tankID]; - - FluidStack fluid = tank.getFluid(); - if (fluid == null) { - return item; - } - int amount = fluidContainer.fill(item, fluid, false); - - amount = Math.min(amount, tank.drain(amount, false) == null ? 0 : tank.drain(amount, false).amount); - if (amount <= 0) { - return item; - } - fluidContainer.fill(item, tank.drain(amount, doAdd), doAdd); - - return item; - } - - private ItemStack transferFromTankUsingContainerData(ItemStack item, IInventory origin, ITankMachine destination, int tankID, boolean doAdd) - { - if (item == null) { - return item; - } - IFluidTank tank = destination.getTanks()[tankID]; - FluidStack liquidInTank = tank.getFluid(); - if (liquidInTank == null) { - return item; - } - FluidContainerRegistry.FluidContainerData containerLiquidData = null; - for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if ((data.emptyContainer.isItemEqual(item)) && (liquidInTank.isFluidEqual(data.fluid))) - { - containerLiquidData = data; - break; - } - } - FluidStack fluid = null; - ItemStack filled = null; - if (containerLiquidData != null) - { - fluid = containerLiquidData.fluid; - filled = containerLiquidData.filledContainer; - } - if ((fluid == null) || (filled == null)) { - return item; - } - int maximumExtractedLiquid = item.stackSize * fluid.amount; - - FluidStack drainedLiquid = tank.drain(maximumExtractedLiquid, false); - int amountInTank = drainedLiquid == null ? 0 : drainedLiquid.amount; - - int numberOfContainersToFill = amountInTank / fluid.amount; - if (numberOfContainersToFill > item.stackSize) { - numberOfContainersToFill = item.stackSize; - } - ItemStack leftOverContainers = item.copy(); - leftOverContainers.stackSize -= numberOfContainersToFill; - if (leftOverContainers.stackSize <= 0) { - leftOverContainers = null; - } - ItemStack filledContainers = filled.copy(); - filledContainers.stackSize = 0; - filledContainers.stackSize += numberOfContainersToFill; - if (filledContainers.stackSize <= 0) { - filledContainers = null; - } - TransferRequest containersDump = new TransferRequest(filledContainers, origin); - - ItemStack containersThatCantBeDumped = containersDump.transfer(false); - if (containersThatCantBeDumped != null) { - return item; - } - if (doAdd) - { - tank.drain(maximumExtractedLiquid, true); - containersDump.transfer(true); - } - return leftOverContainers; - } - - private List<TransferSlot> insertedSlots = new ArrayList(); - private List<Integer> insertedTanks = new ArrayList(); - - public List<TransferSlot> getInsertedSlots() - { - return this.insertedSlots; - } - - public List<Integer> getInsertedTanks() - { - return this.insertedTanks; - } - - public static class TransferSlot - { - public int id; - public IInventory inventory; - - public TransferSlot(int id, IInventory inventory) - { - this.id = id; - this.inventory = inventory; - } - } - - public IInventory getOrigin() - { - return this.origin; - } - - public IInventory getDestination() - { - return this.destination; - } - - public ItemStack getItemToTransfer() - { - return this.itemToTransfer; - } - - public int[] getTargetSlots() - { - return this.targetSlots; - } - - public int[] getTargetTanks() - { - return this.targetTanks; - } -} diff --git a/src/Java/binnie/core/mod/config/BinnieConfiguration.java b/src/Java/binnie/core/mod/config/BinnieConfiguration.java deleted file mode 100644 index 09e5a657da..0000000000 --- a/src/Java/binnie/core/mod/config/BinnieConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package binnie.core.mod.config; - -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.proxy.BinnieProxy; -import java.io.File; -import net.minecraftforge.common.config.Configuration; - -class BinnieConfiguration - extends Configuration -{ - public AbstractMod mod; - private String filename; - - public BinnieConfiguration(String filename, AbstractMod mod) - { - super(new File(BinnieCore.proxy.getDirectory(), filename)); - this.mod = mod; - this.filename = filename; - } -} diff --git a/src/Java/binnie/core/mod/config/BinnieItemData.java b/src/Java/binnie/core/mod/config/BinnieItemData.java deleted file mode 100644 index 435edc122d..0000000000 --- a/src/Java/binnie/core/mod/config/BinnieItemData.java +++ /dev/null @@ -1,15 +0,0 @@ -package binnie.core.mod.config; - -class BinnieItemData -{ - private int item; - private BinnieConfiguration configFile; - private String configKey; - - public BinnieItemData(int item, BinnieConfiguration configFile, String configKey) - { - this.item = item; - this.configFile = configFile; - this.configKey = configKey; - } -} diff --git a/src/Java/binnie/core/mod/config/ConfigFile.java b/src/Java/binnie/core/mod/config/ConfigFile.java deleted file mode 100644 index 425ee52e98..0000000000 --- a/src/Java/binnie/core/mod/config/ConfigFile.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface ConfigFile -{ - String filename(); -} diff --git a/src/Java/binnie/core/mod/config/ConfigProperty.java b/src/Java/binnie/core/mod/config/ConfigProperty.java deleted file mode 100644 index d8e5f48339..0000000000 --- a/src/Java/binnie/core/mod/config/ConfigProperty.java +++ /dev/null @@ -1,26 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({java.lang.annotation.ElementType.FIELD}) -public @interface ConfigProperty -{ - String key(); - - String category() default ""; - - String[] comment() default {}; - - @Retention(RetentionPolicy.RUNTIME) - @Target({java.lang.annotation.ElementType.ANNOTATION_TYPE}) - public static @interface Type - { - Class<? extends PropertyBase> propertyClass(); - - String category() default "general"; - } -} diff --git a/src/Java/binnie/core/mod/config/ConfigurationMain.java b/src/Java/binnie/core/mod/config/ConfigurationMain.java deleted file mode 100644 index e7924abe47..0000000000 --- a/src/Java/binnie/core/mod/config/ConfigurationMain.java +++ /dev/null @@ -1,4 +0,0 @@ -package binnie.core.mod.config; - -@ConfigFile(filename="/config/forestry/binniecore/main.conf") -public class ConfigurationMain {} diff --git a/src/Java/binnie/core/mod/config/ConfigurationMods.java b/src/Java/binnie/core/mod/config/ConfigurationMods.java deleted file mode 100644 index 77c2f66930..0000000000 --- a/src/Java/binnie/core/mod/config/ConfigurationMods.java +++ /dev/null @@ -1,18 +0,0 @@ -package binnie.core.mod.config; - -@ConfigFile(filename="/config/forestry/binnie-mods.conf") -public class ConfigurationMods -{ - @ConfigProperty(key="extraBees", comment={"Enables the Extra Bees Mod."}) - @PropBoolean - public static boolean extraBees = true; - @ConfigProperty(key="extraTrees", comment={"Enables the Extra Trees Mod."}) - @PropBoolean - public static boolean extraTrees = true; - @ConfigProperty(key="botany", comment={"Enables the Botany Mod."}) - @PropBoolean - public static boolean botany = true; - @ConfigProperty(key="genetics", comment={"Enables the Genetics Mod."}) - @PropBoolean - public static boolean genetics = true; -} diff --git a/src/Java/binnie/core/mod/config/ManagerConfig.java b/src/Java/binnie/core/mod/config/ManagerConfig.java deleted file mode 100644 index 16e6df78f4..0000000000 --- a/src/Java/binnie/core/mod/config/ManagerConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -package binnie.core.mod.config; - -import binnie.core.AbstractMod; -import binnie.core.ManagerBase; -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import net.minecraftforge.common.config.Configuration; - -public class ManagerConfig - extends ManagerBase -{ - private Map<Class<?>, Configuration> configurations = new LinkedHashMap(); - - public void registerConfiguration(Class<?> cls, AbstractMod mod) - { - if (cls.isAnnotationPresent(ConfigFile.class)) { - loadConfiguration(cls, mod); - } - } - - public void loadConfiguration(Class<?> cls, AbstractMod mod) - { - try - { - String filename = ((ConfigFile)cls.getAnnotation(ConfigFile.class)).filename(); - - - BinnieConfiguration config = new BinnieConfiguration(filename, mod); - - config.load(); - for (Field field : cls.getFields()) { - if (field.isAnnotationPresent(ConfigProperty.class)) - { - ConfigProperty propertyAnnot = (ConfigProperty)field.getAnnotation(ConfigProperty.class); - PropertyBase property; - for (Annotation annotation : field.getAnnotations()) { - if (annotation.annotationType().isAnnotationPresent(ConfigProperty.Type.class)) - { - Class<?> propertyClass = ((ConfigProperty.Type)annotation.annotationType().getAnnotation(ConfigProperty.Type.class)).propertyClass(); - - property = (PropertyBase)propertyClass.getConstructor(new Class[] { Field.class, BinnieConfiguration.class, ConfigProperty.class, annotation.annotationType() }).newInstance(new Object[] { field, config, propertyAnnot, annotation.annotationType().cast(annotation) }); - } - } - } - } - config.save(); - - this.configurations.put(cls, config); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - private Map<AbstractMod, List<BinnieItemData>> itemIDs = new HashMap(); - - public void addItemID(Integer configValue, String configKey, BinnieConfiguration configFile) - { - if (!this.itemIDs.containsKey(configFile.mod)) { - this.itemIDs.put(configFile.mod, new ArrayList()); - } - ((List)this.itemIDs.get(configFile.mod)).add(new BinnieItemData(configValue.intValue() + 256, configFile, configKey)); - } -} diff --git a/src/Java/binnie/core/mod/config/PropBoolean.java b/src/Java/binnie/core/mod/config/PropBoolean.java deleted file mode 100644 index fc9094bdd8..0000000000 --- a/src/Java/binnie/core/mod/config/PropBoolean.java +++ /dev/null @@ -1,38 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.Field; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -@Retention(RetentionPolicy.RUNTIME) -@ConfigProperty.Type(propertyClass=PropertyBoolean.class) -public @interface PropBoolean -{ - public static class PropertyBoolean - extends PropertyBase<Boolean, PropBoolean> - { - public PropertyBoolean(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropBoolean annotedProperty) - throws IllegalArgumentException, IllegalAccessException - { - super(file, configProperty, annotedProperty); - } - - protected Property getProperty() - { - return this.file.get(getCategory(), getKey(), ((Boolean)this.defaultValue).booleanValue()); - } - - protected Boolean getConfigValue() - { - return Boolean.valueOf(this.property.getBoolean(((Boolean)this.defaultValue).booleanValue())); - } - - protected void addComments() - { - addComment("Default value is " + this.defaultValue + "."); - } - } -} diff --git a/src/Java/binnie/core/mod/config/PropDouble.java b/src/Java/binnie/core/mod/config/PropDouble.java deleted file mode 100644 index 331cd2774c..0000000000 --- a/src/Java/binnie/core/mod/config/PropDouble.java +++ /dev/null @@ -1,38 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.Field; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -@Retention(RetentionPolicy.RUNTIME) -@ConfigProperty.Type(propertyClass=PropertyDouble.class) -public @interface PropDouble -{ - public static class PropertyDouble - extends PropertyBase<Double, PropDouble> - { - public PropertyDouble(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropDouble annotedProperty) - throws IllegalArgumentException, IllegalAccessException - { - super(file, configProperty, annotedProperty); - } - - protected Property getProperty() - { - return this.file.get(getCategory(), getKey(), ((Double)this.defaultValue).doubleValue()); - } - - protected Double getConfigValue() - { - return Double.valueOf(this.property.getDouble(((Double)this.defaultValue).doubleValue())); - } - - protected void addComments() - { - addComment("Default value is " + this.defaultValue + "."); - } - } -} diff --git a/src/Java/binnie/core/mod/config/PropInteger.java b/src/Java/binnie/core/mod/config/PropInteger.java deleted file mode 100644 index f74c625a8c..0000000000 --- a/src/Java/binnie/core/mod/config/PropInteger.java +++ /dev/null @@ -1,38 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.Field; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -@Retention(RetentionPolicy.RUNTIME) -@ConfigProperty.Type(propertyClass=PropertyInteger.class) -public @interface PropInteger -{ - public static class PropertyInteger - extends PropertyBase<Integer, PropInteger> - { - public PropertyInteger(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropInteger annotedProperty) - throws IllegalArgumentException, IllegalAccessException - { - super(file, configProperty, annotedProperty); - } - - protected Property getProperty() - { - return this.file.get(getCategory(), getKey(), ((Integer)this.defaultValue).intValue()); - } - - protected Integer getConfigValue() - { - return Integer.valueOf(this.property.getInt(((Integer)this.defaultValue).intValue())); - } - - protected void addComments() - { - addComment("Default value is " + this.defaultValue + "."); - } - } -} diff --git a/src/Java/binnie/core/mod/config/PropPercentage.java b/src/Java/binnie/core/mod/config/PropPercentage.java deleted file mode 100644 index b51d8e3abf..0000000000 --- a/src/Java/binnie/core/mod/config/PropPercentage.java +++ /dev/null @@ -1,43 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.Field; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -@Retention(RetentionPolicy.RUNTIME) -@ConfigProperty.Type(propertyClass=PropertyPercentage.class) -public @interface PropPercentage -{ - int upper() default 100; - - int lower() default 0; - - public static class PropertyPercentage - extends PropertyBase<Integer, PropPercentage> - { - public PropertyPercentage(Field field, BinnieConfiguration file, ConfigProperty configProperty, PropPercentage annotedProperty) - throws IllegalArgumentException, IllegalAccessException - { - super(file, configProperty, annotedProperty); - } - - protected Integer getConfigValue() - { - return Integer.valueOf(this.property.getInt(((Integer)this.defaultValue).intValue())); - } - - protected void addComments() - { - addComment("Default value is " + this.defaultValue + "%."); - addComment("Range is " + ((PropPercentage)this.annotatedProperty).lower() + "-" + ((PropPercentage)this.annotatedProperty).upper() + "%."); - } - - protected Property getProperty() - { - return this.file.get(getCategory(), getKey(), ((Integer)this.defaultValue).intValue()); - } - } -} diff --git a/src/Java/binnie/core/mod/config/PropertyBase.java b/src/Java/binnie/core/mod/config/PropertyBase.java deleted file mode 100644 index 8ad13f833e..0000000000 --- a/src/Java/binnie/core/mod/config/PropertyBase.java +++ /dev/null @@ -1,72 +0,0 @@ -package binnie.core.mod.config; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -abstract class PropertyBase<ValueType, AnnotationType extends Annotation> -{ - Configuration file; - Property property; - ValueType defaultValue; - private ConfigProperty configProperty; - AnnotationType annotatedProperty; - private List<String> comments = new ArrayList(); - private Field field; - - protected PropertyBase(Field field, BinnieConfiguration file, ConfigProperty configProperty, AnnotationType annotedProperty) - throws IllegalArgumentException, IllegalAccessException - { - this.field = field; - this.file = file; - this.configProperty = configProperty; - this.annotatedProperty = annotedProperty; - this.defaultValue = getDefaultValue(field); - this.property = getProperty(); - for (String comment : configProperty.comment()) { - addComment(comment); - } - addComments(); - this.property.comment = getComment(); - field.set(null, getConfigValue()); - } - - protected abstract Property getProperty(); - - protected abstract ValueType getConfigValue(); - - protected abstract void addComments(); - - protected String getCategory() - { - return this.configProperty.category().equals("") ? ((ConfigProperty.Type)this.annotatedProperty.annotationType().getAnnotation(ConfigProperty.Type.class)).category() : this.configProperty.category(); - } - - protected String getKey() - { - return this.configProperty.key(); - } - - protected ValueType getDefaultValue(Field field) - throws IllegalArgumentException, IllegalAccessException - { - return field.get(null); - } - - protected void addComment(String comment) - { - this.comments.add(comment); - } - - protected String getComment() - { - String comment = ""; - for (String com : this.comments) { - comment = comment + com + " "; - } - return comment; - } -} diff --git a/src/Java/binnie/core/mod/parser/FieldParser.java b/src/Java/binnie/core/mod/parser/FieldParser.java deleted file mode 100644 index c063d5aca9..0000000000 --- a/src/Java/binnie/core/mod/parser/FieldParser.java +++ /dev/null @@ -1,55 +0,0 @@ -package binnie.core.mod.parser; - -import binnie.core.AbstractMod; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; - -public abstract class FieldParser -{ - public static Collection<FieldParser> parsers = new ArrayList(); - - public abstract boolean isHandled(Field paramField, AbstractMod paramAbstractMod); - - public void preInit(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - {} - - public void init(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - {} - - public void postInit(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - {} - - public static void preInitParse(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - { - for (FieldParser parser : parsers) { - if (parser.isHandled(field, mod)) { - parser.preInit(field, mod); - } - } - } - - public static void initParse(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - { - for (FieldParser parser : parsers) { - if (parser.isHandled(field, mod)) { - parser.init(field, mod); - } - } - } - - public static void postInitParse(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - { - for (FieldParser parser : parsers) { - if (parser.isHandled(field, mod)) { - parser.postInit(field, mod); - } - } - } -} diff --git a/src/Java/binnie/core/mod/parser/ItemParser.java b/src/Java/binnie/core/mod/parser/ItemParser.java deleted file mode 100644 index 8892a20aba..0000000000 --- a/src/Java/binnie/core/mod/parser/ItemParser.java +++ /dev/null @@ -1,24 +0,0 @@ -package binnie.core.mod.parser; - -import binnie.core.AbstractMod; -import cpw.mods.fml.common.registry.GameRegistry; -import java.lang.reflect.Field; -import net.minecraft.item.Item; - -public class ItemParser - extends FieldParser -{ - public boolean isHandled(Field field, AbstractMod mod) - { - return Item.class.isAssignableFrom(field.getType()); - } - - public void preInit(Field field, AbstractMod mod) - throws IllegalArgumentException, IllegalAccessException - { - Item item = (Item)field.get(null); - if (item != null) { - GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5)); - } - } -} diff --git a/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java b/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java deleted file mode 100644 index c2c549e1bd..0000000000 --- a/src/Java/binnie/core/multiblock/BlockMultiblockMachine.java +++ /dev/null @@ -1,27 +0,0 @@ -package binnie.core.multiblock; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class BlockMultiblockMachine - extends BlockContainer -{ - public BlockMultiblockMachine(String blockName) - { - super(Material.iron); - setHardness(1.5F); - setBlockName(blockName); - } - - public TileEntity createTileEntity(World world, int metadata) - { - return new TileEntityMultiblockMachine(); - } - - public TileEntity createNewTileEntity(World var1, int i) - { - return new TileEntityMultiblockMachine(); - } -} diff --git a/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java b/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java deleted file mode 100644 index 0aaefc91c4..0000000000 --- a/src/Java/binnie/core/multiblock/TileEntityMultiblockMachine.java +++ /dev/null @@ -1,37 +0,0 @@ -package binnie.core.multiblock; - -import binnie.core.machines.Machine; -import binnie.core.machines.TileEntityMachine; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -class TileEntityMultiblockMachine - extends TileEntity -{ - private boolean inStructure; - private int tileX; - private int tileY; - private int tileZ; - - boolean inStructure() - { - return this.inStructure; - } - - public Machine getMachine() - { - return getMasterMachine(); - } - - private Machine getMasterMachine() - { - if (!this.inStructure) { - return null; - } - TileEntity tile = this.worldObj.getTileEntity(this.xCoord + this.tileX, this.yCoord + this.tileY, this.zCoord + this.tileZ); - if ((tile instanceof TileEntityMachine)) { - return ((TileEntityMachine)tile).getMachine(); - } - return null; - } -} diff --git a/src/Java/binnie/core/network/BinnieCorePacketID.java b/src/Java/binnie/core/network/BinnieCorePacketID.java deleted file mode 100644 index 669065ca45..0000000000 --- a/src/Java/binnie/core/network/BinnieCorePacketID.java +++ /dev/null @@ -1,77 +0,0 @@ -package binnie.core.network; - -import binnie.core.BinnieCore; -import binnie.core.block.TileEntityMetadata; -import binnie.core.machines.IMachine; -import binnie.core.machines.Machine; -import binnie.core.machines.network.INetwork.TilePacketSync; -import binnie.core.network.packet.MessageBinnie; -import binnie.core.network.packet.MessageCraftGUI; -import binnie.core.network.packet.MessageMetadata; -import binnie.core.network.packet.MessageTileNBT; -import binnie.core.network.packet.MessageUpdate; -import binnie.core.proxy.BinnieProxy; -import binnie.craftgui.minecraft.ContainerCraftGUI; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.tileentity.TileEntity; - -public enum BinnieCorePacketID - implements IPacketID -{ - NetworkEntityUpdate, TileMetadata, CraftGUIAction, TileDescriptionSync; - - private BinnieCorePacketID() {} - - public void onMessage(MessageBinnie message, MessageContext context) - { - if (this == NetworkEntityUpdate) - { - MessageUpdate packet = new MessageUpdate(message); - TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld()); - if ((tile instanceof INetworkedEntity)) { - ((INetworkedEntity)tile).readFromPacket(packet.payload); - } - } - else if (this == TileMetadata) - { - MessageMetadata packet = new MessageMetadata(message); - TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld()); - if ((tile instanceof TileEntityMetadata)) { - ((TileEntityMetadata)tile).setTileMetadata(packet.meta, true); - } - } - else if ((this == CraftGUIAction) && (context.side == Side.CLIENT)) - { - MessageCraftGUI packet = new MessageCraftGUI(message); - - EntityPlayer player = BinnieCore.proxy.getPlayer(); - if (((player.openContainer instanceof ContainerCraftGUI)) && (packet.getTagCompound() != null)) { - ((ContainerCraftGUI)player.openContainer).recieveNBT(Side.CLIENT, player, packet.getTagCompound()); - } - } - else if ((this == CraftGUIAction) && (context.side == Side.SERVER) && ((context.netHandler instanceof NetHandlerPlayServer))) - { - MessageCraftGUI packet = new MessageCraftGUI(message); - - EntityPlayer player = ((NetHandlerPlayServer)context.netHandler).playerEntity; - if (((player.openContainer instanceof ContainerCraftGUI)) && (packet.getTagCompound() != null)) { - ((ContainerCraftGUI)player.openContainer).recieveNBT(Side.SERVER, player, packet.getTagCompound()); - } - } - else if ((this == TileDescriptionSync) && (context.side == Side.CLIENT)) - { - MessageTileNBT packet = new MessageTileNBT(message); - TileEntity tile = packet.getTarget(BinnieCore.proxy.getWorld()); - if ((tile != null) && (packet.getTagCompound() != null)) - { - IMachine machine = Machine.getMachine(tile); - if ((machine != null) && ((machine instanceof INetwork.TilePacketSync))) { - ((INetwork.TilePacketSync)machine).syncFromNBT(packet.getTagCompound()); - } - } - } - } -} diff --git a/src/Java/binnie/core/network/BinniePacketHandler.java b/src/Java/binnie/core/network/BinniePacketHandler.java deleted file mode 100644 index c7ad54c120..0000000000 --- a/src/Java/binnie/core/network/BinniePacketHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package binnie.core.network; - -import binnie.core.AbstractMod; -import binnie.core.network.packet.MessageBinnie; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public abstract class BinniePacketHandler - implements IMessageHandler<MessageBinnie, IMessage> -{ - private IPacketProvider provider; - - public BinniePacketHandler(AbstractMod mod) - { - setProvider(mod); - } - - public void setProvider(IPacketProvider provider) - { - this.provider = provider; - } - - public IMessage onMessage(MessageBinnie message, MessageContext ctx) - { - try - { - int packetId = message.id; - for (IPacketID id : this.provider.getPacketIDs()) { - if (id.ordinal() == packetId) - { - id.onMessage(message, ctx); - return null; - } - } - } - catch (Exception ex) - { - throw new RuntimeException(ex); - } - return null; - } -} diff --git a/src/Java/binnie/core/network/INetworkedEntity.java b/src/Java/binnie/core/network/INetworkedEntity.java deleted file mode 100644 index e126a4559b..0000000000 --- a/src/Java/binnie/core/network/INetworkedEntity.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core.network; - -import binnie.core.network.packet.PacketPayload; - -public abstract interface INetworkedEntity -{ - public abstract void writeToPacket(PacketPayload paramPacketPayload); - - public abstract void readFromPacket(PacketPayload paramPacketPayload); -} diff --git a/src/Java/binnie/core/network/IOrdinaled.java b/src/Java/binnie/core/network/IOrdinaled.java deleted file mode 100644 index 2022f04820..0000000000 --- a/src/Java/binnie/core/network/IOrdinaled.java +++ /dev/null @@ -1,6 +0,0 @@ -package binnie.core.network; - -public abstract interface IOrdinaled -{ - public abstract int ordinal(); -} diff --git a/src/Java/binnie/core/network/IPacketID.java b/src/Java/binnie/core/network/IPacketID.java deleted file mode 100644 index 193fbba617..0000000000 --- a/src/Java/binnie/core/network/IPacketID.java +++ /dev/null @@ -1,10 +0,0 @@ -package binnie.core.network; - -import binnie.core.network.packet.MessageBinnie; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public abstract interface IPacketID - extends IOrdinaled -{ - public abstract void onMessage(MessageBinnie paramMessageBinnie, MessageContext paramMessageContext); -} diff --git a/src/Java/binnie/core/network/IPacketProvider.java b/src/Java/binnie/core/network/IPacketProvider.java deleted file mode 100644 index 98f48f69b3..0000000000 --- a/src/Java/binnie/core/network/IPacketProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.network; - -public abstract interface IPacketProvider -{ - public abstract String getChannel(); - - public abstract IPacketID[] getPacketIDs(); -} diff --git a/src/Java/binnie/core/network/packet/IPacket.java b/src/Java/binnie/core/network/packet/IPacket.java deleted file mode 100644 index b86516ea41..0000000000 --- a/src/Java/binnie/core/network/packet/IPacket.java +++ /dev/null @@ -1,8 +0,0 @@ -package binnie.core.network.packet; - -import net.minecraft.network.Packet; - -public abstract interface IPacket -{ - public abstract Packet getPacket(); -} diff --git a/src/Java/binnie/core/network/packet/IPacketLocation.java b/src/Java/binnie/core/network/packet/IPacketLocation.java deleted file mode 100644 index d9d46cce70..0000000000 --- a/src/Java/binnie/core/network/packet/IPacketLocation.java +++ /dev/null @@ -1,15 +0,0 @@ -package binnie.core.network.packet; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -abstract interface IPacketLocation -{ - public abstract TileEntity getTarget(World paramWorld); - - public abstract int getX(); - - public abstract int getY(); - - public abstract int getZ(); -} diff --git a/src/Java/binnie/core/network/packet/IndexInPayload.java b/src/Java/binnie/core/network/packet/IndexInPayload.java deleted file mode 100644 index ff59a0783f..0000000000 --- a/src/Java/binnie/core/network/packet/IndexInPayload.java +++ /dev/null @@ -1,15 +0,0 @@ -package binnie.core.network.packet; - -public class IndexInPayload -{ - public IndexInPayload(int intIndex, int floatIndex, int stringIndex) - { - this.intIndex = intIndex; - this.floatIndex = floatIndex; - this.stringIndex = stringIndex; - } - - public int intIndex = 0; - public int floatIndex = 0; - public int stringIndex = 0; -} diff --git a/src/Java/binnie/core/network/packet/MachinePayload.java b/src/Java/binnie/core/network/packet/MachinePayload.java deleted file mode 100644 index 11eb8b62b9..0000000000 --- a/src/Java/binnie/core/network/packet/MachinePayload.java +++ /dev/null @@ -1,77 +0,0 @@ -package binnie.core.network.packet; - -import java.util.ArrayList; -import java.util.List; - -public class MachinePayload -{ - private List<Integer> intPayload = new ArrayList(); - private List<Float> floatPayload = new ArrayList(); - private List<String> stringPayload = new ArrayList(); - private int id = 0; - - public MachinePayload(int id) - { - this.id = id; - this.intPayload.clear(); - this.floatPayload.clear(); - this.stringPayload.clear(); - } - - public MachinePayload() {} - - public void addInteger(int a) - { - this.intPayload.add(Integer.valueOf(a)); - } - - public void addFloat(float a) - { - this.floatPayload.add(Float.valueOf(a)); - } - - public void addString(String a) - { - this.stringPayload.add(a); - } - - public int getInteger() - { - return ((Integer)this.intPayload.remove(0)).intValue(); - } - - public float getFloat() - { - return ((Float)this.floatPayload.remove(0)).floatValue(); - } - - public String getString() - { - return (String)this.stringPayload.remove(0); - } - - public void append(MachinePayload other) - { - if (other == null) { - return; - } - this.intPayload.addAll(other.intPayload); - this.floatPayload.addAll(other.floatPayload); - this.stringPayload.addAll(other.stringPayload); - } - - public boolean isEmpty() - { - return (this.intPayload.isEmpty()) && (this.floatPayload.isEmpty()) && (this.stringPayload.isEmpty()); - } - - public int getID() - { - return this.id; - } - - public void setID(int readInt) - { - this.id = readInt; - } -} diff --git a/src/Java/binnie/core/network/packet/MessageBase.java b/src/Java/binnie/core/network/packet/MessageBase.java deleted file mode 100644 index e18da968ef..0000000000 --- a/src/Java/binnie/core/network/packet/MessageBase.java +++ /dev/null @@ -1,69 +0,0 @@ -package binnie.core.network.packet; - -import io.netty.buffer.ByteBuf; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; - -public class MessageBase -{ - private int id; - - public MessageBase(int id) - { - this.id = id; - } - - public MessageBase(MessageBinnie message) - { - try - { - readData(message.data); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - public MessageBinnie GetMessage() - { - return new MessageBinnie(this.id, this); - } - - protected NBTTagCompound readNBTTagCompound(ByteBuf data) - throws IOException - { - short length = data.readShort(); - if (length < 0) { - return null; - } - byte[] compressed = new byte[length]; - data.readBytes(compressed); - return CompressedStreamTools.readCompressed(new ByteArrayInputStream(compressed)); - } - - protected void writeNBTTagCompound(NBTTagCompound nbttagcompound, ByteBuf data) - throws IOException - { - if (nbttagcompound == null) - { - data.writeShort(-1); - } - else - { - byte[] compressed = CompressedStreamTools.compress(nbttagcompound); - data.writeShort((short)compressed.length); - data.writeBytes(compressed); - } - } - - public void writeData(ByteBuf data) - throws IOException - {} - - public void readData(ByteBuf data) - throws IOException - {} -} diff --git a/src/Java/binnie/core/network/packet/MessageBinnie.java b/src/Java/binnie/core/network/packet/MessageBinnie.java deleted file mode 100644 index 0559a07e30..0000000000 --- a/src/Java/binnie/core/network/packet/MessageBinnie.java +++ /dev/null @@ -1,40 +0,0 @@ -package binnie.core.network.packet; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import io.netty.buffer.ByteBuf; -import java.io.IOException; - -public final class MessageBinnie - implements IMessage -{ - public int id; - private MessageBase message; - ByteBuf data; - - public MessageBinnie() {} - - public MessageBinnie(int id, MessageBase base) - { - this.id = id; - this.message = base; - } - - public void toBytes(ByteBuf buf) - { - buf.writeByte(this.id); - try - { - this.message.writeData(buf); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - public void fromBytes(ByteBuf buf) - { - this.id = buf.readByte(); - this.data = buf; - } -} diff --git a/src/Java/binnie/core/network/packet/MessageContainerUpdate.java b/src/Java/binnie/core/network/packet/MessageContainerUpdate.java deleted file mode 100644 index 98e64b0d1f..0000000000 --- a/src/Java/binnie/core/network/packet/MessageContainerUpdate.java +++ /dev/null @@ -1,17 +0,0 @@ -package binnie.core.network.packet; - -import net.minecraft.nbt.NBTTagCompound; - -public class MessageContainerUpdate - extends MessageCraftGUI -{ - public MessageContainerUpdate(NBTTagCompound nbt) - { - super(nbt); - } - - public MessageContainerUpdate(MessageBinnie message) - { - super(message); - } -} diff --git a/src/Java/binnie/core/network/packet/MessageCoordinates.java b/src/Java/binnie/core/network/packet/MessageCoordinates.java deleted file mode 100644 index 928ed59d05..0000000000 --- a/src/Java/binnie/core/network/packet/MessageCoordinates.java +++ /dev/null @@ -1,59 +0,0 @@ -package binnie.core.network.packet; - -import io.netty.buffer.ByteBuf; -import java.io.IOException; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -public class MessageCoordinates - extends MessageBase -{ - public int posX; - public int posY; - public int posZ; - - public MessageCoordinates(MessageBinnie message) - { - super(message); - } - - public MessageCoordinates(int id, ChunkCoordinates coordinates) - { - this(id, coordinates.posX, coordinates.posY, coordinates.posZ); - } - - public MessageCoordinates(int id, int posX, int posY, int posZ) - { - super(id); - this.posX = posX; - this.posY = posY; - this.posZ = posZ; - } - - public void writeData(ByteBuf data) - throws IOException - { - data.writeInt(this.posX); - data.writeInt(this.posY); - data.writeInt(this.posZ); - } - - public void readData(ByteBuf data) - throws IOException - { - this.posX = data.readInt(); - this.posY = data.readInt(); - this.posZ = data.readInt(); - } - - public ChunkCoordinates getCoordinates() - { - return new ChunkCoordinates(this.posX, this.posY, this.posZ); - } - - public TileEntity getTileEntity(World world) - { - return world.getTileEntity(this.posX, this.posY, this.posZ); - } -} diff --git a/src/Java/binnie/core/network/packet/MessageCraftGUI.java b/src/Java/binnie/core/network/packet/MessageCraftGUI.java deleted file mode 100644 index 805c4a651b..0000000000 --- a/src/Java/binnie/core/network/packet/MessageCraftGUI.java +++ /dev/null @@ -1,18 +0,0 @@ -package binnie.core.network.packet; - -import binnie.core.network.BinnieCorePacketID; -import net.minecraft.nbt.NBTTagCompound; - -public class MessageCraftGUI - extends MessageNBT -{ - public MessageCraftGUI(MessageBinnie message) - { - super(message); - } - - public MessageCraftGUI(NBTTagCompound action) - { - super(BinnieCorePacketID.CraftGUIAction.ordinal(), action); - } -} diff --git a/src/Java/binnie/core/network/packet/MessageMetadata.java b/src/Java/binnie/core/network/packet/MessageMetadata.java deleted file mode 100644 index c8ce46dedb..0000000000 --- a/src/Java/binnie/core/network/packet/MessageMetadata.java +++ /dev/null @@ -1,36 +0,0 @@ -package binnie.core.network.packet; - -import binnie.core.network.BinnieCorePacketID; -import io.netty.buffer.ByteBuf; -import java.io.IOException; - -public class MessageMetadata - extends MessageCoordinates -{ - public int meta; - - public MessageMetadata(int posX, int posY, int posZ, int meta) - { - super(BinnieCorePacketID.TileMetadata.ordinal(), posX, posY, posZ); - this.meta = meta; - } - - public MessageMetadata(MessageBinnie message) - { - super(message); - } - - public void writeData(ByteBuf data) - throws IOException - { - super.writeData(data); - data.writeInt(this.meta); - } - - public void readData(ByteBuf data) - throws IOException - { - super.readData(data); - this.meta = data.readInt(); - } -} diff --git a/src/Java/binnie/core/network/packet/MessageNBT.java b/src/Java/binnie/core/network/packet/MessageNBT.java deleted file mode 100644 index c1c5345987..0000000000 --- a/src/Java/binnie/core/network/packet/MessageNBT.java +++ /dev/null @@ -1,49 +0,0 @@ -package binnie.core.network.packet; - -import io.netty.buffer.ByteBuf; -import java.io.IOException; -import net.minecraft.nbt.NBTTagCompound; - -public class MessageNBT - extends MessageBase -{ - NBTTagCompound nbt; - - public NBTTagCompound getTagCompound() - { - return this.nbt; - } - - void setTagCompound(NBTTagCompound nbt) - { - this.nbt = nbt; - } - - public MessageNBT(int id) - { - super(id); - } - - public MessageNBT(int id, NBTTagCompound nbt) - { - this(id); - setTagCompound(nbt); - } - - public MessageNBT(MessageBinnie message) - { - super(message); - } - - public void writeData(ByteBuf data) - throws IOException - { - writeNBTTagCompound(this.nbt, data); - } - - public void readData(ByteBuf data) - throws IOException - { - this.nbt = readNBTTagCompound(data); - } -} diff --git a/src/Java/binnie/core/network/packet/MessageTileNBT.java b/src/Java/binnie/core/network/packet/MessageTileNBT.java deleted file mode 100644 index 7ba41b8d09..0000000000 --- a/src/Java/binnie/core/network/packet/MessageTileNBT.java +++ /dev/null @@ -1,82 +0,0 @@ -package binnie.core.network.packet; - -import io.netty.buffer.ByteBuf; -import java.io.IOException; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class MessageTileNBT - extends MessageNBT - implements IPacketLocation -{ - private int posX; - private int posY; - private int posZ; - - public MessageTileNBT(MessageBinnie message) - { - super(message); - } - - public MessageTileNBT(int id, TileEntity tile, NBTTagCompound nbt) - { - super(id); - - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - this.nbt = nbt; - } - - public void writeData(ByteBuf data) - throws IOException - { - data.writeInt(this.posX); - data.writeInt(this.posY); - data.writeInt(this.posZ); - - super.writeData(data); - } - - public void readData(ByteBuf data) - throws IOException - { - this.posX = data.readInt(); - this.posY = data.readInt(); - this.posZ = data.readInt(); - - super.readData(data); - } - - public TileEntity getTarget(World world) - { - return world.getTileEntity(this.posX, this.posY, this.posZ); - } - - public int getX() - { - return this.posX; - } - - public int getY() - { - return this.posY; - } - - public int getZ() - { - return this.posZ; - } - - public NBTTagCompound getTagCompound() - { - return this.nbt; - } - - void setTagCompound(NBTTagCompound nbt) - { - this.nbt = nbt; - } -} diff --git a/src/Java/binnie/core/network/packet/MessageUpdate.java b/src/Java/binnie/core/network/packet/MessageUpdate.java deleted file mode 100644 index 053246b318..0000000000 --- a/src/Java/binnie/core/network/packet/MessageUpdate.java +++ /dev/null @@ -1,92 +0,0 @@ -package binnie.core.network.packet; - -import binnie.core.network.INetworkedEntity; -import io.netty.buffer.ByteBuf; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class MessageUpdate - extends MessageCoordinates -{ - public PacketPayload payload; - - public MessageUpdate(MessageBinnie message) - { - super(message); - } - - public MessageUpdate(int id, INetworkedEntity tile) - { - super(id, ((TileEntity)tile).xCoord, ((TileEntity)tile).yCoord, ((TileEntity)tile).zCoord); - this.payload = new PacketPayload(); - tile.writeToPacket(this.payload); - } - - public void writeData(ByteBuf data) - throws IOException - { - super.writeData(data); - if (this.payload == null) - { - data.writeInt(0); - data.writeInt(0); - data.writeInt(0); - return; - } - data.writeInt(this.payload.intPayload.size()); - data.writeInt(this.payload.floatPayload.size()); - data.writeInt(this.payload.stringPayload.size()); - for (Iterator i$ = this.payload.intPayload.iterator(); i$.hasNext();) - { - int intData = ((Integer)i$.next()).intValue(); - data.writeInt(intData); - } - for (Iterator i$ = this.payload.floatPayload.iterator(); i$.hasNext();) - { - float floatData = ((Float)i$.next()).floatValue(); - data.writeFloat(floatData); - } - for (String stringData : this.payload.stringPayload) - { - byte[] bytes = stringData.getBytes("UTF-8"); - data.writeShort(bytes.length); - data.writeBytes(bytes); - } - } - - public void readData(ByteBuf data) - throws IOException - { - super.readData(data); - - this.payload = new PacketPayload(); - - int intLength = data.readInt(); - int floatLength = data.readInt(); - int stringLength = data.readInt(); - - this.payload.intPayload.clear(); - this.payload.floatPayload.clear(); - this.payload.stringPayload.clear(); - for (int i = 0; i < intLength; i++) { - this.payload.addInteger(data.readInt()); - } - for (int i = 0; i < floatLength; i++) { - this.payload.addFloat(data.readFloat()); - } - for (int i = 0; i < stringLength; i++) - { - int length = data.readShort(); - byte[] string = data.readBytes(length).array(); - this.payload.addString(new String(string, "UTF-8")); - } - } - - public TileEntity getTarget(World world) - { - return world.getTileEntity(this.posX, this.posY, this.posZ); - } -} diff --git a/src/Java/binnie/core/network/packet/PacketPayload.java b/src/Java/binnie/core/network/packet/PacketPayload.java deleted file mode 100644 index 57d1a13759..0000000000 --- a/src/Java/binnie/core/network/packet/PacketPayload.java +++ /dev/null @@ -1,70 +0,0 @@ -package binnie.core.network.packet; - -import binnie.core.network.INetworkedEntity; -import java.util.ArrayList; -import java.util.List; - -public class PacketPayload -{ - public List<Integer> intPayload = new ArrayList(); - public List<Float> floatPayload = new ArrayList(); - public List<String> stringPayload = new ArrayList(); - - public PacketPayload() - { - this.intPayload.clear(); - this.floatPayload.clear(); - this.stringPayload.clear(); - } - - public PacketPayload(INetworkedEntity tile) - { - this(); - tile.writeToPacket(this); - } - - public void addInteger(int a) - { - this.intPayload.add(Integer.valueOf(a)); - } - - public void addFloat(float a) - { - this.floatPayload.add(Float.valueOf(a)); - } - - public void addString(String a) - { - this.stringPayload.add(a); - } - - public int getInteger() - { - return ((Integer)this.intPayload.remove(0)).intValue(); - } - - public float getFloat() - { - return ((Float)this.floatPayload.remove(0)).floatValue(); - } - - public String getString() - { - return (String)this.stringPayload.remove(0); - } - - public void append(PacketPayload other) - { - if (other == null) { - return; - } - this.intPayload.addAll(other.intPayload); - this.floatPayload.addAll(other.floatPayload); - this.stringPayload.addAll(other.stringPayload); - } - - public boolean isEmpty() - { - return (this.intPayload.isEmpty()) && (this.floatPayload.isEmpty()) && (this.stringPayload.isEmpty()); - } -} diff --git a/src/Java/binnie/core/proxy/BinnieModProxy.java b/src/Java/binnie/core/proxy/BinnieModProxy.java deleted file mode 100644 index a6697b384f..0000000000 --- a/src/Java/binnie/core/proxy/BinnieModProxy.java +++ /dev/null @@ -1,67 +0,0 @@ -package binnie.core.proxy; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.gui.IBinnieGUID; -import binnie.core.language.ManagerLanguage; -import binnie.core.network.packet.MessageBase; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.IIcon; - -public class BinnieModProxy - implements IBinnieModProxy -{ - private AbstractMod mod; - - public BinnieModProxy(AbstractMod mod) - { - this.mod = mod; - } - - public void openGui(IBinnieGUID ID, EntityPlayer player, int x, int y, int z) - { - BinnieCore.proxy.openGui(this.mod, ID.ordinal(), player, x, y, z); - } - - public void sendToAll(MessageBase packet) - { - this.mod.getNetworkWrapper().sendToAll(packet.GetMessage()); - } - - public void sendToPlayer(MessageBase packet, EntityPlayer entityplayer) - { - if ((entityplayer instanceof EntityPlayerMP)) { - this.mod.getNetworkWrapper().sendTo(packet.GetMessage(), (EntityPlayerMP)entityplayer); - } - } - - public void sendToServer(MessageBase packet) - { - this.mod.getNetworkWrapper().sendToServer(packet.GetMessage()); - } - - public IIcon getIcon(IIconRegister register, String string) - { - return BinnieCore.proxy.getIcon(register, this.mod.getModID(), string); - } - - public void preInit() {} - - public void init() {} - - public void postInit() {} - - public String localise(String string) - { - return Binnie.Language.localise(this.mod, string); - } - - public String localiseOrBlank(String string) - { - return Binnie.Language.localiseOrBlank(this.mod, string); - } -} diff --git a/src/Java/binnie/core/proxy/BinnieProxy.java b/src/Java/binnie/core/proxy/BinnieProxy.java deleted file mode 100644 index 04a63b8c67..0000000000 --- a/src/Java/binnie/core/proxy/BinnieProxy.java +++ /dev/null @@ -1,156 +0,0 @@ -package binnie.core.proxy; - -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.network.BinnieCorePacketID; -import binnie.core.network.INetworkedEntity; -import binnie.core.network.packet.MessageUpdate; -import binnie.core.resource.BinnieResource; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import java.io.File; -import java.util.Map; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; - -public class BinnieProxy - extends BinnieModProxy - implements IBinnieProxy -{ - public BinnieProxy() - { - super(BinnieCore.instance); - } - - public void preInit() {} - - public void init() {} - - public void postInit() {} - - public void bindTexture(BinnieResource texture) {} - - public boolean checkTexture(BinnieResource location) - { - return false; - } - - public int getUniqueRenderID() - { - return RenderingRegistry.getNextAvailableRenderId(); - } - - public void openGui(AbstractMod mod, int id, EntityPlayer player, int x, int y, int z) - { - player.openGui(mod, id, player.worldObj, x, y, z); - } - - public boolean isSimulating(World world) - { - return true; - } - - public void registerCustomItemRenderer(Item item, IItemRenderer itemRenderer) {} - - public boolean needsTagCompoundSynched(Item item) - { - return item.getShareTag(); - } - - public World getWorld() - { - return null; - } - - public void throwException(String message, Throwable e) - { - FMLCommonHandler.instance().raiseException(e, message, true); - } - - public Minecraft getMinecraftInstance() - { - return null; - } - - public boolean isClient() - { - return false; - } - - public boolean isServer() - { - return true; - } - - public File getDirectory() - { - return new File("./"); - } - - public void registerTileEntity(Class<? extends TileEntity> tile, String id, Object renderer) - { - GameRegistry.registerTileEntity(tile, id); - } - - public void createPipe(Item pipe) {} - - public boolean isDebug() - { - return System.getenv().containsKey("BINNIE_DEBUG"); - } - - public void registerBlockRenderer(Object renderer) {} - - public Object createObject(String renderer) - { - return null; - } - - public void sendNetworkEntityPacket(INetworkedEntity entity) - { - MessageUpdate packet = new MessageUpdate(BinnieCorePacketID.NetworkEntityUpdate.ordinal(), entity); - sendToAll(packet); - } - - public IIcon getIcon(IIconRegister register, String mod, String name) - { - return null; - } - - private short uniqueTextureUID = 1200; - - public void handleTextureRefresh(IIconRegister register, int type) {} - - public void handlePostTextureRefresh(IIconRegister register, int type) {} - - public short getUniqueTextureUID() - { - return this.uniqueTextureUID++; - } - - public void bindTexture(ResourceLocation location) {} - - public boolean isShiftDown() - { - return false; - } - - public EntityPlayer getPlayer() - { - return null; - } - - public MinecraftServer getServer() - { - return MinecraftServer.getServer(); - } -} diff --git a/src/Java/binnie/core/proxy/BinnieProxyClient.java b/src/Java/binnie/core/proxy/BinnieProxyClient.java deleted file mode 100644 index 4eb3db5727..0000000000 --- a/src/Java/binnie/core/proxy/BinnieProxyClient.java +++ /dev/null @@ -1,158 +0,0 @@ -package binnie.core.proxy; - -import binnie.Binnie; -import binnie.core.liquid.ManagerLiquid; -import binnie.core.resource.BinnieResource; -import binnie.craftgui.resource.minecraft.CraftGUIResourceManager; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import java.io.File; -import java.io.IOException; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.client.renderer.texture.ITextureObject; -import net.minecraft.client.renderer.texture.SimpleTexture; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -public final class BinnieProxyClient - extends BinnieProxy - implements IBinnieProxy -{ - public void bindTexture(BinnieResource texture) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - bindTexture(texture.getResourceLocation()); - } - - public void bindTexture(ResourceLocation location) - { - getMinecraftInstance().getTextureManager().bindTexture(location); - } - - public boolean checkTexture(BinnieResource location) - { - SimpleTexture texture = new SimpleTexture(location.getResourceLocation()); - try - { - texture.loadTexture(getMinecraftInstance().getResourceManager()); - } - catch (IOException e) - { - return false; - } - return true; - } - - public boolean isSimulating(World world) - { - return !world.isRemote; - } - - public void registerCustomItemRenderer(Item item, IItemRenderer itemRenderer) - { - MinecraftForgeClient.registerItemRenderer(item, itemRenderer); - } - - public World getWorld() - { - return getMinecraftInstance().theWorld; - } - - public Minecraft getMinecraftInstance() - { - return FMLClientHandler.instance().getClient(); - } - - public boolean isClient() - { - return true; - } - - public boolean isServer() - { - return false; - } - - public File getDirectory() - { - return new File("."); - } - - public void registerTileEntity(Class<? extends TileEntity> tile, String id, Object renderer) - { - if ((renderer != null) && ((renderer instanceof TileEntitySpecialRenderer))) { - ClientRegistry.registerTileEntity(tile, id, (TileEntitySpecialRenderer)renderer); - } else { - GameRegistry.registerTileEntity(tile, id); - } - } - - public void registerBlockRenderer(Object renderer) - { - if ((renderer != null) && ((renderer instanceof ISimpleBlockRenderingHandler))) { - RenderingRegistry.registerBlockHandler((ISimpleBlockRenderingHandler)renderer); - } - } - - public void createPipe(Item pipe) {} - - public Object createObject(String renderer) - { - Object object = null; - try - { - Class<?> rendererClass = Class.forName(renderer); - if (rendererClass != null) { - object = rendererClass.newInstance(); - } - } - catch (Exception e) {} - return object; - } - - public IIcon getIcon(IIconRegister register, String mod, String name) - { - return register.registerIcon(mod + ":" + name); - } - - public boolean isShiftDown() - { - return (Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54)); - } - - public EntityPlayer getPlayer() - { - return Minecraft.getMinecraft().thePlayer; - } - - public void handlePreTextureRefresh(IIconRegister register, int type) - { - if (type == 0) { - Binnie.Liquid.reloadIcons(register); - } - } - - public void preInit() - { - IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); - if ((manager instanceof IReloadableResourceManager)) { - ((IReloadableResourceManager)manager).registerReloadListener(new CraftGUIResourceManager()); - } - } -} diff --git a/src/Java/binnie/core/proxy/BinnieProxyServer.java b/src/Java/binnie/core/proxy/BinnieProxyServer.java deleted file mode 100644 index 99e0164974..0000000000 --- a/src/Java/binnie/core/proxy/BinnieProxyServer.java +++ /dev/null @@ -1,6 +0,0 @@ -package binnie.core.proxy; - -public class BinnieProxyServer - extends BinnieProxy - implements IBinnieProxy -{} diff --git a/src/Java/binnie/core/proxy/IBinnieModProxy.java b/src/Java/binnie/core/proxy/IBinnieModProxy.java deleted file mode 100644 index aa9dd11e62..0000000000 --- a/src/Java/binnie/core/proxy/IBinnieModProxy.java +++ /dev/null @@ -1,21 +0,0 @@ -package binnie.core.proxy; - -import binnie.core.gui.IBinnieGUID; -import binnie.core.network.packet.MessageBase; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.IIcon; - -abstract interface IBinnieModProxy - extends IProxyCore -{ - public abstract void openGui(IBinnieGUID paramIBinnieGUID, EntityPlayer paramEntityPlayer, int paramInt1, int paramInt2, int paramInt3); - - public abstract void sendToAll(MessageBase paramMessageBase); - - public abstract void sendToPlayer(MessageBase paramMessageBase, EntityPlayer paramEntityPlayer); - - public abstract void sendToServer(MessageBase paramMessageBase); - - public abstract IIcon getIcon(IIconRegister paramIIconRegister, String paramString); -} diff --git a/src/Java/binnie/core/proxy/IBinnieProxy.java b/src/Java/binnie/core/proxy/IBinnieProxy.java deleted file mode 100644 index 4ce037aa3d..0000000000 --- a/src/Java/binnie/core/proxy/IBinnieProxy.java +++ /dev/null @@ -1,54 +0,0 @@ -package binnie.core.proxy; - -import binnie.core.AbstractMod; -import binnie.core.resource.BinnieResource; -import java.io.File; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; - -public abstract interface IBinnieProxy - extends IProxyCore -{ - public abstract boolean isClient(); - - public abstract boolean isServer(); - - public abstract File getDirectory(); - - public abstract void bindTexture(BinnieResource paramBinnieResource); - - public abstract void bindTexture(ResourceLocation paramResourceLocation); - - public abstract int getUniqueRenderID(); - - public abstract void registerCustomItemRenderer(Item paramItem, IItemRenderer paramIItemRenderer); - - public abstract void openGui(AbstractMod paramAbstractMod, int paramInt1, EntityPlayer paramEntityPlayer, int paramInt2, int paramInt3, int paramInt4); - - public abstract boolean isSimulating(World paramWorld); - - public abstract World getWorld(); - - public abstract Minecraft getMinecraftInstance(); - - public abstract boolean needsTagCompoundSynched(Item paramItem); - - public abstract Object createObject(String paramString); - - public abstract void registerTileEntity(Class<? extends TileEntity> paramClass, String paramString, Object paramObject); - - public abstract void createPipe(Item paramItem); - - public abstract boolean isDebug(); - - public abstract void registerBlockRenderer(Object paramObject); - - public abstract IIcon getIcon(IIconRegister paramIIconRegister, String paramString1, String paramString2); -} diff --git a/src/Java/binnie/core/proxy/IProxyCore.java b/src/Java/binnie/core/proxy/IProxyCore.java deleted file mode 100644 index 4a0d5c231b..0000000000 --- a/src/Java/binnie/core/proxy/IProxyCore.java +++ /dev/null @@ -1,7 +0,0 @@ -package binnie.core.proxy; - -import binnie.core.IInitializable; - -public abstract interface IProxyCore - extends IInitializable -{} diff --git a/src/Java/binnie/core/resource/BinnieIcon.java b/src/Java/binnie/core/resource/BinnieIcon.java deleted file mode 100644 index cf7f44a018..0000000000 --- a/src/Java/binnie/core/resource/BinnieIcon.java +++ /dev/null @@ -1,47 +0,0 @@ -package binnie.core.resource; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.proxy.BinnieProxy; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; - -public class BinnieIcon - extends BinnieResource -{ - public BinnieIcon(AbstractMod mod, ResourceType type, String path) - { - super(mod, type, path); - this.textureSheet = (type == ResourceType.Block ? 0 : 1); - Binnie.Resource.registerIcon(this); - } - - private int textureSheet = 0; - private IIcon icon = null; - - public IIcon getIcon() - { - return this.icon; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(IIconRegister register) - { - registerIcon(register); - return this.icon; - } - - @SideOnly(Side.CLIENT) - public void registerIcon(IIconRegister register) - { - this.icon = BinnieCore.proxy.getIcon(register, this.mod, this.path); - } - - public int getTextureSheet() - { - return this.textureSheet; - } -} diff --git a/src/Java/binnie/core/resource/BinnieResource.java b/src/Java/binnie/core/resource/BinnieResource.java deleted file mode 100644 index d9c3d54a0a..0000000000 --- a/src/Java/binnie/core/resource/BinnieResource.java +++ /dev/null @@ -1,38 +0,0 @@ -package binnie.core.resource; - -import binnie.core.AbstractMod; -import net.minecraft.util.ResourceLocation; - -public class BinnieResource -{ - String mod; - private ResourceType type; - String path; - - public BinnieResource(AbstractMod mod, ResourceType type, String path) - { - this(mod.getModID(), type, path); - } - - public BinnieResource(String modid, ResourceType type, String path) - { - this.mod = modid; - this.type = type; - this.path = path; - } - - public String getFullPath() - { - return "/assets/" + this.mod + "/textures/" + this.type.toString() + "/" + this.path; - } - - public ResourceLocation getResourceLocation() - { - return new ResourceLocation(this.mod, "textures/" + this.type.toString() + "/" + this.path); - } - - public String getShortPath() - { - return "textures/" + this.type.toString() + "/" + this.path; - } -} diff --git a/src/Java/binnie/core/resource/IBinnieTexture.java b/src/Java/binnie/core/resource/IBinnieTexture.java deleted file mode 100644 index 8db06e2c6a..0000000000 --- a/src/Java/binnie/core/resource/IBinnieTexture.java +++ /dev/null @@ -1,6 +0,0 @@ -package binnie.core.resource; - -public abstract interface IBinnieTexture -{ - public abstract BinnieResource getTexture(); -} diff --git a/src/Java/binnie/core/resource/ManagerResource.java b/src/Java/binnie/core/resource/ManagerResource.java deleted file mode 100644 index 31a5116931..0000000000 --- a/src/Java/binnie/core/resource/ManagerResource.java +++ /dev/null @@ -1,48 +0,0 @@ -package binnie.core.resource; - -import binnie.core.AbstractMod; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; - -public class ManagerResource -{ - public BinnieResource getPNG(AbstractMod mod, ResourceType type, String path) - { - return getFile(mod, type, path + ".png"); - } - - public BinnieResource getFile(AbstractMod mod, ResourceType type, String path) - { - return new BinnieResource(mod, type, path); - } - - private List<BinnieIcon> icons = new ArrayList(); - - public void registerIcon(BinnieIcon binnieIcon) - { - this.icons.add(binnieIcon); - } - - public BinnieIcon getItemIcon(AbstractMod mod, String iconFile) - { - return new BinnieIcon(mod, ResourceType.Item, iconFile); - } - - public BinnieIcon getBlockIcon(AbstractMod mod, String iconFile) - { - return new BinnieIcon(mod, ResourceType.Block, iconFile); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register, int type) - { - for (BinnieIcon icon : this.icons) { - if (icon.getTextureSheet() == type) { - icon.registerIcon(register); - } - } - } -} diff --git a/src/Java/binnie/core/resource/ResourceType.java b/src/Java/binnie/core/resource/ResourceType.java deleted file mode 100644 index e9705ce252..0000000000 --- a/src/Java/binnie/core/resource/ResourceType.java +++ /dev/null @@ -1,18 +0,0 @@ -package binnie.core.resource; - -public enum ResourceType -{ - Item("items"), Block("blocks"), Tile("tile"), GUI("gui"), FX("fx"), Entity("entities"); - - String name; - - private ResourceType(String name) - { - this.name = name; - } - - public String toString() - { - return this.name; - } -} diff --git a/src/Java/binnie/core/texture/BinnieCoreTexture.java b/src/Java/binnie/core/texture/BinnieCoreTexture.java deleted file mode 100644 index 6e8cd9abee..0000000000 --- a/src/Java/binnie/core/texture/BinnieCoreTexture.java +++ /dev/null @@ -1,28 +0,0 @@ -package binnie.core.texture; - -import binnie.Binnie; -import binnie.core.BinnieCore; -import binnie.core.resource.BinnieResource; -import binnie.core.resource.IBinnieTexture; -import binnie.core.resource.ManagerResource; -import binnie.core.resource.ResourceType; - -public enum BinnieCoreTexture - implements IBinnieTexture -{ - Compartment(ResourceType.Tile, "Compartment"), CompartmentIron(ResourceType.Tile, "CompartmentIron"), CompartmentDiamond(ResourceType.Tile, "CompartmentDiamond"), CompartmentCopper(ResourceType.Tile, "CompartmentCopper"), CompartmentGold(ResourceType.Tile, "CompartmentGold"), CompartmentBronze(ResourceType.Tile, "CompartmentBronze"), GUIBreeding(ResourceType.GUI, "breeding"), GUIAnalyst(ResourceType.GUI, "guianalyst"); - - String texture; - ResourceType type; - - private BinnieCoreTexture(ResourceType base, String texture) - { - this.texture = texture; - this.type = base; - } - - public BinnieResource getTexture() - { - return Binnie.Resource.getPNG(BinnieCore.instance, this.type, this.texture); - } -} diff --git a/src/Java/binnie/core/texture/TextureManager.java b/src/Java/binnie/core/texture/TextureManager.java deleted file mode 100644 index fceb0539a2..0000000000 --- a/src/Java/binnie/core/texture/TextureManager.java +++ /dev/null @@ -1,15 +0,0 @@ -package binnie.core.texture; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import javax.swing.Icon; - -@SideOnly(Side.CLIENT) -public class TextureManager -{ - static List<Icon> textures = new ArrayList(); - - public static void init() {} -} diff --git a/src/Java/binnie/core/triggers/ActionProvider.java b/src/Java/binnie/core/triggers/ActionProvider.java deleted file mode 100644 index 1fa519dc6c..0000000000 --- a/src/Java/binnie/core/triggers/ActionProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package binnie.core.triggers; - -import binnie.core.machines.component.IBuildcraft.ActionProvider; -import buildcraft.api.statements.IActionExternal; -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IActionProvider; -import buildcraft.api.statements.IStatementContainer; -import cpw.mods.fml.common.Optional.Method; -import java.util.Collection; -import java.util.LinkedList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -class ActionProvider - implements IActionProvider -{ - @Optional.Method(modid="BuildCraft|Silicon") - public Collection<IActionInternal> getInternalActions(IStatementContainer container) - { - return null; - } - - @Optional.Method(modid="BuildCraft|Silicon") - public Collection<IActionExternal> getExternalActions(ForgeDirection side, TileEntity tile) - { - LinkedList<IActionExternal> list = new LinkedList(); - if ((tile instanceof IBuildcraft.ActionProvider)) { - ((IBuildcraft.ActionProvider)tile).getActions(list); - } - LinkedList<IActionExternal> list2 = new LinkedList(); - for (IActionExternal action : list2) { - if ((action != null) && (action.getUniqueTag() != null)) { - list.add(action); - } - } - return list2; - } -} diff --git a/src/Java/binnie/core/triggers/BinnieAction.java b/src/Java/binnie/core/triggers/BinnieAction.java deleted file mode 100644 index f9c0d24e78..0000000000 --- a/src/Java/binnie/core/triggers/BinnieAction.java +++ /dev/null @@ -1,88 +0,0 @@ -package binnie.core.triggers; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.resource.BinnieIcon; -import binnie.core.resource.ManagerResource; -import buildcraft.api.statements.IActionExternal; -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementManager; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraftforge.common.util.ForgeDirection; - -class BinnieAction - implements IActionExternal -{ - private static int incrementalID = 800; - public static BinnieAction actionPauseProcess; - public static BinnieAction actionCancelTask; - private String desc; - private BinnieIcon icon; - private String tag; - private int id = 0; - - BinnieAction(String desc, String tag, String iconFile) - { - this(desc, tag, BinnieCore.instance, iconFile); - } - - private BinnieAction(String desc, String tag, AbstractMod mod, String iconFile) - { - this.id = (incrementalID++); - this.tag = tag; - StatementManager.registerStatement(this); - this.icon = Binnie.Resource.getItemIcon(mod, iconFile); - this.desc = desc; - } - - public String getDescription() - { - return this.desc; - } - - public String getUniqueTag() - { - return this.tag; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon() - { - return this.icon.getIcon(); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - this.icon.registerIcon(iconRegister); - } - - public int maxParameters() - { - return 0; - } - - public int minParameters() - { - return 0; - } - - public IStatementParameter createParameter(int index) - { - return null; - } - - public IStatement rotateLeft() - { - return this; - } - - public void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) {} -} diff --git a/src/Java/binnie/core/triggers/BinnieTrigger.java b/src/Java/binnie/core/triggers/BinnieTrigger.java deleted file mode 100644 index e5cac34dea..0000000000 --- a/src/Java/binnie/core/triggers/BinnieTrigger.java +++ /dev/null @@ -1,116 +0,0 @@ -package binnie.core.triggers; - -import binnie.Binnie; -import binnie.core.AbstractMod; -import binnie.core.BinnieCore; -import binnie.core.resource.BinnieIcon; -import binnie.core.resource.ManagerResource; -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.ITriggerExternal; -import buildcraft.api.statements.StatementManager; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraftforge.common.util.ForgeDirection; - -final class BinnieTrigger - implements ITriggerExternal -{ - private static int incrementalID = 800; - protected static BinnieTrigger triggerNoBlankTemplate; - protected static BinnieTrigger triggerNoTemplate; - protected static BinnieTrigger triggerIsWorking; - protected static BinnieTrigger triggerIsNotWorking; - protected static BinnieTrigger triggerCanWork; - protected static BinnieTrigger triggerCannotWork; - protected static BinnieTrigger triggerPowerNone; - protected static BinnieTrigger triggerPowerLow; - protected static BinnieTrigger triggerPowerMedium; - protected static BinnieTrigger triggerPowerHigh; - protected static BinnieTrigger triggerPowerFull; - protected static BinnieTrigger triggerSerumFull; - protected static BinnieTrigger triggerSerumPure; - protected static BinnieTrigger triggerSerumEmpty; - protected static BinnieTrigger triggerAcclimatiserNone; - protected static BinnieTrigger triggerAcclimatiserHot; - protected static BinnieTrigger triggerAcclimatiserCold; - protected static BinnieTrigger triggerAcclimatiserWet; - protected static BinnieTrigger triggerAcclimatiserDry; - private String desc; - private String tag; - private BinnieIcon icon; - private int id = 0; - - public BinnieTrigger(String desc, String tag, String iconFile) - { - this(desc, tag, BinnieCore.instance, iconFile); - } - - public BinnieTrigger(String desc, String tag, AbstractMod mod, String iconFile) - { - this.id = (incrementalID++); - this.tag = tag; - StatementManager.registerStatement(this); - TriggerProvider.triggers.add(this); - this.icon = Binnie.Resource.getItemIcon(mod, iconFile); - this.desc = desc; - } - - public String getDescription() - { - return this.desc; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(IIconRegister register) - { - return this.icon.getIcon(register); - } - - public String getUniqueTag() - { - return this.tag; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon() - { - return this.icon.getIcon(); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - this.icon.registerIcon(iconRegister); - } - - public int maxParameters() - { - return 0; - } - - public int minParameters() - { - return 0; - } - - public IStatementParameter createParameter(int index) - { - return null; - } - - public IStatement rotateLeft() - { - return null; - } - - public boolean isTriggerActive(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters) - { - return false; - } -} diff --git a/src/Java/binnie/core/triggers/ModuleTrigger.java b/src/Java/binnie/core/triggers/ModuleTrigger.java deleted file mode 100644 index 1d39e816cb..0000000000 --- a/src/Java/binnie/core/triggers/ModuleTrigger.java +++ /dev/null @@ -1,45 +0,0 @@ -package binnie.core.triggers; - -import binnie.core.IInitializable; -import binnie.extrabees.ExtraBees; -import buildcraft.api.statements.StatementManager; - -public class ModuleTrigger - implements IInitializable -{ - public void preInit() {} - - public void init() - { - BinnieAction.actionPauseProcess = new BinnieAction("Pause Process", "binnie.action.pauseProcess", "actions/PauseProcess"); - BinnieAction.actionCancelTask = new BinnieAction("Cancel Task", "binnie.action.cancelTask", "actions/CancelTask"); - - StatementManager.registerActionProvider(new ActionProvider()); - - BinnieTrigger.triggerNoBlankTemplate = new BinnieTrigger("No Blank Template", "binnie.trigger.noBlankTemplate", ExtraBees.instance, "triggers/NoBlankTemplate"); - - - BinnieTrigger.triggerNoTemplate = new BinnieTrigger("No Template", "binnie.trigger.noTemplate", ExtraBees.instance, "triggers/NoTemplate"); - - - BinnieTrigger.triggerIsWorking = new BinnieTrigger("Is Working", "binnie.trigger.isWorking", "triggers/IsWorking"); - BinnieTrigger.triggerIsNotWorking = new BinnieTrigger("Is Not Working", "binnie.trigger.isNotWorking", "triggers/IsNotWorking"); - BinnieTrigger.triggerCanWork = new BinnieTrigger("Can Work", "binnie.trigger.canWork", "triggers/CanWork"); - BinnieTrigger.triggerCannotWork = new BinnieTrigger("Cannot Work", "binnie.trigger.cannotWork", "triggers/CannotWork"); - - BinnieTrigger.triggerPowerNone = new BinnieTrigger("Power None", "binnie.trigger.powerNone", "triggers/PowerNone"); - BinnieTrigger.triggerPowerLow = new BinnieTrigger("Power Low", "binnie.trigger.powerLow", "triggers/PowerLow"); - BinnieTrigger.triggerPowerMedium = new BinnieTrigger("Power Medium", "binnie.trigger.powerMedium", "triggers/PowerMedium"); - BinnieTrigger.triggerPowerHigh = new BinnieTrigger("Power High", "binnie.trigger.powerHigh", "triggers/PowerHigh"); - BinnieTrigger.triggerPowerFull = new BinnieTrigger("Power Full", "binnie.trigger.powerFull", "triggers/PowerFull"); - - - BinnieTrigger.triggerSerumFull = new BinnieTrigger("Serum Full", "binnie.trigger.serumFull", ExtraBees.instance, "triggers/SerumFull"); - BinnieTrigger.triggerSerumPure = new BinnieTrigger("Serum Pure", "binnie.trigger.serumPure", ExtraBees.instance, "triggers/SerumPure"); - BinnieTrigger.triggerSerumEmpty = new BinnieTrigger("Serum Pure", "binnie.trigger.serumEmpty", ExtraBees.instance, "triggers/SerumEmpty"); - - StatementManager.registerTriggerProvider(new TriggerProvider()); - } - - public void postInit() {} -} diff --git a/src/Java/binnie/core/triggers/TriggerData.java b/src/Java/binnie/core/triggers/TriggerData.java deleted file mode 100644 index 8784e4278a..0000000000 --- a/src/Java/binnie/core/triggers/TriggerData.java +++ /dev/null @@ -1,37 +0,0 @@ -package binnie.core.triggers; - -import buildcraft.api.statements.ITriggerExternal; -import java.util.Map.Entry; - -public class TriggerData - implements Map.Entry<ITriggerExternal, Boolean> -{ - private final ITriggerExternal key; - private Boolean value; - - public TriggerData(ITriggerExternal key, Boolean value) - { - if (key == null) { - throw new NullPointerException(); - } - this.key = key; - this.value = value; - } - - public ITriggerExternal getKey() - { - return this.key; - } - - public Boolean getValue() - { - return this.value; - } - - public Boolean setValue(Boolean value) - { - Boolean old = this.value; - this.value = value; - return old; - } -} diff --git a/src/Java/binnie/core/triggers/TriggerInventory.java b/src/Java/binnie/core/triggers/TriggerInventory.java deleted file mode 100644 index 2892f12c7e..0000000000 --- a/src/Java/binnie/core/triggers/TriggerInventory.java +++ /dev/null @@ -1,11 +0,0 @@ -package binnie.core.triggers; - -import net.minecraft.inventory.IInventory; - -public class TriggerInventory -{ - private static Boolean isSlotEmpty(IInventory inventory, int slot) - { - return Boolean.valueOf(inventory.getStackInSlot(slot) != null); - } -} diff --git a/src/Java/binnie/core/triggers/TriggerPower.java b/src/Java/binnie/core/triggers/TriggerPower.java deleted file mode 100644 index 69c02decd9..0000000000 --- a/src/Java/binnie/core/triggers/TriggerPower.java +++ /dev/null @@ -1,48 +0,0 @@ -package binnie.core.triggers; - -import binnie.core.machines.Machine; -import binnie.core.machines.power.IPoweredMachine; -import binnie.core.machines.power.PowerInterface; - -public class TriggerPower -{ - public static TriggerData powerNone(Object tile) - { - return new TriggerData(BinnieTrigger.triggerPowerNone, Boolean.valueOf(getPercentage(tile) < 0.0500000007450581D)); - } - - public static TriggerData powerLow(Object tile) - { - return new TriggerData(BinnieTrigger.triggerPowerLow, Boolean.valueOf(getPercentage(tile) < 0.3499999940395355D)); - } - - public static TriggerData powerMedium(Object tile) - { - double p = getPercentage(tile); - return new TriggerData(BinnieTrigger.triggerPowerMedium, Boolean.valueOf((p >= 0.3499999940395355D) && (p <= 0.6499999761581421D))); - } - - public static TriggerData powerHigh(Object tile) - { - double p = getPercentage(tile); - return new TriggerData(BinnieTrigger.triggerPowerHigh, Boolean.valueOf(getPercentage(tile) > 0.6499999761581421D)); - } - - public static TriggerData powerFull(Object tile) - { - double p = getPercentage(tile); - return new TriggerData(BinnieTrigger.triggerPowerFull, Boolean.valueOf(getPercentage(tile) > 0.949999988079071D)); - } - - private static double getPercentage(Object tile) - { - IPoweredMachine process = (IPoweredMachine)Machine.getInterface(IPoweredMachine.class, tile); - if (process != null) - { - double percentage = process.getInterface().getEnergy() / process.getInterface().getCapacity(); - - return percentage; - } - return 0.0D; - } -} diff --git a/src/Java/binnie/core/triggers/TriggerProvider.java b/src/Java/binnie/core/triggers/TriggerProvider.java deleted file mode 100644 index fc6da191e8..0000000000 --- a/src/Java/binnie/core/triggers/TriggerProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -package binnie.core.triggers; - -import binnie.core.machines.component.IBuildcraft.TriggerProvider; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.ITriggerExternal; -import buildcraft.api.statements.ITriggerInternal; -import buildcraft.api.statements.ITriggerProvider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -class TriggerProvider - implements ITriggerProvider -{ - static TriggerProvider instance = new TriggerProvider(); - public static List<BinnieTrigger> triggers = new ArrayList(); - - public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) - { - LinkedList<TriggerData> list = new LinkedList(); - - LinkedList<ITriggerExternal> triggerData = new LinkedList(); - if ((tile instanceof IBuildcraft.TriggerProvider)) { - ((IBuildcraft.TriggerProvider)tile).getTriggers(list); - } - for (TriggerData data : list) { - if ((data.getKey() != null) && (data.getKey().getUniqueTag() != null)) { - triggerData.add(data.getKey()); - } - } - return triggerData; - } - - public static boolean isTriggerActive(ITriggerExternal trigger, TileEntity tile) - { - LinkedList<TriggerData> list = new LinkedList(); - - LinkedList<ITriggerExternal> triggerData = new LinkedList(); - if ((tile instanceof IBuildcraft.TriggerProvider)) { - ((IBuildcraft.TriggerProvider)tile).getTriggers(list); - } - for (TriggerData data : list) { - if (data.getKey() == trigger) { - return data.getValue().booleanValue(); - } - } - return false; - } - - public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) - { - return new ArrayList(); - } -} diff --git a/src/Java/binnie/core/triggers/TriggerWorking.java b/src/Java/binnie/core/triggers/TriggerWorking.java deleted file mode 100644 index 06feee0f86..0000000000 --- a/src/Java/binnie/core/triggers/TriggerWorking.java +++ /dev/null @@ -1,47 +0,0 @@ -package binnie.core.triggers; - -import binnie.core.machines.Machine; -import binnie.core.machines.power.IProcess; - -public class TriggerWorking -{ - public static TriggerData isNotWorking(Object inventory) - { - IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory); - boolean b = false; - if (process != null) { - b = (process.canWork() != null) && (process.canProgress() != null); - } - return new TriggerData(BinnieTrigger.triggerIsNotWorking, Boolean.valueOf(b)); - } - - public static TriggerData isWorking(Object inventory) - { - IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory); - boolean b = false; - if (process != null) { - b = (process.canWork() == null) && (process.canProgress() == null); - } - return new TriggerData(BinnieTrigger.triggerIsWorking, Boolean.valueOf(b)); - } - - public static TriggerData canWork(Object inventory) - { - IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory); - boolean b = false; - if (process != null) { - b = process.canWork() == null; - } - return new TriggerData(BinnieTrigger.triggerCanWork, Boolean.valueOf(b)); - } - - public static TriggerData cannotWork(Object inventory) - { - IProcess process = (IProcess)Machine.getInterface(IProcess.class, inventory); - boolean b = false; - if (process != null) { - b = process.canWork() != null; - } - return new TriggerData(BinnieTrigger.triggerCannotWork, Boolean.valueOf(b)); - } -} diff --git a/src/Java/binnie/core/util/FluidStackSet.java b/src/Java/binnie/core/util/FluidStackSet.java deleted file mode 100644 index 1283435293..0000000000 --- a/src/Java/binnie/core/util/FluidStackSet.java +++ /dev/null @@ -1,128 +0,0 @@ -package binnie.core.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import net.minecraftforge.fluids.FluidStack; - -class FluidStackSet - implements Set<FluidStack> -{ - public String toString() - { - return this.itemStacks.toString(); - } - - List<FluidStack> itemStacks = new ArrayList(); - - protected FluidStack getExisting(FluidStack stack) - { - for (FluidStack stack2 : this.itemStacks) { - if (stack2.isFluidEqual(stack)) { - return stack2; - } - } - return null; - } - - public boolean add(FluidStack e) - { - if (e != null) - { - if (getExisting(e) == null) { - return this.itemStacks.add(e.copy()); - } - getExisting(e).amount += e.amount; - } - return false; - } - - public boolean addAll(Collection<? extends FluidStack> c) - { - boolean addedAll = true; - for (FluidStack stack : c) { - addedAll = (add(stack)) && (addedAll); - } - return addedAll; - } - - public void clear() - { - this.itemStacks.clear(); - } - - public boolean contains(Object o) - { - if (!(o instanceof FluidStack)) { - return false; - } - return getExisting((FluidStack)o) != null; - } - - public boolean containsAll(Collection<?> c) - { - boolean addedAll = true; - for (Object o : c) { - addedAll = (addedAll) && (contains(o)); - } - return false; - } - - public boolean isEmpty() - { - return this.itemStacks.isEmpty(); - } - - public Iterator<FluidStack> iterator() - { - return this.itemStacks.iterator(); - } - - public boolean remove(Object o) - { - if (contains(o)) - { - FluidStack r = (FluidStack)o; - FluidStack existing = getExisting(r); - if (existing.amount > r.amount) { - existing.amount -= r.amount; - } else { - this.itemStacks.remove(existing); - } - } - return false; - } - - public boolean removeAll(Collection<?> c) - { - boolean addedAll = true; - for (Object o : c) - { - boolean removed = remove(o); - addedAll = (removed) && (addedAll); - } - return false; - } - - public boolean retainAll(Collection<?> c) - { - return this.itemStacks.retainAll(c); - } - - public int size() - { - return this.itemStacks.size(); - } - - public Object[] toArray() - { - return this.itemStacks.toArray(); - } - - public <T> T[] toArray(T[] a) - { - return this.itemStacks.toArray(a); - } -} diff --git a/src/Java/binnie/core/util/IValidator.java b/src/Java/binnie/core/util/IValidator.java deleted file mode 100644 index c6b39dc153..0000000000 --- a/src/Java/binnie/core/util/IValidator.java +++ /dev/null @@ -1,6 +0,0 @@ -package binnie.core.util; - -public abstract interface IValidator<T> -{ - public abstract boolean isValid(T paramT); -} diff --git a/src/Java/binnie/core/util/ItemStackSet.java b/src/Java/binnie/core/util/ItemStackSet.java deleted file mode 100644 index a154f7edfc..0000000000 --- a/src/Java/binnie/core/util/ItemStackSet.java +++ /dev/null @@ -1,128 +0,0 @@ -package binnie.core.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import net.minecraft.item.ItemStack; - -public class ItemStackSet - implements Set<ItemStack> -{ - public String toString() - { - return this.itemStacks.toString(); - } - - List<ItemStack> itemStacks = new ArrayList(); - - protected ItemStack getExisting(ItemStack stack) - { - for (ItemStack stack2 : this.itemStacks) { - if (stack2.isItemEqual(stack)) { - return stack2; - } - } - return null; - } - - public boolean add(ItemStack e) - { - if (e != null) - { - if (getExisting(e) == null) { - return this.itemStacks.add(e.copy()); - } - getExisting(e).stackSize += e.stackSize; - } - return false; - } - - public boolean addAll(Collection<? extends ItemStack> c) - { - boolean addedAll = true; - for (ItemStack stack : c) { - addedAll = (add(stack)) && (addedAll); - } - return addedAll; - } - - public void clear() - { - this.itemStacks.clear(); - } - - public boolean contains(Object o) - { - if (!(o instanceof ItemStack)) { - return false; - } - return getExisting((ItemStack)o) != null; - } - - public boolean containsAll(Collection<?> c) - { - boolean addedAll = true; - for (Object o : c) { - addedAll = (addedAll) && (contains(o)); - } - return false; - } - - public boolean isEmpty() - { - return this.itemStacks.isEmpty(); - } - - public Iterator<ItemStack> iterator() - { - return this.itemStacks.iterator(); - } - - public boolean remove(Object o) - { - if (contains(o)) - { - ItemStack r = (ItemStack)o; - ItemStack existing = getExisting(r); - if (existing.stackSize > r.stackSize) { - existing.stackSize -= r.stackSize; - } else { - this.itemStacks.remove(existing); - } - } - return false; - } - - public boolean removeAll(Collection<?> c) - { - boolean addedAll = true; - for (Object o : c) - { - boolean removed = remove(o); - addedAll = (removed) && (addedAll); - } - return false; - } - - public boolean retainAll(Collection<?> c) - { - return this.itemStacks.retainAll(c); - } - - public int size() - { - return this.itemStacks.size(); - } - - public Object[] toArray() - { - return this.itemStacks.toArray(); - } - - public <T> T[] toArray(T[] a) - { - return this.itemStacks.toArray(a); - } -} diff --git a/src/Java/binnie/core/util/UniqueFluidStackSet.java b/src/Java/binnie/core/util/UniqueFluidStackSet.java deleted file mode 100644 index 49a7dbab35..0000000000 --- a/src/Java/binnie/core/util/UniqueFluidStackSet.java +++ /dev/null @@ -1,28 +0,0 @@ -package binnie.core.util; - -import java.util.List; -import net.minecraftforge.fluids.FluidStack; - -public class UniqueFluidStackSet - extends FluidStackSet -{ - public boolean add(FluidStack e) - { - if ((e != null) && - (getExisting(e) == null)) { - return this.itemStacks.add(e.copy()); - } - return false; - } - - public boolean remove(Object o) - { - if (contains(o)) - { - FluidStack r = (FluidStack)o; - FluidStack existing = getExisting(r); - this.itemStacks.remove(existing); - } - return false; - } -} diff --git a/src/Java/binnie/core/util/UniqueItemStackSet.java b/src/Java/binnie/core/util/UniqueItemStackSet.java deleted file mode 100644 index f9571e8fee..0000000000 --- a/src/Java/binnie/core/util/UniqueItemStackSet.java +++ /dev/null @@ -1,28 +0,0 @@ -package binnie.core.util; - -import java.util.List; -import net.minecraft.item.ItemStack; - -public class UniqueItemStackSet - extends ItemStackSet -{ - public boolean add(ItemStack e) - { - if ((e != null) && - (getExisting(e) == null)) { - return this.itemStacks.add(e.copy()); - } - return false; - } - - public boolean remove(Object o) - { - if (contains(o)) - { - ItemStack r = (ItemStack)o; - ItemStack existing = getExisting(r); - this.itemStacks.remove(existing); - } - return false; - } -} |
