Skip to content

Commit

Permalink
Update DataFix version
Browse files Browse the repository at this point in the history
Ensures `MixinEntityType` and `MixinTypeEntityType` run all the fixers for older saves
  • Loading branch information
Chocohead committed Dec 8, 2018
1 parent 2e3bf80 commit 93d5a21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/dimdev/rift/Rift.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import net.minecraft.launchwrapper.Launch;

public class Rift implements InitializationListener {
public static final int DATAFIXER_VERSION = 1631;
private static final Logger LOGGER = LogManager.getLogger();

@Override
public void onInitialization() {
LOGGER.info("Loading Rift!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dimdev.rift.Rift;
import org.dimdev.rift.listener.EntityTypeAdder;
import org.dimdev.riftloader.RiftLoader;
import org.spongepowered.asm.mixin.Final;
Expand Down Expand Up @@ -41,7 +42,7 @@ public EntityType<T> build(String id) {

if (serializable) {
try {
dataFixerType = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(1628)).getChoiceType(TypeReferences.ENTITY_TYPE, id);
dataFixerType = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(Rift.DATAFIXER_VERSION)).getChoiceType(TypeReferences.ENTITY_TYPE, id);
} catch (IllegalStateException | IllegalArgumentException ignored) {
LOGGER.debug("No data fixer registered for entity {}", id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.util.datafix.TypeReferences;
import net.minecraft.util.registry.IRegistry;
import org.apache.logging.log4j.Logger;
import org.dimdev.rift.Rift;
import org.dimdev.rift.listener.TileEntityTypeAdder;
import org.dimdev.riftloader.RiftLoader;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -29,7 +30,7 @@ public static <T extends TileEntity> TileEntityType<T> register(String id, TileE

try {
//Schema#getChoiceType can throw an IAE that vanilla won't catch, so we catch that too
dataFixerType = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(1628)).getChoiceType(TypeReferences.BLOCK_ENTITY, id);
dataFixerType = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(Rift.DATAFIXER_VERSION)).getChoiceType(TypeReferences.BLOCK_ENTITY, id);
} catch (IllegalStateException | IllegalArgumentException e) {
LOGGER.debug("No data fixer registered for block entity {}", id);
}
Expand Down

0 comments on commit 93d5a21

Please sign in to comment.