mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +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
@@ -76,6 +76,7 @@ import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
@@ -656,7 +657,7 @@ public class ForgeEventFactory
|
||||
return event.getTable();
|
||||
}
|
||||
|
||||
public static boolean canCreateFluidSource(World world, BlockPos pos, BlockState state, boolean def)
|
||||
public static boolean canCreateFluidSource(IWorldReader world, BlockPos pos, BlockState state, boolean def)
|
||||
{
|
||||
CreateFluidSourceEvent evt = new CreateFluidSourceEvent(world, pos, state);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
@@ -243,11 +244,32 @@ public class BlockEvent extends Event
|
||||
* even if the liquid usually does do that (like water).
|
||||
*/
|
||||
@HasResult
|
||||
public static class CreateFluidSourceEvent extends BlockEvent
|
||||
public static class CreateFluidSourceEvent extends Event
|
||||
{
|
||||
public CreateFluidSourceEvent(World world, BlockPos pos, BlockState state)
|
||||
private final IWorldReader world;
|
||||
private final BlockPos pos;
|
||||
private final BlockState state;
|
||||
|
||||
public CreateFluidSourceEvent(IWorldReader world, BlockPos pos, BlockState state)
|
||||
{
|
||||
super(world, pos, state);
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public IWorldReader getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
public BlockState getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user