Search in sources :

Example 1 with FluidState

use of net.minecraft.world.level.material.FluidState in project MinecraftForge by MinecraftForge.

the class FiniteWaterTest method handleFiniteWaterSource.

@SubscribeEvent
public static void handleFiniteWaterSource(BlockEvent.CreateFluidSourceEvent event) {
    if (ENABLED) {
        BlockState state = event.getState();
        FluidState fluidState = state.getFluidState();
        if (fluidState.getType().isSame(Fluids.WATER)) {
            event.setResult(Event.Result.DENY);
        } else if (fluidState.getType().isSame(Fluids.LAVA)) {
            event.setResult(Event.Result.ALLOW);
        }
    }
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) FluidState(net.minecraft.world.level.material.FluidState) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

BlockState (net.minecraft.world.level.block.state.BlockState)1 FluidState (net.minecraft.world.level.material.FluidState)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1