mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
[1.16] ForgeEventFactory#canCreateFluidSource reintroduced (#7181)
This commit is contained in:
1 parent
e803006360
commit
e3db429763
5 files changed
+102
-4
No files matched your search
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.fluid;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod("finite_water_test")
|
||||
@Mod.EventBusSubscriber()
|
||||
public class FiniteWaterTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleFiniteWaterSource(BlockEvent.CreateFluidSourceEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
BlockState state = event.getState();
|
||||
FluidState fluidState = state.getFluidState();
|
||||
if (fluidState.getFluid().isEquivalentTo(Fluids.WATER))
|
||||
{
|
||||
event.setResult(Event.Result.DENY);
|
||||
}
|
||||
else if (fluidState.getFluid().isEquivalentTo(Fluids.LAVA))
|
||||
{
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user