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

CyclopsMC / IntegratedDynamics / 36036717506

24 Sep 2026 05:47PM UTC coverage: 48.062% (+0.03%) from 48.037%
36036717506

Pull #1749

github

claude
Fix stripped Menril log and wood not smelting into charcoal

The stripped Menril log entry in the item logs_that_burn tag was lost when
upmerging to MC 1.21, and Menril wood variants were never included.
Both vanilla logs_that_burn tags now reference #integrateddynamics:menril_logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qshy4VBPjpdWRG1wD7EoAk
Pull Request #1749: Fix stripped Menril log and wood not smelting into charcoal

3422 of 9784 branches covered (34.98%)

Branch coverage included in aggregate %.

13653 of 25743 relevant lines covered (53.04%)

2.54 hits per line

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

61.54
/src/main/java/org/cyclops/integrateddynamics/core/blockentity/BlockEntityActiveVariableBase.java
1
package org.cyclops.integrateddynamics.core.blockentity;
2

3
import com.google.common.collect.Sets;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.HolderLookup;
6
import net.minecraft.nbt.CompoundTag;
7
import net.minecraft.network.chat.MutableComponent;
8
import net.minecraft.world.level.block.entity.BlockEntityType;
9
import net.minecraft.world.level.block.state.BlockState;
10
import org.cyclops.cyclopscore.persist.IDirtyMarkListener;
11
import org.cyclops.cyclopscore.persist.nbt.NBTClassType;
12
import org.cyclops.integrateddynamics.Capabilities;
13
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
14
import org.cyclops.integrateddynamics.api.evaluate.variable.IVariable;
15
import org.cyclops.integrateddynamics.api.evaluate.variable.ValueDeseralizationContext;
16
import org.cyclops.integrateddynamics.api.network.INetwork;
17
import org.cyclops.integrateddynamics.api.network.INetworkEventListener;
18
import org.cyclops.integrateddynamics.api.network.IPartNetwork;
19
import org.cyclops.integrateddynamics.api.network.event.INetworkEvent;
20
import org.cyclops.integrateddynamics.core.evaluate.InventoryVariableEvaluator;
21
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypes;
22
import org.cyclops.integrateddynamics.core.helper.NetworkHelpers;
23
import org.cyclops.integrateddynamics.core.network.event.VariableContentsUpdatedEvent;
24

25
import javax.annotation.Nullable;
26
import java.util.List;
27
import java.util.Optional;
28
import java.util.Set;
29
import java.util.function.Supplier;
30

31
/**
32
 * Base part entity that can hold variables.
33
 * @param <E> The type of event listener
34
 * @author rubensworks
35
 */
36
public abstract class BlockEntityActiveVariableBase<E> extends BlockEntityCableConnectableInventory implements IDirtyMarkListener, INetworkEventListener<E> {
37

38
    private final InventoryVariableEvaluator<IValue> evaluator;
39

40
    public BlockEntityActiveVariableBase(BlockEntityType<?> type, BlockPos blockPos, BlockState blockState, int inventorySize) {
41
        super(type, blockPos, blockState, inventorySize, 1);
7 ✔
42
        getInventory().addDirtyMarkListener(this);
4 ✔
43

44
        this.evaluator = createEvaluator();
4 ✔
45
    }
1 ✔
46

47
    public static class CapabilityRegistrar<T extends BlockEntityActiveVariableBase<?>> extends BlockEntityCableConnectableInventory.CapabilityRegistrar<T> {
48
        public CapabilityRegistrar(Supplier<BlockEntityType<? extends T>> blockEntityType) {
49
            super(blockEntityType);
3 ✔
50
        }
1 ✔
51

52
        @Override
53
        public void populate() {
54
            super.populate();
2 ✔
55

56
            add(
4 ✔
57
                    Capabilities.ValueInterface.BLOCK,
58
                    (blockEntity, context) -> () -> {
×
59
                        INetwork network = blockEntity.getNetwork();
×
60
                        IPartNetwork partNetwork = NetworkHelpers.getPartNetworkChecked(network);
×
61
                        if (blockEntity.hasVariable()) {
×
62
                            IVariable<?> variable = blockEntity.getVariable(partNetwork);
×
63
                            if (variable != null) {
×
64
                                return Optional.of(variable.getValue());
×
65
                            }
66
                        }
67
                        return Optional.empty();
×
68
                    }
69
            );
70
        }
1 ✔
71
    }
72

73
    protected InventoryVariableEvaluator<IValue> createEvaluator() {
74
        return new InventoryVariableEvaluator<>(this.getInventory(), getSlotRead(), () -> ValueDeseralizationContext.of(getLevel()), ValueTypes.CATEGORY_ANY);
15 ✔
75
    }
76

77
    public InventoryVariableEvaluator getEvaluator() {
78
        return evaluator;
3 ✔
79
    }
80

81
    @Override
82
    public void saveAdditional(CompoundTag tag, HolderLookup.Provider provider) {
83
        super.saveAdditional(tag, provider);
4 ✔
84
        List<MutableComponent> errors = evaluator.getErrors();
4 ✔
85
        NBTClassType.writeNbt(List.class, "errors", errors, tag, provider);
6 ✔
86
    }
1 ✔
87

88
    @Override
89
    public void read(CompoundTag tag, HolderLookup.Provider provider) {
90
        evaluator.setErrors(NBTClassType.readNbt(List.class, "errors", tag, provider));
×
91
        super.read(tag, provider);
×
92
    }
×
93

94
    public abstract int getSlotRead();
95

96
    public boolean hasVariable() {
97
        return !getInventory().getItem(getSlotRead()).isEmpty();
×
98
    }
99

100
    protected void updateReadVariable(boolean sendVariablesUpdateEvent) {
101
        evaluator.refreshVariable(getNetwork(), sendVariablesUpdateEvent);
6 ✔
102
        sendUpdate();
2 ✔
103
    }
1 ✔
104

105
    @Override
106
    public void onDirty() {
107
        if(!level.isClientSide()) {
4 !
108
            updateReadVariable(true);
3 ✔
109
        }
110
    }
1 ✔
111

112
    @Nullable
113
    public IVariable<?> getVariable(IPartNetwork network) {
114
        return evaluator.getVariable(getNetwork(), network);
7 ✔
115
    }
116

117
    @Override
118
    public boolean hasEventSubscriptions() {
119
        return true;
2 ✔
120
    }
121

122
    @Override
123
    public Set<Class<? extends INetworkEvent>> getSubscribedEvents() {
124
        return Sets.<Class<? extends INetworkEvent>>newHashSet(VariableContentsUpdatedEvent.class);
8 ✔
125
    }
126

127
    @Override
128
    public void onEvent(INetworkEvent event, E networkElement) {
129
        if(event instanceof VariableContentsUpdatedEvent) {
3 !
130
            updateReadVariable(false);
3 ✔
131
        }
132
    }
1 ✔
133

134
    @Override
135
    public void afterNetworkReAlive() {
136
        super.afterNetworkReAlive();
2 ✔
137
        updateReadVariable(true);
3 ✔
138
    }
1 ✔
139
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc