Tiered Logistical Transporters

This commit is contained in:
Aidan C. Brady 2015-03-31 11:39:10 -04:00
parent 1a46bb5201
commit a5db67e2b7
26 changed files with 128 additions and 35 deletions

View file

@ -178,7 +178,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
GL11.glPushMatrix();
entityItem.setEntityItemStack(stack.itemStack);
float[] pos = TransporterUtils.getStackPosition(transporter, stack, partialTick*PartLogisticalTransporter.SPEED);
float[] pos = TransporterUtils.getStackPosition(transporter, stack, partialTick*transporter.tier.speed);
GL11.glTranslated(vec.x + pos[0], vec.y + pos[1] - entityItem.yOffset, vec.z + pos[2]);
GL11.glScalef(0.75F, 0.75F, 0.75F);

View file

@ -595,10 +595,19 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 9), new Object[] {
"SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 10), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 10), new Object[] {
"TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 9)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 11), new Object[] {
"TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 10)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 12), new Object[] {
"TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 11)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 13), new Object[] {
"SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 11), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 14), new Object[] {
"RRR", "SBS", "RRR", Character.valueOf('R'), "dustRedstone", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars
}));

View file

@ -247,4 +247,33 @@ public final class Tier
}
}
}
/**
* The tiers used by Logistical Transporters and their corresponding values.
* @author AidanBrady
*
*/
public static enum TransporterTier
{
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;
public int speed;
public TransmitterType type;
private TransporterTier(int pull, int s, TransmitterType transmitterType)
{
pullAmount = pull;
speed = s;
type = transmitterType;
}
}
}

View file

@ -31,9 +31,10 @@ public class MultipartMekanism implements IPartFactory
"mekanism:universal_cable_ultimate", "mekanism:mechanical_pipe",
"mekanism:mechanical_pipe_basic", "mekanism:mechanical_pipe_advanced",
"mekanism:mechanical_pipe_elite", "mekanism:mechanical_pipe_ultimate",
"mekanism:pressurized_tube", "mekanism:logistical_transporter",
"mekanism:restrictive_transporter", "mekanism:diversion_transporter",
"mekanism:heat_transmitter",
"mekanism:pressurized_tube", "mekanism:logistical_transporter_basic",
"mekanism:logistical_transporter_advanced", "mekanism:logistical_transporter_elite",
"mekanism:logistical_transporter_ultimate", "mekanism:restrictive_transporter",
"mekanism:diversion_transporter", "mekanism:heat_transmitter",
"mekanism:glow_panel"});
MultipartGenerator.registerPassThroughInterface("mekanism.api.IConfigurable");
@ -97,9 +98,21 @@ public class MultipartMekanism implements IPartFactory
{
return new PartPressurizedTube();
}
else if(name.equals("mekanism:logistical_transporter"))
else if(name.equals("mekanism:logistical_transporter_basic") || name.equals("mekanism:logistical_transporter"))
{
return new PartLogisticalTransporter();
return new PartLogisticalTransporter(Tier.TransporterTier.BASIC);
}
else if(name.equals("mekanism:logistical_transporter_advanced"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED);
}
else if(name.equals("mekanism:logistical_transporter_elite"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ELITE);
}
else if(name.equals("mekanism:logistical_transporter_ultimate"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE);
}
else if(name.equals("mekanism:restrictive_transporter"))
{

View file

@ -37,7 +37,19 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
@Override
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(2);
return transporterIcons.getCenterIcon(5);
}
@Override
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 14 : (color != null ? 11 : 10));
}
@Override
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 15 : (color != null ? 13 : 12));
}
@Override

View file

