Java Code Examples for net.minecraft.world.World#getFluidState()

The following examples show how to use net.minecraft.world.World#getFluidState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MiningGadget.java    From MiningGadgets with MIT License 5 votes vote down vote up
public List<BlockPos> findSources(World world, List<BlockPos> coords) {
    List<BlockPos> sources = new ArrayList<>();
    for (BlockPos coord : coords) {
        for (Direction side : Direction.values()) {
            BlockPos sidePos = coord.offset(side);
            IFluidState state = world.getFluidState(sidePos);
            if ((state.getFluid().isEquivalentTo(Fluids.LAVA) || state.getFluid().isEquivalentTo(Fluids.WATER)))
                if (!sources.contains(sidePos))
                    sources.add(sidePos);
        }
    }
    return sources;
}