Search in sources :

Example 76 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class SneakyUpgradeConfigGuiProvider method getClientGui.

@Override
public Object getClientGui(EntityPlayer player) {
    LogisticsTileGenericPipe bPipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
    if (!(bPipe.pipe instanceof CoreRoutedPipe)) {
        return null;
    }
    List<DoubleCoordinates> list = new WorldCoordinatesWrapper(bPipe).connectedTileEntities().stream().filter(in -> SimpleServiceLocator.pipeInformationManager.isNotAPipe(in.getTileEntity())).map(in -> new DoubleCoordinates(in.getTileEntity())).collect(Collectors.toList());
    if (list.isEmpty()) {
        list = new WorldCoordinatesWrapper(bPipe).connectedTileEntities().stream().map(in -> new DoubleCoordinates(in.getTileEntity())).collect(Collectors.toList());
    }
    return new SneakyConfigurationPopup(list, getSlot(player, UpgradeSlot.class));
}
Also used : UpgradeSlot(logisticspipes.utils.gui.UpgradeSlot) UpgradeCoordinatesGuiProvider(logisticspipes.network.abstractguis.UpgradeCoordinatesGuiProvider) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) Collectors(java.util.stream.Collectors) GuiProvider(logisticspipes.network.abstractguis.GuiProvider) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) EntityPlayer(net.minecraft.entity.player.EntityPlayer) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) StaticResolve(logisticspipes.utils.StaticResolve) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) SneakyConfigurationPopup(logisticspipes.gui.popup.SneakyConfigurationPopup) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) SneakyConfigurationPopup(logisticspipes.gui.popup.SneakyConfigurationPopup) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) UpgradeSlot(logisticspipes.utils.gui.UpgradeSlot)

Example 77 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class RoutingUpdateDebugClosedSet method readData.

@Override
public void readData(LPDataInput input) {
    set = input.readEnumSet(PipeRoutingConnectionType.class);
    pos = new DoubleCoordinates(input);
}
Also used : PipeRoutingConnectionType(logisticspipes.routing.PipeRoutingConnectionType) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 78 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class LogisticsTileGenericSubMultiBlock method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound nbt) {
    super.readFromNBT(nbt);
    if (nbt.hasKey("MainPipePos_xPos")) {
        mainPipePos.clear();
        DoubleCoordinates pos = DoubleCoordinates.readFromNBT("MainPipePos_", nbt);
        if (pos != null) {
            mainPipePos.add(pos);
        }
    }
    if (nbt.hasKey("MainPipePosList")) {
        NBTTagList list = nbt.getTagList("MainPipePosList", new NBTTagCompound().getId());
        for (int i = 0; i < list.tagCount(); i++) {
            DoubleCoordinates pos = DoubleCoordinates.readFromNBT("MainPipePos_", list.getCompoundTagAt(i));
            if (pos != null) {
                mainPipePos.add(pos);
            }
        }
    }
    if (nbt.hasKey("SubTypeList")) {
        NBTTagList list = nbt.getTagList("SubTypeList", new NBTTagString().getId());
        subTypes.clear();
        for (int i = 0; i < list.tagCount(); i++) {
            String name = list.getStringTagAt(i);
            CoreMultiBlockPipe.SubBlockTypeForShare type = CoreMultiBlockPipe.SubBlockTypeForShare.valueOf(name);
            if (type != null) {
                subTypes.add(type);
            }
        }
    }
    mainPipe = null;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) NBTTagString(net.minecraft.nbt.NBTTagString) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 79 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class BaseWrapperClass method load.

