Tiered UniCables. Pending recipes and capacity balance. Other limitations may be imposed on low-tier cables if we think of any.
This commit is contained in:
parent
b299ad436d
commit
d0f64ebc11
4 changed files with 65 additions and 19 deletions
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common.multipart;
|
||||
|
||||
import mekanism.common.multipart.PartUniversalCable.CableTier;
|
||||
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.MultipartGenerator;
|
||||
|
@ -14,7 +16,10 @@ public class MultipartMekanism implements IPartFactory
|
|||
|
||||
public void init()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, new String[] {"mekanism:universal_cable", "mekanism:mechanical_pipe", "mekanism:pressurized_tube", "mekanism:logistical_transporter",
|
||||
MultiPartRegistry.registerParts(this, new String[] {"mekanism:universal_cable_basic",
|
||||
"mekanism:universal_cable_advanced", "mekanism:universal_cable_elite",
|
||||
"mekanism:universal_cable_ultimate", "mekanism:mechanical_pipe",
|
||||
"mekanism:pressurized_tube", "mekanism:logistical_transporter",
|
||||
"mekanism:restrictive_transporter", "mekanism:diversion_transporter"});
|
||||
|
||||
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter");
|
||||
|
@ -34,7 +39,23 @@ public class MultipartMekanism implements IPartFactory
|
|||
{
|
||||
if(name.equals("mekanism:universal_cable"))
|
||||
{
|
||||
return new PartUniversalCable();
|
||||
return new PartUniversalCable(CableTier.BASIC);
|
||||
}
|
||||
else if(name.equals("mekanism:universal_cable_basic"))
|
||||
{
|
||||
return new PartUniversalCable(CableTier.BASIC);
|
||||
}
|
||||
else if(name.equals("mekanism:universal_cable_advanced"))
|
||||
{
|
||||
return new PartUniversalCable(CableTier.ADVANCED);
|
||||
}
|
||||
else if(name.equals("mekanism:universal_cable_elite"))
|
||||
{
|
||||
return new PartUniversalCable(CableTier.ELITE);
|
||||
}
|
||||
else if(name.equals("mekanism:universal_cable_ultimate"))
|
||||
{
|
||||
return new PartUniversalCable(CableTier.ULTIMATE);
|
||||
}
|
||||
else if(name.equals("mekanism:mechanical_pipe"))
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.multipart.PartUniversalCable.CableTier;
|
||||
import mekanism.common.multipart.TransmitterType.Size;
|
||||
import mekanism.common.network.PacketTransmitterUpdate;
|
||||
import mekanism.common.network.PacketTransmitterUpdate.PacketType;
|
||||
|
@ -95,8 +96,14 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
|||
{
|
||||
switch(type)
|
||||
{
|
||||
case UNIVERSAL_CABLE:
|
||||
return new PartUniversalCable();
|
||||
case UNIVERSAL_CABLE_BASIC:
|
||||
return new PartUniversalCable(CableTier.BASIC);
|
||||
case UNIVERSAL_CABLE_ADVANCED:
|
||||
return new PartUniversalCable(CableTier.ADVANCED);
|
||||
case UNIVERSAL_CABLE_ELITE:
|
||||
return new PartUniversalCable(CableTier.ELITE);
|
||||
case UNIVERSAL_CABLE_ULTIMATE:
|
||||
return new PartUniversalCable(CableTier.ULTIMATE);
|
||||
case MECHANICAL_PIPE:
|
||||
return new PartMechanicalPipe();
|
||||
case PRESSURIZED_TUBE:
|
||||
|
|
|
@ -33,6 +33,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implements IStrictEnergyAcceptor, IEnergySink, IEnergyHandler, IPowerReceptor
|
||||
{
|
||||
public CableTier tier;
|
||||
|
||||
/** A fake power handler used to initiate energy transfer calculations. */
|
||||
public PowerHandler powerHandler;
|
||||
|
||||
|
@ -43,8 +45,9 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
public double cacheEnergy = 0;
|
||||
public double lastWrite = 0;
|
||||
|
||||
public PartUniversalCable()
|
||||
public PartUniversalCable(CableTier cableTier)
|
||||
{
|
||||
tier = cableTier;
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
powerHandler.configure(0, 0, 0, 0);
|
||||
|
@ -84,7 +87,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
@Override
|
||||
public TransmitterType getTransmitter()
|
||||
{
|
||||
return TransmitterType.UNIVERSAL_CABLE;
|
||||
return tier.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,6 +96,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
super.load(nbtTags);
|
||||
|
||||
cacheEnergy = nbtTags.getDouble("cacheEnergy");
|
||||
tier = CableTier.values()[nbtTags.getInteger("tier")];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,12 +108,13 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
|
||||
lastWrite = toSave;
|
||||
nbtTags.setDouble("cacheEnergy", toSave);
|
||||
nbtTags.setInteger("tier", tier.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "mekanism:universal_cable";
|
||||
return "mekanism:universal_cable_" + tier.name().toLowerCase();
|
||||
}
|
||||
|
||||
public static void registerIcons(IconRegister register)
|
||||
|
@ -310,7 +315,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return 10000;
|
||||
return tier.cableCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -391,4 +396,21 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
|||
reconfigure();
|
||||
}
|
||||
}
|
||||
|
||||
public static enum CableTier
|
||||
{
|
||||
BASIC(500, TransmitterType.UNIVERSAL_CABLE_BASIC),
|
||||
ADVANCED(2000, TransmitterType.UNIVERSAL_CABLE_ADVANCED),
|
||||
ELITE(8000, TransmitterType.UNIVERSAL_CABLE_ELITE),
|
||||
ULTIMATE(32000, TransmitterType.UNIVERSAL_CABLE_ULTIMATE);
|
||||
|
||||
int cableCapacity;
|
||||
TransmitterType type;
|
||||
|
||||
private CableTier(int capacity, TransmitterType transmitterType)
|
||||
{
|
||||
cableCapacity = capacity;
|
||||
type = transmitterType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,19 +5,20 @@ import mekanism.api.transmitters.TransmissionType;
|
|||
|
||||
public enum TransmitterType
|
||||
{
|
||||
UNIVERSAL_CABLE("UniversalCable", Size.SMALL, TransmissionType.ENERGY),
|
||||
UNIVERSAL_CABLE_BASIC("BasicUniversalCable", Size.SMALL, TransmissionType.ENERGY),
|
||||
MECHANICAL_PIPE("MechanicalPipe", Size.LARGE, TransmissionType.FLUID),
|
||||
PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS),
|
||||
LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM),
|
||||
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM),
|
||||
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM);
|
||||
|
||||
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM),
|
||||
UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", Size.SMALL, TransmissionType.ENERGY),
|
||||
UNIVERSAL_CABLE_ELITE("EliteUniversalCable", Size.SMALL, TransmissionType.ENERGY),
|
||||
UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", Size.SMALL, TransmissionType.ENERGY);
|
||||
|
||||
private String unlocalizedName;
|
||||
private Size size;
|
||||
private TransmissionType transmissionType;
|
||||
|
||||
public static TransmitterType[] oldMetaArray = {PRESSURIZED_TUBE, UNIVERSAL_CABLE, MECHANICAL_PIPE, LOGISTICAL_TRANSPORTER, RESTRICTIVE_TRANSPORTER, DIVERSION_TRANSPORTER};
|
||||
|
||||
|
||||
private TransmitterType(String name, Size s, TransmissionType type)
|
||||
{
|
||||
unlocalizedName = name;
|
||||
|
@ -52,9 +53,4 @@ public enum TransmitterType
|
|||
centerSize = size;
|
||||
}
|
||||
}
|
||||
|
||||
public static TransmitterType fromOldMeta(int meta)
|
||||
{
|
||||
return oldMetaArray[meta];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue