@@ -0,0 +1,2566 @@
+package org.cyclops.cyclopscore.modcompat.capabilities;%0A%0Aimport net.minecraft.util.EnumFacing;%0Aimport net.minecraftforge.common.capabilities.Capability;%0Aimport net.minecraftforge.common.capabilities.ICapabilityProvider;%0A%0Aimport java.util.Objects;%0A%0A/**%0A * A default implementation of a capability provider for multiple capabilities.%0A * @author rubensworks%0A */%0Apublic class MultipleCapabilityProvider implements ICapabilityProvider %7B%0A%0A    private final Capability%3C?%3E%5B%5D capabilityTypes;%0A    private final Object%5B%5D capabilities;%0A%0A    public MultipleCapabilityProvider(Capability%3C?%3E%5B%5D capabilityTypes, Object%5B%5D capabilities) %7B%0A        assert capabilityTypes.length == capabilities.length;%0A        this.capabilityTypes = Objects.requireNonNull(capabilityTypes);%0A        this.capabilities = Objects.requireNonNull(capabilities);%0A    %7D%0A%0A    protected int getCapabilityId(Capability%3C?%3E capability) %7B%0A        for (int i = 0; i %3C capabilityTypes.length; i++) %7B%0A            Capability%3C?%3E capabilityType = capabilityTypes%5Bi%5D;%0A            if (capabilityType == capability) %7B%0A                return i;%0A            %7D%0A        %7D%0A        return -1;%0A    %7D%0A%0A    @Override%0A    public boolean hasCapability(Capability%3C?%3E capability, EnumFacing facing) %7B%0A        return getCapabilityId(capability) %3E= 0;%0A    %7D%0A%0A    @Override%0A    public %3CT%3E T getCapability(Capability%3CT%3E capability, EnumFacing facing) %7B%0A        int capabilityId = getCapabilityId(capability);%0A        if(capabilityId %3E= 0) %7B%0A            for (Object o : capabilities) %7B%0A                return (T) capabilities%5BcapabilityId%5D;%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%0A    public static %3CT1, T2%3E MultipleCapabilityProvider of(Capability%3CT1%3E capabilityType1, T1 capability1,%0A                                                         Capability%3CT2%3E capabilityType2, T2 capability2) %7B%0A        return new MultipleCapabilityProvider(%0A                new Capability%5B%5D%7BcapabilityType1, capabilityType2%7D,%0A                new Object%5B%5D%7Bcapability1, capability2%7D%0A        );%0A    %7D%0A%0A    public static %3CT1, T2, T3%3E MultipleCapabilityProvider of(Capability%3CT1%3E capabilityType1, T1 capability1,%0A                                                             Capability%3CT2%3E capabilityType2, T2 capability2,%0A                                                             Capability%3CT3%3E capabilityType3, T3 capability3) %7B%0A        return new MultipleCapabilityProvider(%0A                new Capability%5B%5D%7BcapabilityType1, capabilityType2, capabilityType3%7D,%0A                new Object%5B%5D%7Bcapability1, capability2, capability3%7D%0A        );%0A    %7D%0A%7D%0A

Add simple capability provider for multiple capabilities at once