Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformation NPE crash #158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public void update(TileBarrel barrel) {
List<FluidTransformer> transformers = FluidTransformRegistry
.getFluidTransformers(barrel.getTank().getFluid().getFluid().getName());

boolean found = false;
for (int radius = 0; radius <= 2; radius++) {
for (FluidTransformer transformer : transformers) {
if (!BarrelLiquidBlacklistRegistry.isBlacklisted(barrel.getTier(), transformer.getOutputFluid())
Expand All @@ -194,10 +193,9 @@ public void update(TileBarrel barrel) {
mode.setOutputStack(FluidRegistry.getFluidStack(transformer.getOutputFluid(), 1000));

PacketHandler.sendNBTUpdate(barrel);
found = true;
return;
}
}
if (found) break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public float getFilledLevelForRender(TileBarrel barrel) {

@Override
public void update(TileBarrel barrel) {
if (transformer == null) {
if (transformer == null && inputStack != null && outputStack != null) {
transformer = FluidTransformRegistry.getFluidTransformer(inputStack
.getFluid().getName(), outputStack.getFluid().getName());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/exnihiloadscensio/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static TextureAtlasSprite getTextureFromBlockState(IBlockState state) {

public static TextureAtlasSprite getTextureFromFluidStack(FluidStack stack)
{
if(stack.getFluid() != null)
if(stack != null && stack.getFluid() != null)
{
Fluid fluid = stack.getFluid();

Expand Down