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.

Importare la Classe

Link to importare-la-classe

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
Copy
import crafttweaker.api.event.block.FluidPlaceBlockEvent;

Extending BlockEvent

Link to extending-blockevent

FluidPlaceBlockEvent extends BlockEvent. That means all methods available in BlockEvent are also available in FluidPlaceBlockEvent

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: BlockState

ZenScript
Copy
// FluidPlaceBlockEvent.getNewState() as BlockState

myFluidPlaceBlockEvent.getNewState();

Link to getOriginalState

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: BlockState

ZenScript
Copy
// FluidPlaceBlockEvent.getOriginalState() as BlockState

myFluidPlaceBlockEvent.getOriginalState();

Name: setNewState

Sets the new BlockState that will be placed.

Return Type: void

ZenScript
Copy
// FluidPlaceBlockEvent.setNewState(state as BlockState) as void

myFluidPlaceBlockEvent.setNewState(<blockstate:minecraft:dirt>);
ParametroTipoDescrizione
Parametro
state
Tipo
BlockState
Descrizione
The new BlockState.
NomeTipoHa GetterHa SetterDescrizione
Nome
fluidPos
Tipo
BlockPos
Ha Getter
Ha Setter
no
Descrizione
Gets the position of the Fluid that fired this event.
Nome
newState
Tipo
BlockState
Ha Getter
Ha Setter
Descrizione
Gets the new BlockState that will be placed.
Nome
originalState
Tipo
BlockState
Ha Getter
Ha Setter
no
Descrizione
Gets the original BlockState that would have been placed before the event fired.