@ -15,6 +15,8 @@ import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.HashList;
import mekanism.common.InventoryNetwork;
import mekanism.common.Mekanism;
import mekanism.common.Tier;
import mekanism.common.Tier.TransporterTier;
import mekanism.common.base.ILogisticalTransporter;
import mekanism.common.content.transporter.InvStack;
import mekanism.common.content.transporter.PathfinderCache;
@ -39,15 +41,16 @@ import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.ForgeDirection;
import codechicken.lib.vec.Vector3;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork> implements ILogisticalTransporter
{
public static TransmitterIcons transporterIcons = new TransmitterIcons(5, 8);
public Tier.TransporterTier tier = TransporterTier.BASIC;
public static TransmitterIcons transporterIcons = new TransmitterIcons(8, 16);
public static final int SPEED = 5;
public int speed = 5;
public EnumColor color;
@ -56,17 +59,24 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
public HashList<TransporterStack> transit = new HashList<TransporterStack>();
public Set<TransporterStack> needsSync = new HashSet<TransporterStack>();
public PartLogisticalTransporter(Tier.TransporterTier transporterTier)
{
tier = transporterTier;
}
protected PartLogisticalTransporter() {}
@Override
public String getType()
{
return "mekanism:logistical_transporter";
return "mekanism:logistical_transporter_" + tier.name().toLowerCase();
}
@Override
public TransmitterType getTransmitter()
{
return TransmitterType.LOGISTICAL_TRANSPORTER;
return tier.type;
}
@Override
@ -77,9 +87,12 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
public static void registerIcons(IIconRegister register)
{
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporter", "RestrictiveTransporter", "DiversionTransporter", "LogisticalTransporterGlass", "LogisticalTransporterGlassColored"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVertical", "LogisticalTransporterHorizontal", "RestrictiveTransporterVertical", "RestrictiveTransporterHorizontal",
"LogisticalTransporterVerticalGlass", "LogisticalTransporterVerticalGlassColored", "LogisticalTransporterHorizontalGlass", "LogisticalTransporterHorizontalGlassColored"});
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporterBasic", "LogisticalTransporterAdvanced", "LogisticalTransporterElite", "LogisticalTransporterUltimate", "RestrictiveTransporter",
"DiversionTransporter", "LogisticalTransporterGlass", "LogisticalTransporterGlassColored"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVerticalBasic", "LogisticalTransporterVerticalAdvanced", "LogisticalTransporterVerticalElite", "LogisticalTransporterVerticalUltimate",
"LogisticalTransporterHorizontalBasic", "LogisticalTransporterHorizontalAdvanced", "LogisticalTransporterHorizontalElite", "LogisticalTransporterHorizontalUltimate", "RestrictiveTransporterVertical",
"RestrictiveTransporterHorizontal", "LogisticalTransporterVerticalGlass", "LogisticalTransporterVerticalGlassColored", "LogisticalTransporterHorizontalGlass", "LogisticalTransporterHorizontalGlassColored",
"DiversionTransporterVertical", "DiversionTransporterHorizontal"});
}
@Override
@ -119,19 +132,19 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
@Override
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(opaque ? 0 : (color != null ? 4 : 3));
return transporterIcons.getCenterIcon(opaque ? tier.ordinal() : (color != null ? 7 : 6));
}
@Override
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 0 : (color != null ? 5 : 4));
return transporterIcons.getSideIcon(opaque ? tier.ordinal() : (color != null ? 11 : 10));
}
@Override
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 1 : (color != null ? 7 : 6));
return transporterIcons.getSideIcon(opaque ? 4+tier.ordinal() : (color != null ? 13 : 12));
}
@Override
@ -157,7 +170,7 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
{
if(stack != null)
{
stack.progress = Math.min(100, stack.progress+SPEED);
stack.progress = Math.min(100, stack.progress+tier.speed);
}
}
}
@ -177,7 +190,7 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
}
}
stack.progress += SPEED;
stack.progress += tier.speed;
if(stack.progress > 100)
{
@ -337,7 +350,7 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
if(tile instanceof IInventory)
{
IInventory inv = (IInventory)tile;
InvStack stack = InventoryUtils.takeTopItem(inv, side.ordinal());
InvStack stack = InventoryUtils.takeTopItem(inv, side.ordinal(), tier.pullAmount);
if(stack != null && stack.getStack() != null)
{
@ -595,6 +608,8 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
public void load(NBTTagCompound nbtTags)
{
super.load(nbtTags);
tier = TransporterTier.values()[nbtTags.getInteger("tier")];
if(nbtTags.hasKey("color"))
{
@ -619,6 +634,8 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
public void save(NBTTagCompound nbtTags)
{
super.save(nbtTags);
nbtTags.setInteger("tier", tier.ordinal());
if(color != null)
{

View file

@ -29,6 +29,7 @@ import codechicken.lib.vec.Vector3;
public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements IFluidHandler
{
public Tier.PipeTier tier;
/** The fake tank used for fluid transfer calculations. */
public FluidTank dummyTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);

View file

@ -20,19 +20,19 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
@Override
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(1);
return transporterIcons.getCenterIcon(4);
}
@Override
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(2);
return transporterIcons.getSideIcon(8);
}
@Override
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(3);
return transporterIcons.getSideIcon(9);
}
@Override

View file

@ -111,8 +111,14 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return new PartMechanicalPipe(Tier.PipeTier.ULTIMATE);
case PRESSURIZED_TUBE:
return new PartPressurizedTube();
case LOGISTICAL_TRANSPORTER:
return new PartLogisticalTransporter();
case LOGISTICAL_TRANSPORTER_BASIC:
return new PartLogisticalTransporter(Tier.TransporterTier.BASIC);
case LOGISTICAL_TRANSPORTER_ADVANCED:
return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED);
case LOGISTICAL_TRANSPORTER_ELITE:
return new PartLogisticalTransporter(Tier.TransporterTier.ELITE);
case LOGISTICAL_TRANSPORTER_ULTIMATE:
return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE);
case RESTRICTIVE_TRANSPORTER:
return new PartRestrictiveTransporter();
case DIVERSION_TRANSPORTER:

View file

@ -15,9 +15,12 @@ public enum TransmitterType
MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 0, 0),
LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 0, 0, 3, 4),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, false, 1, 2),
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 2, 0, 3, 4),
LOGISTICAL_TRANSPORTER_BASIC("BasicLogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 0, 0, 6, 10),
LOGISTICAL_TRANSPORTER_ADVANCED("AdvancedLogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 1, 1, 6, 10),
LOGISTICAL_TRANSPORTER_ELITE("EliteLogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 2, 2, 6, 10),
LOGISTICAL_TRANSPORTER_ULTIMATE("UltimateLogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 3, 3, 6, 10),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, false, 4, 8),
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 5, 14, 6, 10),
HEAT_TRANSMITTER("HeatTransmitter", Size.SMALL, TransmissionType.HEAT, PartHeatTransmitter.heatIcons, false, 0, 0);
private String unlocalizedName;

View file

@ -197,7 +197,7 @@ public final class InventoryUtils
return inSlot.isItemEqual(toInsert) && ItemStack.areItemStackTagsEqual(inSlot, toInsert);
}
public static InvStack takeTopItem(IInventory inventory, int side)
public static InvStack takeTopItem(IInventory inventory, int side, int amount)
{
inventory = checkChestInv(inventory);
@ -208,7 +208,7 @@ public final class InventoryUtils
if(inventory.getStackInSlot(i) != null && inventory.getStackInSlot(i).stackSize > 0)
{
ItemStack toSend = inventory.getStackInSlot(i).copy();
toSend.stackSize = 1;
toSend.stackSize = Math.min(amount, toSend.stackSize);
return new InvStack(inventory, i, toSend);
}
@ -227,7 +227,7 @@ public final class InventoryUtils
if(sidedInventory.getStackInSlot(slotID) != null && sidedInventory.getStackInSlot(slotID).stackSize > 0)
{
ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy();
toSend.stackSize = 1;
toSend.stackSize = Math.min(amount, toSend.stackSize);
if(sidedInventory.canExtractItem(slotID, toSend, ForgeDirection.OPPOSITES[side]))
{

View file

@ -169,7 +169,10 @@ item.MultipartTransmitter.BasicMechanicalPipe.name=Basic Mechanical Pipe
item.MultipartTransmitter.AdvancedMechanicalPipe.name=Advanced Mechanical Pipe
item.MultipartTransmitter.EliteMechanicalPipe.name=Elite Mechanical Pipe
item.MultipartTransmitter.UltimateMechanicalPipe.name=Ultimate Mechanical Pipe
item.MultipartTransmitter.LogisticalTransporter.name=Logistical Transporter
item.MultipartTransmitter.BasicLogisticalTransporter.name=Basic Logistical Transporter
item.MultipartTransmitter.AdvancedLogisticalTransporter.name=Advanced Logistical Transporter
item.MultipartTransmitter.EliteLogisticalTransporter.name=Elite Logistical Transporter
item.MultipartTransmitter.UltimateLogisticalTransporter.name=Ultimate Logistical Transporter
item.MultipartTransmitter.RestrictiveTransporter.name=Restrictive Transporter
item.MultipartTransmitter.DiversionTransporter.name=Diversion Transporter

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB