-
-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
create_power_loader/src/main/java/com/hlysine/create_power_loader/mixin/TrainMixin.java
Lines 40 to 60 in 2a96c40
| @Inject( | |
| at = @At("RETURN"), | |
| method = "write(Lcom/simibubi/create/content/trains/graph/DimensionPalette;Lnet/minecraft/core/HolderLookup$Provider;)Lnet/minecraft/nbt/CompoundTag;", | |
| cancellable = true | |
| ) | |
| private void cpl$write(DimensionPalette dimensions, HolderLookup.Provider registries, CallbackInfoReturnable<CompoundTag> cir) { | |
| CompoundTag nbt = cir.getReturnValue(); | |
| nbt.put("CPLData", getLoader().write()); | |
| cir.setReturnValue(nbt); | |
| } | |
| @Inject( | |
| at = @At("RETURN"), | |
| method = "read(Lnet/minecraft/nbt/CompoundTag;Lnet/minecraft/core/HolderLookup$Provider;Ljava/util/Map;Lcom/simibubi/create/content/trains/graph/DimensionPalette;)Lcom/simibubi/create/content/trains/entity/Train;", | |
| cancellable = true | |
| ) | |
| private static void cpl$read(CompoundTag tag, HolderLookup.Provider registries, Map<UUID, TrackGraph> trackNetworks, DimensionPalette dimensions, CallbackInfoReturnable<Train> cir) { | |
| Train train = cir.getReturnValue(); | |
| ((CPLTrain) train).setLoader(TrainChunkLoader.read(train, tag.getCompound("CPLData"))); | |
| cir.setReturnValue(train); | |
| } |
More precisely, my mod (Create: Electro Energetics) doesn't load train data because this mod cancels the method by calling cir.setReturnValue()
You actually don't need to do that, because you're not replacing the object with a new one, you're just modifying it.
The solution:
Remove:
cir.setReturnValue(nbt);and
cir.setReturnValue(train);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels