Search in sources :

Example 1 with GateContext

use of buildcraft.transport.gate.GateContext in project BuildCraft by BuildCraft.

the class ContainerGate method refresh.

private static <T extends StatementWrapper> void refresh(SortedSet<T> from, GateContext<T> to) {
    to.groups.clear();
    Map<EnumPipePart, List<T>> parts = new EnumMap<>(EnumPipePart.class);
    for (T val : from) {
        parts.computeIfAbsent(val.sourcePart, p -> new ArrayList<>()).add(val);
    }
    List<T> list = parts.get(EnumPipePart.CENTER);
    if (list == null) {
        list = new ArrayList<>(1);
        list.add(null);
    } else {
        list.add(0, null);
    }
    to.groups.add(new GateGroup<>(EnumPipePart.CENTER, list));
    for (EnumPipePart part : EnumPipePart.FACES) {
        list = parts.get(part);
        if (list != null) {
            to.groups.add(new GateGroup<>(part, list));
        }
    }
}
Also used : PacketBufferBC(buildcraft.lib.net.PacketBufferBC) SortedSet(java.util.SortedSet) TriggerWrapper(buildcraft.transport.gate.TriggerWrapper) EnumMap(java.util.EnumMap) IdAllocator(buildcraft.lib.misc.data.IdAllocator) ContainerBC_Neptune(buildcraft.lib.gui.ContainerBC_Neptune) StatementWrapper(buildcraft.lib.statement.StatementWrapper) IOException(java.io.IOException) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) GateGroup(buildcraft.transport.gate.GateContext.GateGroup) List(java.util.List) MessageContext(net.minecraftforge.fml.common.network.simpleimpl.MessageContext) StatementManager(buildcraft.api.statements.StatementManager) Side(net.minecraftforge.fml.relauncher.Side) ActionWrapper(buildcraft.transport.gate.ActionWrapper) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Map(java.util.Map) GateContext(buildcraft.transport.gate.GateContext) GateLogic(buildcraft.transport.gate.GateLogic) EnumPipePart(buildcraft.api.core.EnumPipePart) EnumPipePart(buildcraft.api.core.EnumPipePart) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) EnumMap(java.util.EnumMap)

Aggregations

EnumPipePart (buildcraft.api.core.EnumPipePart)1 StatementManager (buildcraft.api.statements.StatementManager)1 ContainerBC_Neptune (buildcraft.lib.gui.ContainerBC_Neptune)1 IdAllocator (buildcraft.lib.misc.data.IdAllocator)1 PacketBufferBC (buildcraft.lib.net.PacketBufferBC)1 StatementWrapper (buildcraft.lib.statement.StatementWrapper)1 ActionWrapper (buildcraft.transport.gate.ActionWrapper)1 GateContext (buildcraft.transport.gate.GateContext)1 GateGroup (buildcraft.transport.gate.GateContext.GateGroup)1 GateLogic (buildcraft.transport.gate.GateLogic)1 TriggerWrapper (buildcraft.transport.gate.TriggerWrapper)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 List (java.util.List)1 Map (java.util.Map)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 MessageContext (net.minecraftforge.fml.common.network.simpleimpl.MessageContext)1