• 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

13.33
/src/main/java/org/cyclops/integrateddynamics/core/item/VariableFacadeBase.java
1
package org.cyclops.integrateddynamics.core.item;
2

3
import net.minecraft.network.chat.Component;
4
import net.minecraft.world.item.Item;
5
import org.cyclops.cyclopscore.helper.IModHelpers;
6
import org.cyclops.integrateddynamics.IntegratedDynamics;
7
import org.cyclops.integrateddynamics.api.item.IVariableFacade;
8
import org.cyclops.integrateddynamics.api.item.IVariableFacadeClient;
9
import org.cyclops.integrateddynamics.core.persist.world.LabelsWorldStorage;
10

11
import java.util.function.Consumer;
12

13
/**
14
 * Base implementation of {@link IVariableFacade}
15
 *
16
 * @author rubensworks
17
 */
18
public abstract class VariableFacadeBase implements IVariableFacade {
19

20
    private final int id;
21
    private IVariableFacadeClient client;
22

23
    public VariableFacadeBase(boolean generateId) {
24
        this(generateId ? generateId() : -1);
5!
25
    }
1✔
26

27
    public VariableFacadeBase(int id) {
2✔
28
        this.id = id;
3✔
29
        if (IModHelpers.get().getMinecraftHelpers().isClientSide()) {
4!
30
            this.client = constructClient();
×
31
        }
32
    }
1✔
33

34
    protected abstract IVariableFacadeClient constructClient();
35

36
    public IVariableFacadeClient getClient() {
37
        return client;
×
38
    }
39

40
    /**
41
     * @return A unique new variable id.
42
     */
43
    public static int generateId() {
44
        return IntegratedDynamics.globalCounters.get().getNext("variable");
×
45
    }
46

47
    @Override
48
    public String getLabel() {
49
        return LabelsWorldStorage.Access.getInstance(IntegratedDynamics._instance).get().getLabel(getId());
×
50
    }
51

52
    protected String getReferenceDisplay(int variableId) {
53
        String label = LabelsWorldStorage.Access.getInstance(IntegratedDynamics._instance).get().getLabel(variableId);
×
54
        if (label == null) {
×
55
            return String.valueOf(variableId);
×
56
        } else {
57
            return String.format("%s:%s", label, variableId);
×
58
        }
59
    }
60

61
    @Override
62
    public void appendHoverText(Consumer<Component> tooltipAdder, Item.TooltipContext context) {
63
        tooltipAdder.accept(Component.translatable("item.integrateddynamics.variable.id", getId() == -1 ? "..." : getId()));
×
64
    }
×
65

66
    public int getId() {
67
        return this.id;
×
68
    }
69

70
    public void setClient(IVariableFacadeClient client) {
71
        this.client = client;
×
72
    }
×
73

74
    public boolean equals(final Object o) {
75
        if (o == this) return true;
×
76
        if (!(o instanceof VariableFacadeBase)) return false;
×
77
        final VariableFacadeBase other = (VariableFacadeBase) o;
×
78
        if (!other.canEqual((Object) this)) return false;
×
79
        if (this.getId() != other.getId()) return false;
×
80
        final Object this$client = this.getClient();
×
81
        final Object other$client = other.getClient();
×
82
        if (this$client == null ? other$client != null : !this$client.equals(other$client)) return false;
×
83
        return true;
×
84
    }
85

86
    protected boolean canEqual(final Object other) {
87
        return other instanceof VariableFacadeBase;
×
88
    }
89

90
    public int hashCode() {
91
        final int PRIME = 59;
×
92
        int result = 1;
×
93
        result = result * PRIME + this.getId();
×
94
        final Object $client = this.getClient();
×
95
        result = result * PRIME + ($client == null ? 43 : $client.hashCode());
×
96
        return result;
×
97
    }
98

99
    public String toString() {
100
        return "VariableFacadeBase(id=" + this.getId() + ", client=" + this.getClient() + ")";
×
101
    }
102
}
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