Neatened up Diversion Transporter code
This commit is contained in:
parent
a848b11582
commit
a27582971b
14 changed files with 294 additions and 261 deletions
|
@ -82,7 +82,7 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
|
|||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tileentity.TileEntityFactory;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
|
@ -250,8 +250,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad", new RenderChargepad());
|
||||
ClientRegistry.registerTileEntity(TileEntityLogisticalTransporter.class, "LogisticalTransporter", new RenderLogisticalTransporter());
|
||||
|
||||
ClientRegistry.registerTileEntity(TileEntityDivertionTransporter.class, "LogisticalDiverter", new RenderLogisticalTransporter());
|
||||
ClientRegistry.registerTileEntity(TileEntityDiversionTransporter.class, "DiversionTransporter", new RenderLogisticalTransporter());
|
||||
ClientRegistry.registerTileEntity(TileEntityLogisticalSorter.class, "LogisticalSorter", new RenderLogisticalSorter());
|
||||
ClientRegistry.registerTileEntity(TileEntityBin.class, "Bin", new RenderBin());
|
||||
ClientRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner", new RenderDigitalMiner());
|
||||
|
|
|
@ -49,7 +49,7 @@ public class TransmitterRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RestrictiveTransporter.png"));
|
||||
break;
|
||||
case 5:
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalDiverter.png"));
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "DiversionTransporter.png"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
|||
}
|
||||
else if(meta == 5)
|
||||
{
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalDiverter.png"));
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "DiversionTransporter.png"));
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
|
|
@ -38,7 +38,7 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
|
|||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tileentity.TileEntityFactory;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
|
@ -91,8 +91,7 @@ public class CommonProxy
|
|||
GameRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve");
|
||||
GameRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad");
|
||||
GameRegistry.registerTileEntity(TileEntityLogisticalTransporter.class, "LogisticalTransporter");
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityDivertionTransporter.class, "LogisticalDiverter");
|
||||
GameRegistry.registerTileEntity(TileEntityDiversionTransporter.class, "DiversionTransporter");
|
||||
GameRegistry.registerTileEntity(TileEntityLogisticalSorter.class, "LogisticalSorter");
|
||||
GameRegistry.registerTileEntity(TileEntityBin.class, "Bin");
|
||||
GameRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner");
|
||||
|
|
|
@ -9,7 +9,7 @@ import mekanism.api.transmitters.ITransmitter;
|
|||
import mekanism.client.ClientProxy;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PipeUtils;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.tileentity.TileEntityPressurizedTube;
|
||||
|
@ -242,7 +242,7 @@ public class BlockTransmitter extends Block
|
|||
{
|
||||
connectable = PipeUtils.getConnections(tileEntity);
|
||||
}
|
||||
else if(world.getBlockMetadata(x, y, z) == 3 || world.getBlockMetadata(x, y, z) == 4||world.getBlockMetadata(x, y, z) == 5)
|
||||
else if(world.getBlockMetadata(x, y, z) == 3 || world.getBlockMetadata(x, y, z) == 4 || world.getBlockMetadata(x, y, z) == 5)
|
||||
{
|
||||
connectable = TransporterUtils.getConnections((TileEntityLogisticalTransporter)tileEntity);
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ public class BlockTransmitter extends Block
|
|||
return new TileEntityLogisticalTransporter();
|
||||
|
||||
case 5:
|
||||
return new TileEntityDivertionTransporter();
|
||||
return new TileEntityDiversionTransporter();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ItemBlockTransmitter extends ItemBlock
|
|||
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
|
||||
list.add("- " + EnumColor.PURPLE + "Items (universal)");
|
||||
list.add("- " + EnumColor.PURPLE + "Blocks (universal)");
|
||||
list.add("- " + EnumColor.DARK_RED + "Controlable by redstone");
|
||||
list.add("- " + EnumColor.DARK_RED + "Controllable by redstone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import mekanism.common.tileentity.TileEntityBin;
|
|||
import mekanism.common.tileentity.TileEntityContainerBlock;
|
||||
import mekanism.common.tileentity.TileEntityElectricChest;
|
||||
import mekanism.common.tileentity.TileEntityElectricPump;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -72,34 +72,38 @@ public class ItemConfigurator extends ItemEnergized
|
|||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
//Player can access color by sneaking
|
||||
if(world.getBlockTileEntity(x, y, z) instanceof TileEntityDivertionTransporter){
|
||||
TileEntityDivertionTransporter transporter = (TileEntityDivertionTransporter)world.getBlockTileEntity(x, y, z);
|
||||
int newMode=(transporter.modes[side]+1)%3;
|
||||
transporter.modes[side]=newMode;
|
||||
String description="ERROR";
|
||||
switch(newMode){
|
||||
case 0:
|
||||
description="Always active";
|
||||
break;
|
||||
case 1:
|
||||
description="Active with signal";
|
||||
break;
|
||||
case 2:
|
||||
description="Active without signal";
|
||||
break;
|
||||
}
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + "Diverter mode changed to: "+EnumColor.RED+description));
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(transporter), transporter.getNetworkedData(new ArrayList())), Object3D.get(transporter), 50D);
|
||||
if(world.getBlockTileEntity(x, y, z) instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
TileEntityDiversionTransporter transporter = (TileEntityDiversionTransporter)world.getBlockTileEntity(x, y, z);
|
||||
int newMode = (transporter.modes[side] + 1) % 3;
|
||||
String description = "ERROR";
|
||||
|
||||
return true;
|
||||
}else{
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)world.getBlockTileEntity(x, y, z);
|
||||
TransporterUtils.incrementColor(transporter);
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(transporter), transporter.getNetworkedData(new ArrayList())), Object3D.get(transporter), 50D);
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + (transporter.color != null ? transporter.color.getName() : EnumColor.BLACK + "None")));
|
||||
return true;
|
||||
}
|
||||
transporter.modes[side] = newMode;
|
||||
|
||||
switch(newMode)
|
||||
{
|
||||
case 0:
|
||||
description = "Always active";
|
||||
break;
|
||||
case 1:
|
||||
description = "Active with signal";
|
||||
break;
|
||||
case 2:
|
||||
description = "Active without signal";
|
||||
break;
|
||||
}
|
||||
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Diverter mode changed to: " + EnumColor.RED + description));
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(transporter), transporter.getNetworkedData(new ArrayList())), Object3D.get(transporter), 50D);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)world.getBlockTileEntity(x, y, z);
|
||||
TransporterUtils.incrementColor(transporter);
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(transporter), transporter.getNetworkedData(new ArrayList())), Object3D.get(transporter), 50D);
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + (transporter.color != null ? transporter.color.getName() : EnumColor.BLACK + "None")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityBin)
|
||||
{
|
||||
|
|
|
@ -10,13 +10,14 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
public class MItemStackFilter extends MinerFilter
|
||||
{
|
||||
public ItemStack itemType;
|
||||
public MItemStackFilter(ItemStack item){
|
||||
super();
|
||||
this.itemType=item;
|
||||
}
|
||||
public MItemStackFilter(){
|
||||
super();
|
||||
|
||||
public MItemStackFilter(ItemStack item)
|
||||
{
|
||||
itemType = item;
|
||||
}
|
||||
|
||||
public MItemStackFilter() {}
|
||||
|
||||
@Override
|
||||
public boolean canFilter(ItemStack itemStack)
|
||||
{
|
||||
|
|
|
@ -1078,138 +1078,148 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
public String getType()
|
||||
{
|
||||
return "Digital Miner";
|
||||
}
|
||||
public String[] names =
|
||||
{
|
||||
"setRadius",
|
||||
"setMin",
|
||||
"setMax",
|
||||
"setReplace",
|
||||
"addFilter",
|
||||
"removeFilter",
|
||||
"addOreFilter",
|
||||
"removeOreFilter"
|
||||
};
|
||||
|
||||
public String[] names = {"setRadius", "setMin", "setMax", "setReplace", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter"};
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws Exception {
|
||||
if(arguments.length>0)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
if(arguments[0] instanceof Double)
|
||||
{
|
||||
num = ((Double)arguments[0]).intValue();
|
||||
}
|
||||
if(arguments[0] instanceof String&&(method!=6&&method!=7))
|
||||
{
|
||||
num = Integer.parseInt((String)arguments[0]);
|
||||
}
|
||||
|
||||
if(num!=0)
|
||||
{
|
||||
if(method==0)
|
||||
{
|
||||
this.radius=num;
|
||||
}
|
||||
if(method==1)
|
||||
{
|
||||
this.minY=num;
|
||||
}
|
||||
if(method==2)
|
||||
{
|
||||
this.maxY=num;
|
||||
}
|
||||
if(method==3){
|
||||
//replace
|
||||
int meta=0;
|
||||
if(arguments.length>1){
|
||||
if(arguments[1] instanceof Double)
|
||||
{
|
||||
num = ((Double)arguments[1]).intValue();
|
||||
}
|
||||
if(arguments[1] instanceof String)
|
||||
{
|
||||
meta = Integer.parseInt((String)arguments[1]);
|
||||
}
|
||||
}
|
||||
this.replaceStack=new ItemStack(num,1,meta);
|
||||
}
|
||||
if(method==4){
|
||||
int meta=0;
|
||||
|
||||
if(arguments.length>1){
|
||||
if(arguments[1] instanceof Double)
|
||||
{
|
||||
meta = ((Double)arguments[1]).intValue();
|
||||
}
|
||||
if(arguments[1] instanceof String)
|
||||
{
|
||||
meta = Integer.parseInt((String)arguments[1]);
|
||||
}
|
||||
}
|
||||
this.filters.add(new MItemStackFilter(new ItemStack(num,1,meta)));
|
||||
}
|
||||
if(method==5){
|
||||
Iterator<MinerFilter> iter=this.filters.iterator();
|
||||
while(iter.hasNext()){
|
||||
MinerFilter filter=iter.next();
|
||||
if(filter instanceof MItemStackFilter){
|
||||
if(((MItemStackFilter) filter).itemType.itemID==num){
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(method==6){
|
||||
String ore=(String) arguments[0];
|
||||
MOreDictFilter filter=new MOreDictFilter();
|
||||
filter.oreDictName=ore;
|
||||
filters.add(filter);
|
||||
}
|
||||
if(method==7){
|
||||
|
||||
String ore=(String) arguments[0];
|
||||
Iterator<MinerFilter> iter=this.filters.iterator();
|
||||
while(iter.hasNext()){
|
||||
MinerFilter filter=iter.next();
|
||||
if(filter instanceof MOreDictFilter){
|
||||
if(((MOreDictFilter) filter).oreDictName==ore){
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
if(arguments.length > 0)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
if(arguments[0] instanceof Double)
|
||||
{
|
||||
num = ((Double)arguments[0]).intValue();
|
||||
}
|
||||
else if(arguments[0] instanceof String && (method != 6 && method != 7))
|
||||
{
|
||||
num = Integer.parseInt((String)arguments[0]);
|
||||
}
|
||||
|
||||
if(num != 0)
|
||||
{
|
||||
if(method == 0)
|
||||
{
|
||||
radius = num;
|
||||
}
|
||||
else if(method == 1)
|
||||
{
|
||||
minY = num;
|
||||
}
|
||||
else if(method == 2)
|
||||
{
|
||||
maxY = num;
|
||||
}
|
||||
else if(method == 3)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if(arguments.length > 1)
|
||||
{
|
||||
if(arguments[1] instanceof Double)
|
||||
{
|
||||
num = ((Double)arguments[1]).intValue();
|
||||
}
|
||||
else if(arguments[1] instanceof String)
|
||||
{
|
||||
meta = Integer.parseInt((String)arguments[1]);
|
||||
}
|
||||
}
|
||||
|
||||
replaceStack = new ItemStack(num, 1, meta);
|
||||
}
|
||||
else if(method == 4)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
if(arguments.length > 1)
|
||||
{
|
||||
if(arguments[1] instanceof Double)
|
||||
{
|
||||
meta = ((Double)arguments[1]).intValue();
|
||||
}
|
||||
else if(arguments[1] instanceof String)
|
||||
{
|
||||
meta = Integer.parseInt((String)arguments[1]);
|
||||
}
|
||||
}
|
||||
|
||||
filters.add(new MItemStackFilter(new ItemStack(num, 1, meta)));
|
||||
}
|
||||
else if(method == 5)
|
||||
{
|
||||
Iterator<MinerFilter> iter = filters.iterator();
|
||||
|
||||
while(iter.hasNext())
|
||||
{
|
||||
MinerFilter filter = iter.next();
|
||||
|
||||
if(filter instanceof MItemStackFilter)
|
||||
{
|
||||
if(((MItemStackFilter)filter).itemType.itemID == num)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(method == 6)
|
||||
{
|
||||
String ore = (String)arguments[0];
|
||||
MOreDictFilter filter = new MOreDictFilter();
|
||||
|
||||
filter.oreDictName = ore;
|
||||
filters.add(filter);
|
||||
}
|
||||
else if(method == 7)
|
||||
{
|
||||
String ore = (String)arguments[0];
|
||||
Iterator<MinerFilter> iter = filters.iterator();
|
||||
|
||||
while(iter.hasNext())
|
||||
{
|
||||
MinerFilter filter = iter.next();
|
||||
|
||||
if(filter instanceof MOreDictFilter)
|
||||
{
|
||||
if(((MOreDictFilter)filter).oreDictName == ore)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Object3D.get(this), getGenericPacket(new ArrayList())), player);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAttachToSide(int side) {
|
||||
public boolean canAttachToSide(int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer) {
|
||||
|
||||
}
|
||||
|
||||
public void attach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {
|
||||
|
||||
}
|
||||
public void detach(IComputerAccess computer) {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class TileEntityDiversionTransporter extends TileEntityLogisticalTransporter
|
||||
{
|
||||
public int[] modes = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
modes = nbtTags.getIntArray("modes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setIntArray("modes", modes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
modes[0] = dataStream.readInt();
|
||||
modes[1] = dataStream.readInt();
|
||||
modes[2] = dataStream.readInt();
|
||||
modes[3] = dataStream.readInt();
|
||||
modes[4] = dataStream.readInt();
|
||||
modes[5] = dataStream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
data = super.getNetworkedData(data);
|
||||
|
||||
data.add(modes[0]);
|
||||
data.add(modes[1]);
|
||||
data.add(modes[2]);
|
||||
data.add(modes[3]);
|
||||
data.add(modes[4]);
|
||||
data.add(modes[5]);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getSyncPacket(TransporterStack stack, boolean kill)
|
||||
{
|
||||
ArrayList data = super.getSyncPacket(stack, kill);
|
||||
|
||||
data.add(modes[0]);
|
||||
data.add(modes[1]);
|
||||
data.add(modes[2]);
|
||||
data.add(modes[3]);
|
||||
data.add(modes[4]);
|
||||
data.add(modes[5]);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class TileEntityDivertionTransporter extends TileEntityLogisticalTransporter {
|
||||
|
||||
public int[] modes={0,0,0,0,0,0};
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
modes=nbtTags.getIntArray("modes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
nbtTags.setIntArray("modes", modes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
modes[0]=dataStream.readInt();
|
||||
modes[1]=dataStream.readInt();
|
||||
modes[2]=dataStream.readInt();
|
||||
modes[3]=dataStream.readInt();
|
||||
modes[4]=dataStream.readInt();
|
||||
modes[5]=dataStream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
data=super.getNetworkedData(data);
|
||||
data.add(modes[0]);
|
||||
data.add(modes[1]);
|
||||
data.add(modes[2]);
|
||||
data.add(modes[3]);
|
||||
data.add(modes[4]);
|
||||
data.add(modes[5]);
|
||||
return data;
|
||||
}
|
||||
|
||||
public ArrayList getSyncPacket(TransporterStack stack, boolean kill)
|
||||
{
|
||||
ArrayList data=super.getSyncPacket(stack, kill);
|
||||
data.add(modes[0]);
|
||||
data.add(modes[1]);
|
||||
data.add(modes[2]);
|
||||
data.add(modes[3]);
|
||||
data.add(modes[4]);
|
||||
data.add(modes[5]);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.TransporterPathfinder.Pathfinder.DestChecker;
|
||||
|
@ -184,19 +184,26 @@ public final class TransporterPathfinder
|
|||
|
||||
if(tile != null)
|
||||
{
|
||||
//Check for logistical Diverter
|
||||
TileEntity currTile = pointer.getTileEntity(worldObj);
|
||||
if(currTile instanceof TileEntityDivertionTransporter){
|
||||
int mode=((TileEntityDivertionTransporter) currTile).modes[side.ordinal()];
|
||||
boolean redstone=currTile.worldObj.isBlockIndirectlyGettingPowered(currTile.xCoord, currTile.yCoord,currTile.zCoord);
|
||||
if((mode==2&&redstone==true)||(mode==1&&redstone==false)){
|
||||
|
||||
if(currTile instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)currTile).modes[side.ordinal()];
|
||||
boolean redstone = currTile.worldObj.isBlockIndirectlyGettingPowered(currTile.xCoord, currTile.yCoord, currTile.zCoord);
|
||||
|
||||
if((mode == 2 && redstone == true) || (mode == 1 && redstone == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(tile instanceof TileEntityDivertionTransporter){
|
||||
int mode=((TileEntityDivertionTransporter) tile).modes[side.ordinal()];
|
||||
boolean redstone=tile.worldObj.isBlockIndirectlyGettingPowered(tile.xCoord, tile.yCoord,tile.zCoord);
|
||||
if((mode==2&&redstone==true)||(mode==1&&redstone==false)){
|
||||
|
||||
if(tile instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)tile).modes[side.ordinal()];
|
||||
boolean redstone = tile.worldObj.isBlockIndirectlyGettingPowered(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
|
||||
if((mode == 2 && redstone == true) || (mode == 1 && redstone == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import mekanism.api.IConfigurable;
|
|||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
import mekanism.common.tileentity.TileEntityDivertionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
|
@ -85,18 +85,21 @@ public final class TransporterUtils
|
|||
|
||||
for(IInventory inventory : connectedInventories)
|
||||
{
|
||||
|
||||
if(inventory != null)
|
||||
{
|
||||
|
||||
{
|
||||
int side = Arrays.asList(connectedInventories).indexOf(inventory);
|
||||
if(tileEntity instanceof TileEntityDivertionTransporter){
|
||||
int mode=((TileEntityDivertionTransporter) tileEntity).modes[side];
|
||||
boolean redstone=tileEntity.worldObj.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
if((mode==2&&redstone==true)||(mode==1&&redstone==false)){
|
||||
|
||||
if(tileEntity instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)tileEntity).modes[side];
|
||||
boolean redstone = tileEntity.worldObj.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
if((mode == 2 && redstone == true) || (mode == 1 && redstone == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ForgeDirection forgeSide = ForgeDirection.getOrientation(side).getOpposite();
|
||||
|
||||
//Immature BuildCraft inv check
|
||||
|
@ -134,23 +137,26 @@ public final class TransporterUtils
|
|||
{
|
||||
if(tile != null)
|
||||
{
|
||||
|
||||
|
||||
int side = Arrays.asList(connectedTransporters).indexOf(tile);
|
||||
//Check for logistical Diverter
|
||||
if(tileEntity instanceof TileEntityDivertionTransporter){
|
||||
int mode=((TileEntityDivertionTransporter) tileEntity).modes[side];
|
||||
boolean redstone=tileEntity.worldObj.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
if((mode==2&&redstone==true)||(mode==1&&redstone==false)){
|
||||
|
||||
if(tileEntity instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)tileEntity).modes[side];
|
||||
boolean redstone = tileEntity.worldObj.isBlockIndirectlyGettingPowered(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
if((mode == 2 && redstone == true) || (mode == 1 && redstone == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Check for logistical Diverter
|
||||
if(tile instanceof TileEntityDivertionTransporter){
|
||||
int mode=((TileEntityDivertionTransporter) tile).modes[ForgeDirection.VALID_DIRECTIONS[side].getOpposite().ordinal()];
|
||||
boolean redstone=tile.worldObj.isBlockIndirectlyGettingPowered(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
if((mode==2&&redstone==true)||(mode==1&&redstone==false)){
|
||||
if(tile instanceof TileEntityDiversionTransporter)
|
||||
{
|
||||
int mode = ((TileEntityDiversionTransporter)tile).modes[ForgeDirection.VALID_DIRECTIONS[side].getOpposite().ordinal()];
|
||||
boolean redstone = tile.worldObj.isBlockIndirectlyGettingPowered(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
|
||||
if((mode == 2 && redstone == true) || (mode == 1 && redstone == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Loading…
Reference in a new issue