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.EnergyCubeTier;
import mekanism.common.Tier.FluidTankTier; import mekanism.common.Tier.FluidTankTier;
import mekanism.common.base.IEnergyCube; import mekanism.common.base.IEnergyCube;
import mekanism.common.block.BlockBasic.BasicType;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.InventoryBin; import mekanism.common.inventory.InventoryBin;
import mekanism.common.item.ItemAtomicDisassembler; import mekanism.common.item.ItemAtomicDisassembler;
@ -162,17 +163,15 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glPopMatrix(); 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); 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); MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item);
} GL11.glRotatef(-270, 0.0F, 1.0F, 0.0F);
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);
if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null) if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null)
{ {

View file

@ -32,6 +32,7 @@ import mekanism.client.ClientTickHandler;
import mekanism.common.EnergyNetwork.EnergyTransferEvent; import mekanism.common.EnergyNetwork.EnergyTransferEvent;
import mekanism.common.FluidNetwork.FluidTransferEvent; import mekanism.common.FluidNetwork.FluidTransferEvent;
import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.BinTier;
import mekanism.common.Tier.EnergyCubeTier; import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier; import mekanism.common.Tier.FactoryTier;
import mekanism.common.Tier.FluidTankTier; 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[] { 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) "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[] { 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(), "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 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) "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 //Induction Cell recipes
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getInductionCell(InductionCellTier.BASIC), new Object[] { 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" "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 @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event)
{ {
//Register tier information
Tier.init();
File config = event.getSuggestedConfigurationFile(); File config = event.getSuggestedConfigurationFile();
//Set the mod's configuration //Set the mod's configuration

View file

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

View file

@ -17,6 +17,7 @@ import mekanism.common.Tier.BaseTier;
import mekanism.common.base.IActiveState; import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM; import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock; import mekanism.common.base.IBoundingBlock;
import mekanism.common.base.ITierItem;
import mekanism.common.content.tank.TankUpdateProtocol; import mekanism.common.content.tank.TankUpdateProtocol;
import mekanism.common.inventory.InventoryBin; import mekanism.common.inventory.InventoryBin;
import mekanism.common.item.ItemBlockBasic; import mekanism.common.item.ItemBlockBasic;
@ -99,6 +100,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{ {
public IIcon[][] icons = new IIcon[16][16]; public IIcon[][] icons = new IIcon[16][16];
public IIcon[][] binIcons = new IIcon[16][16];
public CTMData[][] ctms = new CTMData[16][4]; public CTMData[][] ctms = new CTMData[16][4];
@ -118,11 +120,15 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
@Override @Override
public IIcon getIcon(ItemStack stack, int side) 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()]; 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()]; 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[3][0] = register.registerIcon("mekanism:CoalBlock");
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone"); icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5][0] = register.registerIcon("mekanism:SteelBlock"); 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), MekanismRenderer.loadDynamicTextures(register, "BinBasic", binIcons[0], DefIcon.getActivePair(register.registerIcon("mekanism:BinBasicSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinTop"), 0), new DefIcon(register.registerIcon("mekanism:BinTopOn"), 6)); 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[7][0] = ctms[7][0].mainTextureData.icon;
icons[8][0] = register.registerIcon("mekanism:SteelCasing"); icons[8][0] = register.registerIcon("mekanism:SteelCasing");
@ -243,10 +256,10 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
switch(meta) switch(meta)
{ {
case 6: 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); 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: case 14:
TileEntityThermalEvaporationController tileEntity1 = (TileEntityThermalEvaporationController)world.getTileEntity(x, y, z); TileEntityThermalEvaporationController tileEntity1 = (TileEntityThermalEvaporationController)world.getTileEntity(x, y, z);
@ -289,8 +302,6 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case BASIC_BLOCK_1: case BASIC_BLOCK_1:
switch(meta) switch(meta)
{ {
case 6:
return icons[meta][side];
case 14: case 14:
if(side == 2) if(side == 2)
{ {
@ -327,6 +338,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{ {
case INDUCTION_CELL: case INDUCTION_CELL:
case INDUCTION_PROVIDER: case INDUCTION_PROVIDER:
case BIN:
for(BaseTier tier : BaseTier.values()) for(BaseTier tier : BaseTier.values())
{ {
if(tier.isObtainable()) if(tier.isObtainable())
@ -492,7 +504,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
return true; return true;
} }
if(bin.getItemCount() < bin.MAX_STORAGE) if(bin.getItemCount() < bin.tier.storage)
{ {
if(bin.addTicks == 0 && entityplayer.getCurrentEquippedItem() != null) 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++) for(int i = 0; i < inv.length; i++)
{ {
if(bin.getItemCount() == bin.MAX_STORAGE) if(bin.getItemCount() == bin.tier.storage)
{ {
break; break;
} }
@ -821,6 +833,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z); TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
InventoryBin inv = new InventoryBin(ret); InventoryBin inv = new InventoryBin(ret);
((ITierItem)ret.getItem()).setBaseTier(ret, tileEntity.tier.getBaseTier());
inv.setItemCount(tileEntity.getItemCount()); inv.setItemCount(tileEntity.getItemCount());
if(tileEntity.getItemCount() > 0) if(tileEntity.getItemCount() > 0)

View file

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

View file

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

View file

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

View file

@ -32,6 +32,7 @@ import mekanism.common.MekanismBlocks;
import mekanism.common.MekanismItems; import mekanism.common.MekanismItems;
import mekanism.common.OreDictCache; import mekanism.common.OreDictCache;
import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.BinTier;
import mekanism.common.Tier.EnergyCubeTier; import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier; import mekanism.common.Tier.FactoryTier;
import mekanism.common.Tier.FluidTankTier; import mekanism.common.Tier.FluidTankTier;
@ -368,6 +369,19 @@ public final class MekanismUtils
return ((ItemBlockBasic)new ItemStack(MekanismBlocks.BasicBlock2, 1, 4).getItem()).getUnchargedProvider(tier); 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. * Retrieves an empty Gas Tank.
* @return empty gas tank * @return empty gas tank

View file

@ -14,7 +14,9 @@ import mekanism.common.Upgrade;
import mekanism.common.base.IEnergyCube; import mekanism.common.base.IEnergyCube;
import mekanism.common.base.IFactory; import mekanism.common.base.IFactory;
import mekanism.common.base.ITierItem; import mekanism.common.base.ITierItem;
import mekanism.common.block.BlockBasic.BasicType;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.inventory.InventoryBin;
import mekanism.common.recipe.ShapedMekanismRecipe; import mekanism.common.recipe.ShapedMekanismRecipe;
import mekanism.common.recipe.ShapelessMekanismRecipe; import mekanism.common.recipe.ShapelessMekanismRecipe;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -25,6 +27,8 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class RecipeUtils public class RecipeUtils
@ -170,6 +174,74 @@ public class RecipeUtils
} }
} }
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) if(MachineType.get(toReturn) != null && MachineType.get(toReturn).supportsUpgrades)
{ {
Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>(); Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>();

View file

@ -84,7 +84,10 @@ tile.BasicBlock.RefinedObsidian.name=Refined Obsidian
tile.BasicBlock.CharcoalBlock.name=Charcoal Block tile.BasicBlock.CharcoalBlock.name=Charcoal Block
tile.BasicBlock.RefinedGlowstone.name=Refined Glowstone tile.BasicBlock.RefinedGlowstone.name=Refined Glowstone
tile.BasicBlock.SteelBlock.name=Steel Block 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.TeleporterFrame.name=Teleporter Frame
tile.BasicBlock.SteelCasing.name=Steel Casing tile.BasicBlock.SteelCasing.name=Steel Casing
tile.BasicBlock.DynamicTank.name=Dynamic Tank 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.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.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.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.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. 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