FluidPlaceBlockEvent
Link to fluidplaceblockevent
Fired when a fluid places a block. This can happen on one of two scenarios: 1) When fluids touch each other, spawning a block (When Lava and Water touch they create Cobblestone). 2) When Lava spawns fire around it.
You can use this event to change what block is set, so you could replace cobblestone with something else.
The event is not cancelable.
The event does not have a result.
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.event.block.FluidPlaceBlockEvent;
Extending MCBlockEvent
Link to extending-mcblockevent
FluidPlaceBlockEvent extends MCBlockEvent. That means all methods available in MCBlockEvent are also available in FluidPlaceBlockEvent
使用方式
Link to 使用方式
Name: getFluidPos
Gets the position of the Fluid that fired this event.
Returns: The position of the Fluid.
Return Type: BlockPos
ZenScript Copy// FluidPlaceBlockEvent.getFluidPos() as BlockPos
myFluidPlaceBlockEvent.getFluidPos();
Name: getNewState
Gets the new BlockState that will be placed.
Returns: The new BlockState that will be placed.
Return Type: MCBlockState
ZenScript Copy// FluidPlaceBlockEvent.getNewState() as MCBlockState
myFluidPlaceBlockEvent.getNewState();
Name: getOriginalState
Gets the original BlockState that would have been placed before the event fired.
Returns: The original BlockState that would have been placed.
Return Type: MCBlockState
ZenScript Copy// FluidPlaceBlockEvent.getOriginalState() as MCBlockState
myFluidPlaceBlockEvent.getOriginalState();
Name: setNewState
Sets the new BlockState that will be placed.
Return Type: void
ZenScript Copy// FluidPlaceBlockEvent.setNewState(state as MCBlockState) as void
myFluidPlaceBlockEvent.setNewState(<blockstate:minecraft:dirt>);
参数 | 类型 | 描述 |
---|---|---|
参数 state | 类型 MCBlockState #MC方块状态 | 描述 The new BlockState. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 fluidPos | 类型 BlockPos | 可获得 true | 可设置 false | 描述 Gets the position of the Fluid that fired this event. |
名称 newState | 类型 MCBlockState #MC方块状态 | 可获得 true | 可设置 true | 描述 Gets the new BlockState that will be placed. |
名称 originalState | 类型 MCBlockState #MC方块状态 | 可获得 true | 可设置 false | 描述 Gets the original BlockState that would have been placed before the event fired. |