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

The following examples show how to use net.minecraft.world.World#getFluidState() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: MiningGadgets   File: MiningGadget.java    License: 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;
}