Skip to content

Commit

Permalink
Fix issues with items that crash with FluidSubtypeInterpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Apr 22, 2018
1 parent 6994209 commit f78958c
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -132,8 +132,14 @@ private void addItemStack(StackHelper stackHelper, ItemStack stack, List<ItemSta

private void addFallbackSubtypeInterpreter(ItemStack itemStack) {
if (!this.subtypeRegistry.hasSubtypeInterpreter(itemStack)) {
if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
this.subtypeRegistry.registerSubtypeInterpreter(itemStack.getItem(), FluidSubtypeInterpreter.INSTANCE);
try {
String info = FluidSubtypeInterpreter.INSTANCE.apply(itemStack);
if (!ISubtypeRegistry.ISubtypeInterpreter.NONE.equals(info)) {
this.subtypeRegistry.registerSubtypeInterpreter(itemStack.getItem(), FluidSubtypeInterpreter.INSTANCE);
}
} catch (RuntimeException | LinkageError e) {
String itemStackInfo = ErrorUtil.getItemStackInfo(itemStack);
Log.get().error("Failed to apply FluidSubtypeInterpreter to ItemStack: {}", itemStackInfo, e);
}
}
}
Expand Down

0 comments on commit f78958c

Please sign in to comment.