Skip to content

Commit

Permalink
Fix recipe lookups for filled fluid containers
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Sep 25, 2016
1 parent f189dd9 commit 85d763d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main/java/mezz/jei/SubtypeRegistry.java
Expand Up @@ -68,12 +68,11 @@ public String getSubtypeInfo(@Nullable ItemStack itemStack) {
IFluidTankProperties[] tankPropertiesList = capability.getTankProperties();
StringBuilder info = new StringBuilder();
for (IFluidTankProperties tankProperties : tankPropertiesList) {
FluidStack contents = tankProperties.getContents();
if (contents != null) {
Fluid fluid = contents.getFluid();
if (fluid != null) {
info.append(fluid.getName()).append(";");
}
String contentsName = getContentsName(tankProperties);
if (contentsName != null) {
info.append(contentsName).append(";");
} else {
info.append("empty").append(";");
}
}
if (info.length() > 0) {
Expand All @@ -82,7 +81,18 @@ public String getSubtypeInfo(@Nullable ItemStack itemStack) {
}

return null;
}

@Nullable
private static String getContentsName(IFluidTankProperties fluidTankProperties) {
FluidStack contents = fluidTankProperties.getContents();
if (contents != null) {
Fluid fluid = contents.getFluid();
if (fluid != null) {
return fluid.getName();
}
}
return null;
}

private static class AllNbt implements ISubtypeInterpreter {
Expand Down

0 comments on commit 85d763d

Please sign in to comment.