Accept null from IAltarComponent

This commit is contained in:
Nicholas Ignoffo 2016-06-19 22:36:35 -07:00
parent aa8d41385f
commit 2c70e6ebc1
2 changed files with 7 additions and 4 deletions

View file

@ -122,7 +122,7 @@ public class BloodAltar implements IFluidHandler
if (worldBlock.getBlock() instanceof IAltarComponent)
{
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(world, worldBlock.getState(), componentPos);
if (component != altarComponent.getComponent())
if (component == null || component != altarComponent.getComponent())
return false;
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
{
@ -155,9 +155,9 @@ public class BloodAltar implements IFluidHandler
if (worldBlock.getBlock() instanceof IAltarComponent)
{
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(world, worldBlock.getState(), componentPos);
if (component != altarComponent.getComponent())
if (component == null || component != altarComponent.getComponent())
{
return new ImmutablePair<BlockPos, EnumAltarComponent>(componentPos, altarComponent.getComponent());
return Pair.of(componentPos, altarComponent.getComponent());
}
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
{
@ -167,7 +167,7 @@ public class BloodAltar implements IFluidHandler
{
if (world.isAirBlock(componentPos))
{
return new ImmutablePair<BlockPos, EnumAltarComponent>(componentPos, altarComponent.getComponent());
return Pair.of(componentPos, altarComponent.getComponent());
}
}
}

View file

@ -4,7 +4,10 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IAltarComponent
{
@Nullable
EnumAltarComponent getType(World world, IBlockState state, BlockPos pos);
}