Tiered Bins, better tier management!

This commit is contained in:
aidancbrady 2016-03-16 21:41:55 -04:00
parent a5c5a093fa
commit 38a68541c4
35 changed files with 409 additions and 323 deletions

View file

@ -28,6 +28,7 @@ import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FluidTankTier;
import mekanism.common.base.IEnergyCube;
import mekanism.common.block.BlockBasic.BasicType;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.InventoryBin;
import mekanism.common.item.ItemAtomicDisassembler;
@ -162,18 +163,16 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glPopMatrix();
}
else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock2 && item.getItemDamage() == 3)
else if(BasicType.get(item) == BasicType.INDUCTION_CELL || BasicType.get(item) == BasicType.INDUCTION_PROVIDER)
{
MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item);
}
else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock2 && item.getItemDamage() == 4)
else if(BasicType.get(item) == BasicType.BIN)
{
GL11.glRotatef(270, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item);
}
else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock && item.getItemDamage() == 6)
{
RenderingRegistry.instance().renderInventoryBlock((RenderBlocks)data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID);
GL11.glRotatef(-270, 0.0F, 1.0F, 0.0F);
if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null)
{
return;

View file

@ -32,6 +32,7 @@ import mekanism.client.ClientTickHandler;
import mekanism.common.EnergyNetwork.EnergyTransferEvent;
import mekanism.common.FluidNetwork.FluidTransferEvent;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.BinTier;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.Tier.FluidTankTier;
@ -375,9 +376,6 @@ public class Mekanism
MachineType.LOGISTICAL_SORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 15), new Object[] {
"IPI", "ICI", "III", Character.valueOf('I'), "ingotIron", Character.valueOf('P'), Blocks.piston, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 6), new Object[] {
"SSS", "SCS", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC)
}));
MachineType.DIGITAL_MINER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 4), new Object[] {
"ACA", "SES", "TIT", Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('S'), new ItemStack(MekanismBlocks.MachineBlock, 1, 15), Character.valueOf('E'), MekanismItems.Robit.getUnchargedItem(),
Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore
@ -568,6 +566,20 @@ public class Mekanism
"AIA", "ITI", "AIA", Character.valueOf('I'), "ingotIron", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getEmptyFluidTank(FluidTankTier.ELITE)
}));
//Bin recipes
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.BASIC), new Object[] {
"SCS", "A A", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), "alloyBasic"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ADVANCED), new Object[] {
"SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('A'), "alloyAdvanced", Character.valueOf('B'), MekanismUtils.getBin(BinTier.BASIC)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ELITE), new Object[] {
"SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('A'), "alloyElite", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ADVANCED)
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ULTIMATE), new Object[] {
"SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ELITE)
}));
//Induction Cell recipes
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getInductionCell(InductionCellTier.BASIC), new Object[] {
"LTL", "TET", "LTL", Character.valueOf('T'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('E'), MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), Character.valueOf('L'), "dustLithium"
@ -1188,6 +1200,9 @@ public class Mekanism
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
//Register tier information
Tier.init();
File config = event.getSuggestedConfigurationFile();
//Set the mod's configuration

View file

@ -1,6 +1,10 @@
package mekanism.common;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import mekanism.api.EnumColor;
import mekanism.common.multipart.TransmitterType;
import mekanism.common.util.LangUtils;
@ -14,6 +18,10 @@ import codechicken.lib.colour.ColourRGBA;
*/
public final class Tier
{
private static List<ITier> tierTypes = new ArrayList<ITier>();
private static boolean initiated = false;
/** The default tiers used in Mekanism.
* @author aidancbrady
*/
@ -55,12 +63,7 @@ public final class Tier
}
}
/**
* The tiers used by the Energy Cube and their corresponding values.
* @author aidancbrady
*
*/
public static enum EnergyCubeTier
public static enum EnergyCubeTier implements ITier
{
BASIC(2000000, 800),
ADVANCED(8000000, 3200),
@ -73,6 +76,12 @@ public final class Tier
public double output;
private double baseOutput;
private EnergyCubeTier(double max, double out)
{
baseMaxEnergy = maxEnergy = max;
baseOutput = output = out;
}
public static EnergyCubeTier getFromName(String tierName)
{
@ -87,7 +96,8 @@ public final class Tier
return BASIC;
}
protected void loadConfig()
@Override
public void loadConfig()
{
if(this != CREATIVE)
{
@ -96,7 +106,8 @@ public final class Tier
}
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
if(this != CREATIVE)
{
@ -105,7 +116,8 @@ public final class Tier
}
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
if(this != CREATIVE)
{
@ -114,19 +126,14 @@ public final class Tier
}
}
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
private EnergyCubeTier(double max, double out)
{
baseMaxEnergy = maxEnergy = max;
baseOutput = output = out;
}
}
public static enum InductionCellTier
public static enum InductionCellTier implements ITier
{
BASIC(1E9D),
ADVANCED(8E9D),
@ -136,33 +143,37 @@ public final class Tier
public double maxEnergy;
private double baseMaxEnergy;
private InductionCellTier(double max)
{
baseMaxEnergy = maxEnergy = max;
}
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
protected void loadConfig()
@Override
public void loadConfig()
{
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionCellMaxEnergy", baseMaxEnergy).getDouble();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
maxEnergy = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(maxEnergy);
}
private InductionCellTier(double max)
{
baseMaxEnergy = maxEnergy = max;
}
}
public static enum InductionProviderTier
public static enum InductionProviderTier implements ITier
{
BASIC(64000),
ADVANCED(512000),
@ -172,37 +183,36 @@ public final class Tier
public double output;
private double baseOutput;
private InductionProviderTier(double out)
{
baseOutput = output = out;
}
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
protected void loadConfig()
@Override
public void loadConfig()
{
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionProviderOutput", baseOutput).getDouble();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
output = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(output);
}
private InductionProviderTier(double out)
{
baseOutput = output = out;
}
}
/**
* The tiers used by the Factory and their corresponding values.
* @author aidancbrady
*
*/
public static enum FactoryTier
{
BASIC(3, new ResourceLocation("mekanism", "gui/factory/GuiBasicFactory.png")),
@ -238,22 +248,12 @@ public final class Tier
}
}
/**
* The tiers used by Universal Cables and their corresponding values.
* @author aidancbrady
*
*/
public static enum CableTier
public static enum CableTier implements ITier
{
BASIC(3200, TransmitterType.UNIVERSAL_CABLE_BASIC),
ADVANCED(12800, TransmitterType.UNIVERSAL_CABLE_ADVANCED),
ELITE(64000, TransmitterType.UNIVERSAL_CABLE_ELITE),
ULTIMATE(320000, TransmitterType.UNIVERSAL_CABLE_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int cableCapacity;
private int baseCapacity;
@ -267,17 +267,26 @@ public final class Tier
type = transmitterType;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
cableCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "CableCapacity", baseCapacity).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
cableCapacity = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(cableCapacity);
}
@ -296,22 +305,12 @@ public final class Tier
}
}
/**
* The tiers used by Mechanical Pipes and their corresponding values.
* @author unpairedbracket
*
*/
public static enum PipeTier
public static enum PipeTier implements ITier
{
BASIC(1000, 100, TransmitterType.MECHANICAL_PIPE_BASIC),
ADVANCED(4000, 400, TransmitterType.MECHANICAL_PIPE_ADVANCED),
ELITE(16000, 1600, TransmitterType.MECHANICAL_PIPE_ELITE),
ULTIMATE(64000, 6400, TransmitterType.MECHANICAL_PIPE_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int pipeCapacity;
private int baseCapacity;
@ -328,20 +327,29 @@ public final class Tier
type = transmitterType;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
pipeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipeCapacity", baseCapacity).getInt();
pipePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipePullAmount", basePull).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
pipeCapacity = dataStream.readInt();
pipePullAmount = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(pipeCapacity);
dataStream.writeInt(pipePullAmount);
@ -360,23 +368,13 @@ public final class Tier
return BASIC;
}
}
/**
* The tiers used by Pressurized Tubes and their corresponding values.
* @author AidanBrady
*
*/
public static enum TubeTier
public static enum TubeTier implements ITier
{
BASIC(256, 64, TransmitterType.PRESSURIZED_TUBE_BASIC),
ADVANCED(1024, 256, TransmitterType.PRESSURIZED_TUBE_ADVANCED),
ELITE(4096, 1024, TransmitterType.PRESSURIZED_TUBE_ELITE),
ULTIMATE(16384, 4096, TransmitterType.PRESSURIZED_TUBE_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int tubeCapacity;
private int baseCapacity;
@ -393,20 +391,29 @@ public final class Tier
type = transmitterType;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
tubeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubeCapacity", baseCapacity).getInt();
tubePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubePullAmount", basePull).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
tubeCapacity = dataStream.readInt();
tubePullAmount = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(tubeCapacity);
dataStream.writeInt(tubePullAmount);
@ -426,22 +433,12 @@ public final class Tier
}
}
/**
* The tiers used by Logistical Transporters and their corresponding values.
* @author AidanBrady
*
*/
public static enum TransporterTier
public static enum TransporterTier implements ITier
{
BASIC(1, 5, TransmitterType.LOGISTICAL_TRANSPORTER_BASIC),
ADVANCED(16, 10, TransmitterType.LOGISTICAL_TRANSPORTER_ADVANCED),
ELITE(32, 20, TransmitterType.LOGISTICAL_TRANSPORTER_ELITE),
ULTIMATE(64, 50, TransmitterType.LOGISTICAL_TRANSPORTER_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int pullAmount;
private int basePull;
@ -458,20 +455,29 @@ public final class Tier
type = transmitterType;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
pullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterPullAmount", basePull).getInt();
speed = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterSpeed", baseSpeed).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
pullAmount = dataStream.readInt();
speed = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(pullAmount);
dataStream.writeInt(speed);
@ -491,17 +497,12 @@ public final class Tier
}
}
public static enum ConductorTier
public static enum ConductorTier implements ITier
{
BASIC(5, 1, 10, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_BASIC),
ADVANCED(5, 1, 400, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ADVANCED),
ELITE(5, 1, 8000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ELITE),
ULTIMATE(5, 1, 100000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public double inverseConduction;
private double baseConduction;
@ -526,22 +527,31 @@ public final class Tier
type = transmitterType;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
inverseConduction = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorInverseConduction", baseConduction).getDouble();
inverseHeatCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorHeatCapacity", baseHeatCapacity).getDouble();
inverseConductionInsulation = Mekanism.configuration.get("tier", getBaseTier().getName() + "ConductorConductionInsulation", baseConductionInsulation).getDouble();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
inverseConduction = dataStream.readDouble();
inverseHeatCapacity = dataStream.readDouble();
inverseConductionInsulation = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(inverseConduction);
dataStream.writeDouble(inverseHeatCapacity);
@ -562,17 +572,12 @@ public final class Tier
}
}
public static enum FluidTankTier
public static enum FluidTankTier implements ITier
{
BASIC(14000, 400),
ADVANCED(28000, 800),
ELITE(56000, 1600),
ULTIMATE(112000, 3200);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int storage;
private int baseStorage;
@ -586,41 +591,40 @@ public final class Tier
baseOutput = output = o;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "FluidTankStorage", baseStorage).getInt();
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "FluidTankOutput", baseOutput).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
storage = dataStream.readInt();
output = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(storage);
dataStream.writeInt(output);
}
}
/**
* The tiers used by Logistical Transporters and their corresponding values.
* @author AidanBrady
*
*/
public static enum GasTankTier
public static enum GasTankTier implements ITier
{
BASIC(64000, 256),
ADVANCED(128000, 512),
ELITE(256000, 1028),
ULTIMATE(512000, 2056);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int storage;
private int baseStorage;
@ -634,73 +638,105 @@ public final class Tier
baseOutput = output = o;
}
protected void loadConfig()
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "GasTankStorage", baseStorage).getInt();
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "GasTankOutput", baseOutput).getInt();
}
protected void readConfig(ByteBuf dataStream)
@Override
public void readConfig(ByteBuf dataStream)
{
storage = dataStream.readInt();
output = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(storage);
dataStream.writeInt(output);
}
}
public static enum BinTier implements ITier
{
BASIC(4096),
ADVANCED(8192),
ELITE(32768),
ULTIMATE(262144);
public int storage;
private int baseStorage;
private BinTier(int s)
{
baseStorage = storage = s;
}
@Override
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
@Override
public void loadConfig()
{
storage = Mekanism.configuration.get("tier", getBaseTier().getName() + "BinStorage", baseStorage).getInt();
}
@Override
public void readConfig(ByteBuf dataStream)
{
storage = dataStream.readInt();
}
@Override
public void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(storage);
}
}
public static void init()
{
if(initiated)
{
return;
}
for(Class c : Tier.class.getDeclaredClasses())
{
if(c.isEnum())
{
try {
for(Object obj : c.getEnumConstants())
{
if(obj instanceof ITier)
{
tierTypes.add((ITier)obj);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
initiated = true;
}
public static void loadConfig()
{
for(CableTier tier : CableTier.values())
{
tier.loadConfig();
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.loadConfig();
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.loadConfig();
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.loadConfig();
}
for(PipeTier tier : PipeTier.values())
{
tier.loadConfig();
}
for(TubeTier tier : TubeTier.values())
{
tier.loadConfig();
}
for(TransporterTier tier : TransporterTier.values())
{
tier.loadConfig();
}
for(ConductorTier tier : ConductorTier.values())
{
tier.loadConfig();
}
for(FluidTankTier tier : FluidTankTier.values())
{
tier.loadConfig();
}
for(GasTankTier tier : GasTankTier.values())
for(ITier tier : tierTypes)
{
tier.loadConfig();
}
@ -708,52 +744,7 @@ public final class Tier
public static void readConfig(ByteBuf dataStream)
{
for(CableTier tier : CableTier.values())
{
tier.readConfig(dataStream);
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.readConfig(dataStream);
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.readConfig(dataStream);
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.readConfig(dataStream);
}
for(PipeTier tier : PipeTier.values())
{
tier.readConfig(dataStream);
}
for(TubeTier tier : TubeTier.values())
{
tier.readConfig(dataStream);
}
for(TransporterTier tier : TransporterTier.values())
{
tier.readConfig(dataStream);
}
for(ConductorTier tier : ConductorTier.values())
{
tier.readConfig(dataStream);
}
for(FluidTankTier tier : FluidTankTier.values())
{
tier.readConfig(dataStream);
}
for(GasTankTier tier : GasTankTier.values())
for(ITier tier : tierTypes)
{
tier.readConfig(dataStream);
}
@ -761,54 +752,20 @@ public final class Tier
public static void writeConfig(ByteBuf dataStream)
{
for(CableTier tier : CableTier.values())
{
tier.writeConfig(dataStream);
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.writeConfig(dataStream);
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.writeConfig(dataStream);
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.writeConfig(dataStream);
}
for(PipeTier tier : PipeTier.values())
{
tier.writeConfig(dataStream);
}
for(TubeTier tier : TubeTier.values())
{
tier.writeConfig(dataStream);
}
for(TransporterTier tier : TransporterTier.values())
{
tier.writeConfig(dataStream);
}
for(ConductorTier tier : ConductorTier.values())
{
tier.writeConfig(dataStream);
}
for(FluidTankTier tier : FluidTankTier.values())
{
tier.writeConfig(dataStream);
}
for(GasTankTier tier : GasTankTier.values())
for(ITier tier : tierTypes)
{
tier.writeConfig(dataStream);
}
}
public static interface ITier
{
public BaseTier getBaseTier();
public void loadConfig();
public void readConfig(ByteBuf dataStream);
public void writeConfig(ByteBuf dataStream);
}
}

View file

@ -17,6 +17,7 @@ import mekanism.common.Tier.BaseTier;
import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock;
import mekanism.common.base.ITierItem;
import mekanism.common.content.tank.TankUpdateProtocol;
import mekanism.common.inventory.InventoryBin;
import mekanism.common.item.ItemBlockBasic;
@ -99,6 +100,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{
public IIcon[][] icons = new IIcon[16][16];
public IIcon[][] binIcons = new IIcon[16][16];
public CTMData[][] ctms = new CTMData[16][4];
@ -118,11 +120,15 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
@Override
public IIcon getIcon(ItemStack stack, int side)
{
if(getBlockFromItem(stack.getItem()) == MekanismBlocks.BasicBlock2 && stack.getItemDamage() == 3)
if(BasicType.get(stack) == BasicType.BIN)
{
return binIcons[((ItemBlockBasic)stack.getItem()).getBaseTier(stack).ordinal()][side];
}
else if(BasicType.get(stack) == BasicType.INDUCTION_CELL)
{
return icons[3][((ItemBlockBasic)stack.getItem()).getBaseTier(stack).ordinal()];
}
else if(getBlockFromItem(stack.getItem()) == MekanismBlocks.BasicBlock2 && stack.getItemDamage() == 4)
else if(BasicType.get(stack) == BasicType.INDUCTION_PROVIDER)
{
return icons[4][((ItemBlockBasic)stack.getItem()).getBaseTier(stack).ordinal()];
}
@ -176,9 +182,16 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
icons[3][0] = register.registerIcon("mekanism:CoalBlock");
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5][0] = register.registerIcon("mekanism:SteelBlock");
icons[6][0] = register.registerIcon(ICON_BASE);
MekanismRenderer.loadDynamicTextures(register, "Bin", icons[6], DefIcon.getActivePair(register.registerIcon("mekanism:BinSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinTop"), 0), new DefIcon(register.registerIcon("mekanism:BinTopOn"), 6));
MekanismRenderer.loadDynamicTextures(register, "BinBasic", binIcons[0], DefIcon.getActivePair(register.registerIcon("mekanism:BinBasicSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinBasicTop"), 0), new DefIcon(register.registerIcon("mekanism:BinBasicTopOn"), 6));
MekanismRenderer.loadDynamicTextures(register, "BinAdvanced", binIcons[1], DefIcon.getActivePair(register.registerIcon("mekanism:BinAdvancedSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinAdvancedTop"), 0), new DefIcon(register.registerIcon("mekanism:BinAdvancedTopOn"), 6));
MekanismRenderer.loadDynamicTextures(register, "BinElite", binIcons[2], DefIcon.getActivePair(register.registerIcon("mekanism:BinEliteSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinEliteTop"), 0), new DefIcon(register.registerIcon("mekanism:BinEliteTopOn"), 6));
MekanismRenderer.loadDynamicTextures(register, "BinUltimate", binIcons[3], DefIcon.getActivePair(register.registerIcon("mekanism:BinUltimateSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinUltimateTop"), 0), new DefIcon(register.registerIcon("mekanism:BinUltimateTopOn"), 6));
icons[7][0] = ctms[7][0].mainTextureData.icon;
icons[8][0] = register.registerIcon("mekanism:SteelCasing");
@ -243,10 +256,10 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
switch(meta)
{
case 6:
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
return binIcons[tileEntity.tier.ordinal()][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
case 14:
TileEntityThermalEvaporationController tileEntity1 = (TileEntityThermalEvaporationController)world.getTileEntity(x, y, z);
@ -289,8 +302,6 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case BASIC_BLOCK_1:
switch(meta)
{
case 6:
return icons[meta][side];
case 14:
if(side == 2)
{
@ -327,6 +338,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{
case INDUCTION_CELL:
case INDUCTION_PROVIDER:
case BIN:
for(BaseTier tier : BaseTier.values())
{
if(tier.isObtainable())
@ -492,7 +504,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
return true;
}
if(bin.getItemCount() < bin.MAX_STORAGE)
if(bin.getItemCount() < bin.tier.storage)
{
if(bin.addTicks == 0 && entityplayer.getCurrentEquippedItem() != null)
{
@ -509,7 +521,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
for(int i = 0; i < inv.length; i++)
{
if(bin.getItemCount() == bin.MAX_STORAGE)
if(bin.getItemCount() == bin.tier.storage)
{
break;
}
@ -821,8 +833,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
InventoryBin inv = new InventoryBin(ret);
((ITierItem)ret.getItem()).setBaseTier(ret, tileEntity.tier.getBaseTier());
inv.setItemCount(tileEntity.getItemCount());
if(tileEntity.getItemCount() > 0)
{
inv.setItemType(tileEntity.itemType);

View file

@ -1,14 +1,14 @@
package mekanism.common.inventory;
import mekanism.api.util.StackUtils;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.Tier.BinTier;
import mekanism.common.base.ITierItem;
import mekanism.common.block.BlockBasic.BasicType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class InventoryBin
{
public final int MAX_STORAGE = 4096;
public ItemStack bin;
public InventoryBin(ItemStack stack)
@ -44,23 +44,23 @@ public class InventoryBin
public ItemStack add(ItemStack stack)
{
if(isValid(stack) && getItemCount() != MAX_STORAGE)
if(isValid(stack) && getItemCount() != getMaxStorage())
{
if(getItemType() == null)
{
setItemType(stack);
}
if(getItemCount() + stack.stackSize <= MAX_STORAGE)
if(getItemCount() + stack.stackSize <= getMaxStorage())
{
setItemCount(getItemCount() + stack.stackSize);
return null;
}
else {
ItemStack rejects = getItemType().copy();
rejects.stackSize = (getItemCount()+stack.stackSize) - MAX_STORAGE;
rejects.stackSize = (getItemCount()+stack.stackSize) - getMaxStorage();
setItemCount(MAX_STORAGE);
setItemCount(getMaxStorage());
return rejects;
}
@ -76,7 +76,7 @@ public class InventoryBin
return false;
}
if(stack.getItem() instanceof ItemBlockBasic && stack.getItemDamage() == 6)
if(BasicType.get(stack) == BasicType.BIN)
{
return false;
}
@ -93,6 +93,11 @@ public class InventoryBin
return true;
}
public int getMaxStorage()
{
return BinTier.values()[((ITierItem)bin.getItem()).getBaseTier(bin).ordinal()].storage;
}
public int getItemCount()
{

View file

@ -13,6 +13,7 @@ import mekanism.client.MekanismKeyHandler;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.BinTier;
import mekanism.common.Tier.InductionCellTier;
import mekanism.common.Tier.InductionProviderTier;
import mekanism.common.base.ITierItem;
@ -240,6 +241,8 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
{
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
InventoryBin inv = new InventoryBin(stack);
tileEntity.tier = BinTier.values()[getBaseTier(stack).ordinal()];
if(inv.getItemType() != null)
{
@ -289,7 +292,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem, ITierIt
{
String name = getUnlocalizedName() + "." + BasicType.get(itemstack).name;
if(type == BasicType.INDUCTION_CELL || type == BasicType.INDUCTION_PROVIDER)
if(type == BasicType.BIN || type == BasicType.INDUCTION_CELL || type == BasicType.INDUCTION_PROVIDER)
{
name += getBaseTier(itemstack).getName();
}

View file

@ -10,6 +10,7 @@ import mekanism.api.Range4D;
import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.PacketHandler;
import mekanism.common.Tier.BinTier;
import mekanism.common.base.IActiveState;
import mekanism.common.base.ILogisticalTransporter;
import mekanism.common.base.ITransporterTile;
@ -44,8 +45,8 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
public int delayTicks;
public int cacheCount;
public final int MAX_STORAGE = 4096;
public BinTier tier = BinTier.BASIC;
public ItemStack itemType;
@ -69,7 +70,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
}
int count = getItemCount();
int remain = MAX_STORAGE-count;
int remain = tier.storage-count;
if(remain >= itemType.getMaxStackSize())
{
@ -117,23 +118,23 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
public ItemStack add(ItemStack stack)
{
if(isValid(stack) && getItemCount() != MAX_STORAGE)
if(isValid(stack) && getItemCount() != tier.storage)
{
if(itemType == null)
{
setItemType(stack);
}
if(getItemCount() + stack.stackSize <= MAX_STORAGE)
if(getItemCount() + stack.stackSize <= tier.storage)
{
setItemCount(getItemCount() + stack.stackSize);
return null;
}
else {
ItemStack rejects = itemType.copy();
rejects.stackSize = (getItemCount()+stack.stackSize) - MAX_STORAGE;
rejects.stackSize = (getItemCount()+stack.stackSize) - tier.storage;
setItemCount(MAX_STORAGE);
setItemCount(tier.storage);
return rejects;
}
@ -226,6 +227,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
nbtTags.setBoolean("isActive", isActive);
nbtTags.setInteger("itemCount", cacheCount);
nbtTags.setInteger("tier", tier.ordinal());
if(bottomStack != null)
{
@ -250,6 +252,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
isActive = nbtTags.getBoolean("isActive");
cacheCount = nbtTags.getInteger("itemCount");
tier = BinTier.values()[nbtTags.getInteger("tier")];
bottomStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("bottomStack"));
topStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("topStack"));
@ -267,6 +270,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
data.add(isActive);
data.add(getItemCount());
data.add(tier.ordinal());
if(getItemCount() > 0)
{
@ -283,6 +287,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
isActive = dataStream.readBoolean();
clientAmount = dataStream.readInt();
tier = BinTier.values()[dataStream.readInt()];
if(clientAmount > 0)
{
@ -424,7 +429,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
@Override
public String getInventoryName()
{
return LangUtils.localize("tile.BasicBlock.Bin.name");
return LangUtils.localize(getBlockType().getUnlocalizedName() + ".Bin" + tier.getBaseTier().getName() + ".name");
}
@Override
@ -558,7 +563,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
@Override
public int getMaxStoredCount()
{
return MAX_STORAGE;
return tier.storage;
}
@Override

View file

@ -32,6 +32,7 @@ import mekanism.common.MekanismBlocks;
import mekanism.common.MekanismItems;
import mekanism.common.OreDictCache;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.BinTier;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.Tier.FluidTankTier;
@ -367,6 +368,19 @@ public final class MekanismUtils
{
return ((ItemBlockBasic)new ItemStack(MekanismBlocks.BasicBlock2, 1, 4).getItem()).getUnchargedProvider(tier);
}
/**
* Retrieves an Bin with a defined tier.
* @param tier - tier to add to the Bin
* @return Bin with defined tier
*/
public static ItemStack getBin(BinTier tier)
{
ItemStack ret = new ItemStack(MekanismBlocks.BasicBlock, 1, 6);
((ItemBlockBasic)ret.getItem()).setBaseTier(ret, tier.getBaseTier());
return ret;
}
/**
* Retrieves an empty Gas Tank.

View file

@ -14,7 +14,9 @@ import mekanism.common.Upgrade;
import mekanism.common.base.IEnergyCube;
import mekanism.common.base.IFactory;
import mekanism.common.base.ITierItem;
import mekanism.common.block.BlockBasic.BasicType;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.InventoryBin;
import mekanism.common.recipe.ShapedMekanismRecipe;
import mekanism.common.recipe.ShapelessMekanismRecipe;
import net.minecraft.block.Block;
@ -25,6 +27,8 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.oredict.OreDictionary;
public class RecipeUtils
@ -169,6 +173,74 @@ public class RecipeUtils
((IGasItem)toReturn.getItem()).setGas(toReturn, gasFound);
}
}
if(toReturn.getItem() instanceof IFluidContainerItem)
{
FluidStack fluidFound = null;
for(int i = 0; i < 9; i++)
{
ItemStack itemstack = inv.getStackInSlot(i);
if(itemstack != null && itemstack.getItem() instanceof IFluidContainerItem)
{
FluidStack stored = ((IFluidContainerItem)itemstack.getItem()).getFluid(itemstack);
if(stored != null)
{
if(((IFluidContainerItem)toReturn.getItem()).fill(toReturn, stored, false) == 0)
{
return null;
}
if(fluidFound == null)
{
fluidFound = stored;
}
else {
if(fluidFound.getFluid() != stored.getFluid())
{
return null;
}
fluidFound.amount += stored.amount;
}
}
}
}
if(fluidFound != null)
{
fluidFound.amount = Math.min(((IFluidContainerItem)toReturn.getItem()).getCapacity(toReturn), fluidFound.amount);
((IFluidContainerItem)toReturn.getItem()).fill(toReturn, fluidFound, true);
}
}
if(BasicType.get(toReturn) == BasicType.BIN)
{
int foundCount = 0;
ItemStack foundType = null;
for(int i = 0; i < 9; i++)
{
ItemStack itemstack = inv.getStackInSlot(i);
if(BasicType.get(itemstack) == BasicType.BIN)
{
InventoryBin binInv = new InventoryBin(itemstack);
foundCount = binInv.getItemCount();
foundType = binInv.getItemType();
}
}
if(foundCount > 0 && foundType != null)
{
InventoryBin binInv = new InventoryBin(toReturn);
binInv.setItemCount(foundCount);
binInv.setItemType(foundType);
}
}
if(MachineType.get(toReturn) != null && MachineType.get(toReturn).supportsUpgrades)
{

View file

@ -84,7 +84,10 @@ tile.BasicBlock.RefinedObsidian.name=Refined Obsidian
tile.BasicBlock.CharcoalBlock.name=Charcoal Block
tile.BasicBlock.RefinedGlowstone.name=Refined Glowstone
tile.BasicBlock.SteelBlock.name=Steel Block
tile.BasicBlock.Bin.name=Bin
tile.BasicBlock.BinBasic.name=Basic Bin
tile.BasicBlock.BinAdvanced.name=Advanced Bin
tile.BasicBlock.BinElite.name=Elite Bin
tile.BasicBlock.BinUltimate.name=Ultimate Bin
tile.BasicBlock.TeleporterFrame.name=Teleporter Frame
tile.BasicBlock.SteelCasing.name=Steel Casing
tile.BasicBlock.DynamicTank.name=Dynamic Tank
@ -806,7 +809,7 @@ tooltip.SolarNeutronActivator=A machine that directs the neutron radiation of th
tooltip.Oredictionificator=A machine used to unify and translate between various items and blocks using the Ore Dictionary.
tooltip.Factory=A machine that serves as an upgrade to regular machinery, allowing for multiple processing operations to occur at once.
tooltip.ResistiveHeater=A condensed, coiled resistor capable of converting electrical energy directly into heat energy.
tooltip.FormulaicAssemblicator=A machine that uses energy to rapidly craft items and blocks from Recipe Formulas. Doubles as an advanced crafting bench.
tooltip.FormulaicAssemblicator=A machine that uses energy to rapidly craft items and blocks from Crafting Formulas. Doubles as an advanced crafting bench.
tooltip.HeatGenerator=A generator that uses the heat of lava or other burnable resources to produce energy.
tooltip.SolarGenerator=A generator that uses the power of the sun to produce energy.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB