From f408abc0a2a53b3226865846ab08c0c91a6dfc3b Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 13 Aug 2019 22:47:50 +0200 Subject: [PATCH] Added datafixer fallback for TechGuns not accepting itself --- .../cr0s/warpdrive/config/WarpDriveDataFixer.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/config/WarpDriveDataFixer.java b/src/main/java/cr0s/warpdrive/config/WarpDriveDataFixer.java index 7d7b18b9..a3f51bbf 100644 --- a/src/main/java/cr0s/warpdrive/config/WarpDriveDataFixer.java +++ b/src/main/java/cr0s/warpdrive/config/WarpDriveDataFixer.java @@ -355,13 +355,19 @@ public class WarpDriveDataFixer { // then check if the block exists in the game blockEntry = Block.getBlockFromName(nameBlock); if (blockEntry == null) { - WarpDrive.logger.info(String.format("Ignoring missing block %s in %s", + WarpDrive.logger.info(String.format("Ignoring missing in-game block %s in %s", nameBlock, nameFull )); return null; } // finally build the blockstate itself - blockStateEntry = blockEntry.getStateFromMeta(intMetadata); + try { + blockStateEntry = blockEntry.getStateFromMeta(intMetadata); + } catch (final Exception exception) { + WarpDrive.logger.info(String.format("Using default state due to exception when fixing block %s in %s", + nameBlock, nameFull )); + blockStateEntry = blockEntry.getDefaultState(); + } } else if (indexBracket > 0) { // check closing bracket @@ -389,7 +395,7 @@ public class WarpDriveDataFixer { // then check if the block exists in the game blockEntry = Block.getBlockFromName(nameBlock); if (blockEntry == null) { - WarpDrive.logger.info(String.format("Ignoring missing block %s in %s", + WarpDrive.logger.info(String.format("Ignoring missing in-game block %s in %s", nameBlock, nameFull )); return null; } @@ -419,7 +425,7 @@ public class WarpDriveDataFixer { } else {// (just a block) blockEntry = Block.getBlockFromName(nameFull); if (blockEntry == null) { - WarpDrive.logger.info(String.format("Ignoring missing block %s", + WarpDrive.logger.info(String.format("Ignoring missing in-game block %s", nameFull )); return null; }