Skip to content

Commit 7368986

Browse files
committed
Fix color of frequency items not being set on immediately and instead being handled as part of the check for updated color
1 parent d4a22dc commit 7368986

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

src/datagen/generated/mekanism/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datagen/generated/mekanism/data/mekanism/loot_table/blocks/qio_dashboard.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datagen/generated/mekanism/data/mekanism/loot_table/blocks/qio_drive_array.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datagen/generated/mekanism/data/mekanism/loot_table/blocks/qio_exporter.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datagen/generated/mekanism/data/mekanism/loot_table/blocks/qio_importer.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datagen/generated/mekanism/data/mekanism/loot_table/blocks/qio_redstone_adapter.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/mekanism/common/lib/frequency/TileComponentFrequency.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,14 @@ private <FREQ extends Frequency> void setFrequencyFromComponent(BlockEntity.Data
287287
@Override
288288
public void addRemapEntries(List<DataComponentType<?>> remapEntries) {
289289
for (Map.Entry<FrequencyType<?>, FrequencyData> entry : nonSecurityFrequencies.entrySet()) {
290-
DataComponentType<? extends FrequencyAware<?>> frequencyComponent = MekanismDataComponents.getFrequencyComponent(entry.getKey());
290+
FrequencyType<?> type = entry.getKey();
291+
DataComponentType<? extends FrequencyAware<?>> frequencyComponent = MekanismDataComponents.getFrequencyComponent(type);
291292
if (frequencyComponent != null && !remapEntries.contains(frequencyComponent)) {
292293
remapEntries.add(frequencyComponent);
293294
}
295+
if (type == FrequencyType.QIO && !remapEntries.contains(MekanismDataComponents.COLOR.get())) {
296+
remapEntries.add(MekanismDataComponents.COLOR.get());
297+
}
294298
}
295299
}
296300

@@ -307,7 +311,9 @@ private <FREQ extends Frequency> void collectFrequencyComponents(DataComponentMa
307311
if (frequencyComponent != null) {
308312
builder.set(frequencyComponent, new FrequencyAware<>((FREQ) frequencyData.selectedFrequency));
309313
//TODO: Do we want to support multiple frequency types each having a colored frequency?
310-
if (frequencyData.selectedFrequency instanceof IColorableFrequency colorableFrequency) {
314+
// Currently we only really need the QIO to support it, as the other colorable frequency (teleporters)
315+
// don't need the item to be aware of the color
316+
if (type == FrequencyType.QIO && frequencyData.selectedFrequency instanceof IColorableFrequency colorableFrequency) {
311317
builder.set(MekanismDataComponents.COLOR, colorableFrequency.getColor());
312318
}
313319
}

0 commit comments

Comments
 (0)