Skip to content

Commit acd57ce

Browse files
committed
Mark more complex component types to cache the encoding
1 parent e652c1f commit acd57ce

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/main/java/mekanism/common/registration/impl/DataComponentDeferredRegister.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import net.minecraft.resources.ResourceKey;
2323
import net.minecraft.util.ExtraCodecs;
2424

25-
//TODO - 1.20.5: Should we be setting cacheEncoding on any of our builders?
2625
@NothingNullByDefault
2726
public class DataComponentDeferredRegister extends MekanismDeferredRegister<DataComponentType<?>> {
2827

src/main/java/mekanism/common/registries/MekanismDataComponents.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,39 +68,48 @@ private MekanismDataComponents() {
6868
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<ModuleContainer>> MODULE_CONTAINER = DATA_COMPONENTS.simple("module_container",
6969
builder -> builder.persistent(ModuleContainer.CODEC)
7070
.networkSynchronized(ModuleContainer.STREAM_CODEC)
71+
.cacheEncoding()
7172
);
7273

7374
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedEnergy>> ATTACHED_ENERGY = DATA_COMPONENTS.simple("energy",
7475
builder -> builder.persistent(AttachedEnergy.CODEC)
7576
.networkSynchronized(AttachedEnergy.STREAM_CODEC)
77+
.cacheEncoding()
7678
);
7779
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedItems>> ATTACHED_ITEMS = DATA_COMPONENTS.simple("items",
7880
builder -> builder.persistent(AttachedItems.CODEC)
7981
.networkSynchronized(AttachedItems.STREAM_CODEC)
82+
.cacheEncoding()
8083
);
8184
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedFluids>> ATTACHED_FLUIDS = DATA_COMPONENTS.simple("fluids",
8285
builder -> builder.persistent(AttachedFluids.CODEC)
8386
.networkSynchronized(AttachedFluids.STREAM_CODEC)
87+
.cacheEncoding()
8488
);
8589
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedGases>> ATTACHED_GASES = DATA_COMPONENTS.simple("gases",
8690
builder -> builder.persistent(AttachedGases.CODEC)
8791
.networkSynchronized(AttachedGases.STREAM_CODEC)
92+
.cacheEncoding()
8893
);
8994
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedInfuseTypes>> ATTACHED_INFUSE_TYPES = DATA_COMPONENTS.simple("infuse_types",
9095
builder -> builder.persistent(AttachedInfuseTypes.CODEC)
9196
.networkSynchronized(AttachedInfuseTypes.STREAM_CODEC)
97+
.cacheEncoding()
9298
);
9399
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedPigments>> ATTACHED_PIGMENTS = DATA_COMPONENTS.simple("pigments",
94100
builder -> builder.persistent(AttachedPigments.CODEC)
95101
.networkSynchronized(AttachedPigments.STREAM_CODEC)
102+
.cacheEncoding()
96103
);
97104
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedSlurries>> ATTACHED_SLURRIES = DATA_COMPONENTS.simple("slurries",
98105
builder -> builder.persistent(AttachedSlurries.CODEC)
99106
.networkSynchronized(AttachedSlurries.STREAM_CODEC)
107+
.cacheEncoding()
100108
);
101109
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedHeat>> ATTACHED_HEAT = DATA_COMPONENTS.simple("heat_data",
102110
builder -> builder.persistent(AttachedHeat.CODEC)
103111
.networkSynchronized(AttachedHeat.STREAM_CODEC)
112+
.cacheEncoding()
104113
);
105114

106115
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<DisassemblerMode>> DISASSEMBLER_MODE = DATA_COMPONENTS.simple("disassembler_mode",
@@ -168,6 +177,7 @@ private MekanismDataComponents() {
168177
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<OverflowAware>> OVERFLOW_AWARE = DATA_COMPONENTS.simple("overflow",
169178
builder -> builder.persistent(OverflowAware.CODEC)
170179
.networkSynchronized(OverflowAware.STREAM_CODEC)
180+
.cacheEncoding()
171181
);
172182
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<Item>> REPLACE_STACK = DATA_COMPONENTS.simple("replace_stack",
173183
builder -> builder.persistent(BuiltInRegistries.ITEM.byNameCodec())
@@ -192,6 +202,7 @@ private MekanismDataComponents() {
192202
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<DriveContents>> DRIVE_CONTENTS = DATA_COMPONENTS.simple("drive_contents",
193203
builder -> builder.persistent(DriveContents.CODEC)
194204
.networkSynchronized(DriveContents.STREAM_CODEC)
205+
.cacheEncoding()
195206
);
196207

197208
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<StabilizedChunks>> STABILIZER_CHUNKS = DATA_COMPONENTS.simple("stabilzer_chunks",
@@ -237,18 +248,22 @@ private MekanismDataComponents() {
237248
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedEjector>> EJECTOR = DATA_COMPONENTS.simple("ejector",
238249
builder -> builder.persistent(AttachedEjector.CODEC)
239250
.networkSynchronized(AttachedEjector.STREAM_CODEC)
251+
.cacheEncoding()
240252
);
241253
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<AttachedSideConfig>> SIDE_CONFIG = DATA_COMPONENTS.simple("side_config",
242254
builder -> builder.persistent(AttachedSideConfig.CODEC)
243255
.networkSynchronized(AttachedSideConfig.STREAM_CODEC)
256+
.cacheEncoding()
244257
);
245258
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<UpgradeAware>> UPGRADES = DATA_COMPONENTS.simple("upgrades",
246259
builder -> builder.persistent(UpgradeAware.CODEC)
247260
.networkSynchronized(UpgradeAware.STREAM_CODEC)
261+
.cacheEncoding()
248262
);
249263
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<FilterAware>> FILTER_AWARE = DATA_COMPONENTS.simple("filters",
250264
builder -> builder.persistent(FilterAware.CODEC)
251265
.networkSynchronized(FilterAware.STREAM_CODEC)
266+
.cacheEncoding()
252267
);
253268

254269
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<CompoundTag>> FREQUENCY_COMPONENT = DATA_COMPONENTS.simple("frequencies",
@@ -277,5 +292,6 @@ public static <FREQ extends Frequency> DataComponentType<FrequencyAware<FREQ>> g
277292
public static final MekanismDeferredHolder<DataComponentType<?>, DataComponentType<PortableDashboardContents>> QIO_DASHBOARD = DATA_COMPONENTS.simple("qio_dashboard",
278293
builder -> builder.persistent(PortableDashboardContents.CODEC)
279294
.networkSynchronized(PortableDashboardContents.STREAM_CODEC)
295+
.cacheEncoding()
280296
);
281297
}

0 commit comments

Comments
 (0)