Re-add EnumColor to API!
This commit is contained in:
parent
5d949ec959
commit
199ce13dcd
54 changed files with 180 additions and 65 deletions
|
@ -1,4 +1,4 @@
|
|||
package mekanism.common;
|
||||
package mekanism.api;
|
||||
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
|
@ -4,8 +4,8 @@ import java.util.EnumSet;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
|
|
|
@ -3,9 +3,9 @@ package mekanism.client.gui;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.SideData;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.ThreadClientUpdate;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IModule;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Version;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.client.gui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
|
|
|
@ -3,9 +3,9 @@ package mekanism.client.gui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.client.render;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.ISpecialBounds;
|
||||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.client.render.item;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.ClientProxy;
|
||||
import mekanism.client.MekanismClient;
|
||||
|
@ -10,7 +11,6 @@ import mekanism.client.model.ModelObsidianTNT;
|
|||
import mekanism.client.model.ModelRobit;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.tileentity.RenderBin;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IElectricChest;
|
||||
import mekanism.common.IEnergyCube;
|
||||
import mekanism.common.Mekanism;
|
||||
|
|
|
@ -2,11 +2,11 @@ package mekanism.client.render.tileentity;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.MekanismClient;
|
||||
import mekanism.client.model.ModelEnergyCube;
|
||||
import mekanism.client.model.ModelEnergyCube.ModelEnergyCore;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.tileentity.TileEntityEnergyCube;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IEjector
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
|
||||
public class SideData
|
||||
{
|
||||
/** The color of this SideData */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.common;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.tileentity.TileEntityContainerBlock;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.InventoryBin;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
|
|
|
@ -6,9 +6,9 @@ import ic2.api.item.ISpecialElectricItem;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IEnergyCube;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.Mekanism;
|
||||
|
|
|
@ -2,11 +2,11 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
|
|
|
@ -7,6 +7,7 @@ import ic2.api.item.ISpecialElectricItem;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.EnergizedItemManager;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.api.gas.Gas;
|
||||
|
@ -16,7 +17,6 @@ import mekanism.common.IElectricChest;
|
|||
import mekanism.common.IFactory;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.lwjgl.input.Keyboard;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.lwjgl.input.Keyboard;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IConfigurable;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.PacketHandler;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -5,8 +5,8 @@ import ic2.api.item.ISpecialElectricItem;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.IC2ItemManager;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mekanism.common.item;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.common.item;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
|
|
@ -2,9 +2,9 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EntityRobit;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.tileentity.TileEntityChargepad;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.item;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.tileentity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.RecipeHandler;
|
||||
import mekanism.common.SideData;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.TileComponentEjector;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
|
|
|
@ -2,8 +2,8 @@ package mekanism.common.tileentity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.RecipeHandler;
|
||||
import mekanism.common.SideData;
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IConfigurable;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.PacketHandler;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.TileComponentEjector;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
|
@ -13,7 +15,6 @@ import mekanism.api.gas.IGasItem;
|
|||
import mekanism.api.gas.IGasStorage;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IEjector;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
|
@ -247,8 +248,12 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
|
||||
public void sortInventory()
|
||||
{
|
||||
boolean didOp = false;
|
||||
|
||||
int[] inputSlots = null;
|
||||
|
||||
List<InvID> invStacks = new ArrayList<InvID>();
|
||||
|
||||
List<Integer> nullSlots = new ArrayList<Integer>();
|
||||
List<Integer> fullSlots = new ArrayList<Integer>();
|
||||
|
||||
|
@ -267,6 +272,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
|
||||
for(int id : inputSlots)
|
||||
{
|
||||
invStacks.add(InvID.get(id, inventory));
|
||||
|
||||
if(inventory[id] == null)
|
||||
{
|
||||
nullSlots.add(id);
|
||||
|
@ -277,13 +284,23 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
}
|
||||
}
|
||||
|
||||
if(nullSlots.size() > 0 && fullSlots.size() > 0)
|
||||
Collections.sort(invStacks);
|
||||
|
||||
for(InvID invID1 : invStacks)
|
||||
{
|
||||
int fullID = fullSlots.get(0);
|
||||
List<ItemStack> split = StackUtils.split(inventory[fullID]);
|
||||
for(InvID invID2 : invStacks)
|
||||
{
|
||||
if(invID1.ID == invID2.ID || invID1.id() != invID2.id() || Math.abs(invID1.size()-invID2.size()) < 2) continue;
|
||||
|
||||
List<ItemStack> evened = StackUtils.even(inventory[invID1.ID], inventory[invID2.ID]);
|
||||
inventory[invID1.ID] = evened.get(0);
|
||||
inventory[invID2.ID] = evened.get(1);
|
||||
System.out.println("op");
|
||||
didOp = true;
|
||||
break;
|
||||
}
|
||||
|
||||
inventory[fullID] = split.get(0);
|
||||
inventory[nullSlots.get(0)] = split.get(1);
|
||||
if(didOp) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,37 +314,50 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
stack = s;
|
||||
ID = i;
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return stack != null ? stack.stackSize : 0;
|
||||
}
|
||||
|
||||
public int id()
|
||||
{
|
||||
return stack != null ? stack.itemID : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(InvID arg0)
|
||||
{
|
||||
if(arg0.stack == null && stack == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(arg0.stack == null && stack != null)
|
||||
if(arg0.id() < id())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if(arg0.stack != null && stack == null)
|
||||
else if(arg0.id() > id())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if(arg0.stack.itemID == stack.itemID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(arg0.stack.itemID < stack.itemID)
|
||||
else if(arg0.size() < size())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if(arg0.stack.itemID > stack.itemID)
|
||||
else if(arg0.size() > size())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return size() + " " + id() + " " + ID;
|
||||
}
|
||||
|
||||
public static InvID get(int id, ItemStack[] inv)
|
||||
{
|
||||
return new InvID(inv[id], id);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSecondaryEnergyPerTick()
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common.tileentity;
|
|||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.HashList;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.HashList;
|
||||
import mekanism.common.IConfigurable;
|
||||
import mekanism.common.ITileNetwork;
|
||||
|
|
|
@ -2,6 +2,7 @@ package mekanism.common.tileentity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.infuse.InfuseObject;
|
||||
import mekanism.api.infuse.InfuseRegistry;
|
||||
|
@ -9,7 +10,6 @@ import mekanism.api.infuse.InfuseType;
|
|||
import mekanism.api.infuse.InfusionInput;
|
||||
import mekanism.api.infuse.InfusionOutput;
|
||||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IEjector;
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common.tileentity;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.common.transporter;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
import mekanism.common.transporter.TransporterStack.Path;
|
||||
|
|
|
@ -3,8 +3,8 @@ package mekanism.common.transporter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.TransporterPathfinder.Destination;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common.util;
|
||||
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
|
|
|
@ -12,9 +12,9 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.DynamicTankCache;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IFactory;
|
||||
|
|
|
@ -30,4 +30,83 @@ public final class StackUtils
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static List<ItemStack> even(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
if(getSize(stack1) == getSize(stack2) || Math.abs(getSize(stack1)-getSize(stack2)) == 1)
|
||||
{
|
||||
ret.add(stack1);
|
||||
ret.add(stack2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(getSize(stack1) > getSize(stack2))
|
||||
{
|
||||
int diff = getSize(stack1)-getSize(stack2);
|
||||
|
||||
List<ItemStack> split = split(size(stack1, diff));
|
||||
|
||||
ret.add(subtract(stack1, split.get(0)));
|
||||
ret.add(add(stack2, split.get(1)));
|
||||
}
|
||||
else if(getSize(stack2) > getSize(stack1))
|
||||
{
|
||||
int diff = getSize(stack2)-getSize(stack1);
|
||||
|
||||
List<ItemStack> split = split(size(stack2, diff));
|
||||
|
||||
ret.add(subtract(stack2, split.get(0)));
|
||||
ret.add(add(stack1, split.get(1)));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static ItemStack add(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if(stack1 == null)
|
||||
{
|
||||
return stack2;
|
||||
}
|
||||
else if(stack2 == null)
|
||||
{
|
||||
return stack1;
|
||||
}
|
||||
|
||||
return size(stack1, getSize(stack1)+getSize(stack2));
|
||||
}
|
||||
|
||||
public static ItemStack subtract(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if(stack1 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if(stack2 == null)
|
||||
{
|
||||
return stack1;
|
||||
}
|
||||
|
||||
return size(stack1, getSize(stack1)-getSize(stack2));
|
||||
}
|
||||
|
||||
public static ItemStack size(ItemStack stack, int size)
|
||||
{
|
||||
if(size <= 0 || stack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack ret = stack.copy();
|
||||
ret.stackSize = size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static int getSize(ItemStack stack)
|
||||
{
|
||||
return stack != null ? stack.stackSize : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mekanism.generators.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
|
|
|
@ -5,8 +5,8 @@ import ic2.api.item.ISpecialElectricItem;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.EnumColor;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.Mekanism;
|
||||
|
|
Loading…
Add table
Reference in a new issue