@Override
public void load(NBTTagCompound nbt) {
    if (object != null) {
        return;
    }
    String type = nbt.getString("Type");
    if (type.equals("")) {
        return;
    }
    if (type.equals("LPGlobalCCAccess")) {
        object = LogisticsPipes.getComputerLP();
        checkType();
    } else if (type.equals("CoreRoutedPipe")) {
        int x = nbt.getInteger("X");
        int y = nbt.getInteger("Y");
        int z = nbt.getInteger("Z");
        final DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
        final int dim = nbt.getInteger("Dim");
        QueuedTasks.queueTask(() -> {
            World world = DimensionManager.getWorld(dim);
            if (world != null) {
                TileEntity tile = pos.getTileEntity(world);
                if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe) {
                    object = ((LogisticsTileGenericPipe) tile).pipe;
                    checkType();
                }
            }
            return null;
        });
    } else if (type.equals("CCItemIdentifierImplementation")) {
        ItemStack stack = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
        if (!stack.isEmpty()) {
            object = new CCItemIdentifierImplementation(ItemIdentifier.get(stack));
            checkType();
        }
    } else if (type.equals("CCItemIdentifierStackImplementation")) {
        ItemStack stack = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
        if (!stack.isEmpty()) {
            object = new CCItemIdentifierStackImplementation(ItemIdentifierStack.getFromStack(stack));
            checkType();
        }
    } else if (type.equals("CCItemIdentifierBuilder")) {
        ItemStack stack = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
        if (!stack.isEmpty()) {
            CCItemIdentifierBuilder builder = new CCItemIdentifierBuilder();
            builder.setItemID(Double.valueOf(Item.getIdFromItem(stack.getItem())));
            builder.setItemData((double) stack.getItemDamage());
            object = builder;
            checkType();
        }
    } else if (type.equals("LogisticsSolidTileEntity")) {
        int x = nbt.getInteger("X");
        int y = nbt.getInteger("Y");
        int z = nbt.getInteger("Z");
        final DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
        final int dim = nbt.getInteger("Dim");
        QueuedTasks.queueTask(() -> {
            World world = DimensionManager.getWorld(dim);
            if (world != null) {
                TileEntity tile = pos.getTileEntity(world);
                if (tile instanceof LogisticsSolidTileEntity) {
                    object = tile;
                    checkType();
                }
            }
            return null;
        });
    } else {
        System.out.println("Unknown type to load");
    }
}
Also used : LogisticsSolidTileEntity(logisticspipes.blocks.LogisticsSolidTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) CCItemIdentifierImplementation(logisticspipes.proxy.computers.objects.CCItemIdentifier.CCItemIdentifierImplementation) CCItemIdentifierBuilder(logisticspipes.proxy.computers.objects.CCItemIdentifierBuilder) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) LogisticsSolidTileEntity(logisticspipes.blocks.LogisticsSolidTileEntity) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) CCItemIdentifierStackImplementation(logisticspipes.proxy.computers.objects.CCItemIdentifierStack.CCItemIdentifierStackImplementation)

Example 80 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class HSTubeCurve method getConnectedEndTile.

@Override
public TileEntity getConnectedEndTile(EnumFacing output) {
    TurnDirection ori = orientation.getRenderOrientation();
    if (ori.dir2 == output) {
        return container.getTile(output);
    }
    if (ori.dir1 == output) {
        DoubleCoordinates pos = new DoubleCoordinates(-2, 0, 2);
        LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
        set.add(pos);
        orientation.rotatePositions(set);
        TileEntity subTile = pos.add(getLPPosition()).getTileEntity(getWorld());
        if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
            return ((LogisticsTileGenericSubMultiBlock) subTile).getTile(output);
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LPPositionSet(logisticspipes.utils.LPPositionSet) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)94 TileEntity (net.minecraft.tileentity.TileEntity)57 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)22 LPPositionSet (logisticspipes.utils.LPPositionSet)19 ArrayList (java.util.ArrayList)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)15 EnumFacing (net.minecraft.util.EnumFacing)14 ItemStack (net.minecraft.item.ItemStack)12 World (net.minecraft.world.World)12 LogisticsTileGenericSubMultiBlock (logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock)11 Block (net.minecraft.block.Block)11 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)10 SideOnly (cpw.mods.fml.relauncher.SideOnly)7 List (java.util.List)7 DoubleCoordinatesType (network.rs485.logisticspipes.world.DoubleCoordinatesType)7 ILPTEInformation (logisticspipes.asm.te.ILPTEInformation)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)6 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)6 DockingStation (buildcraft.api.robots.DockingStation)5