• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/api/network/IPositionedAddonsNetworkIngredients.java
1
package org.cyclops.integrateddynamics.api.network;
2

3
import com.google.common.collect.Iterators;
4
import net.minecraft.world.level.Level;
5
import net.minecraft.world.level.block.entity.BlockEntity;
6
import net.neoforged.neoforge.capabilities.BlockCapability;
7
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
8
import org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage;
9
import org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorageSlotted;
10
import org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorageWrapperHandler;
11
import org.cyclops.cyclopscore.datastructure.DimPos;
12
import org.cyclops.cyclopscore.helper.IModHelpers;
13
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable;
14
import org.cyclops.integrateddynamics.api.part.PartPos;
15

16
import javax.annotation.Nullable;
17
import java.util.Iterator;
18
import java.util.Map;
19

20
/**
21
 * An ingredient network that can hold prioritized positions.
22
 * @param <T> The instance type.
23
 * @param <M> The matching condition parameter, may be Void. Instances MUST properly implement the equals method.
24
 * @author rubensworks
25
 */
26
public interface IPositionedAddonsNetworkIngredients<T, M> extends IPositionedAddonsNetwork,
27
        IIngredientComponentStorageObservable<T, M> {
28

29
    /**
30
     * @return The ingredient component type this storage applies to.
31
     */
32
    public IngredientComponent<T, M> getComponent();
33

34
    /**
35
     * @return The quantity rate limit for each storage mutation.
36
     */
37
    public long getRateLimit();
38

39
    /**
40
     * Get the storage at the given position.
41
     * @param pos A position.
42
     * @return The storage, or an empty storage if none is available.
43
     */
44
    public IIngredientComponentStorage<T, M> getPositionedStorage(PartPos pos);
45

46
    /**
47
     * Set an ingredient filter for the given storage position.
48
     * Unsets the filter if null is provided.
49
     * @param pos A position.
50
     * @param filter An ingredient filter.
51
     */
52
    public void setPositionedStorageFilter(PartPos pos, @Nullable PositionedAddonsNetworkIngredientsFilter<T> filter);
53

54
    /**
55
     * @param pos A position.
56
     * @return An optional ingredient filter for the given storage position.
57
     */
58
    @Nullable
59
    public PositionedAddonsNetworkIngredientsFilter<T> getPositionedStorageFilter(PartPos pos);
60

61
    /**
62
     * Get all instances at the target position.
63
     * @param pos A part position.
64
     * @return A collection of instances. This can not be a view, and must be a deep copy of the target.
65
     */
66
    public default Iterator<T> getRawInstances(PartPos pos) {
67
        Iterator<T> it = getPositionedStorage(pos).iterator();
×
68
        PositionedAddonsNetworkIngredientsFilter<T> filter = getPositionedStorageFilter(pos);
×
69
        if (filter != null) {
×
70
            it = Iterators.filter(it, filter::testView);
×
71
        }
72
        return it;
×
73
    }
74

75
    /**
76
     * Get the storage at the given position.
77
     * @param pos A position.
78
     * @return The storage.
79
     */
80
    @Nullable
81
    public default IIngredientComponentStorage<T, M> getPositionedStorageUnsafe(PartPos pos) {
82
        DimPos dimPos = pos.getPos();
×
83
        Level level = dimPos.getLevel(true);
×
84
        if (level == null) {
×
85
            return null;
×
86
        }
87
        return getComponent().getBlockStorage(level, pos.getPos().getBlockPos(), level.getBlockState(dimPos.getBlockPos()), IModHelpers.get().getBlockEntityHelpers().get(level, dimPos.getBlockPos(), BlockEntity.class).orElse(null), pos.getSide());
×
88
    }
89

90
    /**
91
     * Get the storage at the given channel.
92
     * @param channel A channel id.
93
     * @return A storage.
94
     */
95
    public INetworkIngredientsChannel<T, M> getChannel(int channel);
96

97
    /**
98
     * Get the slotted storage at the given channel.
99
     * @param channel A channel id.
100
     * @return A slotted storage.
101
     */
102
    public IIngredientComponentStorageSlotted<T, M> getChannelSlotted(int channel);
103

104
    /**
105
     * Get the external storage at the given channel.
106
     * @param capability A capability to wrap the channel in.
107
     * @param channel A channel id.
108
     * @param <S> The external storage type.
109
     * @return An external storage, or null if no wrapping is possible for the given capability.
110
     */
111
    @Nullable
112
    public default <S, C> S getChannelExternal(BlockCapability<S, C> capability, int channel) {
113
        IIngredientComponentStorageWrapperHandler<T, M, S, C> wrapperHandler = getComponent()
×
114
                .getStorageWrapperHandler(capability);
×
115
        return wrapperHandler != null ? wrapperHandler.wrapStorage(getChannel(channel)) : null;
×
116
    }
117

118
    /**
119
     * Get the last tick duration of the index observer.
120
     * @return Duration in nanoseconds
121
     */
122
    public Map<PartPos, Long> getLastSecondDurationIndex();
123

124
    /**
125
     * Reset the last second duration count.
126
     */
127
    public void resetLastSecondDurationsIndex();
128

129
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc