Class EntityAIInteractToggleAble.ToggleAble
java.lang.Object
com.minecolonies.core.entity.ai.minimal.EntityAIInteractToggleAble.ToggleAble
- Enclosing class:
- EntityAIInteractToggleAble
Helper class for determining toggleables and toggling them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanOpen(net.minecraft.world.level.block.state.BlockState state) Check if the block can be opened.abstract booleanisBlockToggleAble(net.minecraft.world.level.block.state.BlockState state) Determines whether the given blockstate is validbooleanCheck if the citizen should always close or only close when they were the ones that opened.abstract voidtoggleBlock(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Toggles the given stateabstract voidtoggleBlockClosed(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Toggles the given state to closed
-
Constructor Details
-
ToggleAble
public ToggleAble()
-
-
Method Details
-
isBlockToggleAble
public abstract boolean isBlockToggleAble(net.minecraft.world.level.block.state.BlockState state) Determines whether the given blockstate is valid- Parameters:
state- state to check- Returns:
- true if valid
-
canOpen
public boolean canOpen(net.minecraft.world.level.block.state.BlockState state) Check if the block can be opened. By default this is true when toggleable, but some blocks (trapdoors) we ever only want to open (and reset).- Parameters:
state- the state to check.- Returns:
- true if so.
-
onlyCloseYourOpens
public boolean onlyCloseYourOpens()Check if the citizen should always close or only close when they were the ones that opened.- Returns:
- true if so.
-
toggleBlock
public abstract void toggleBlock(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Toggles the given state- Parameters:
entity- the entity doing it.state- state to toggleworld- world to usepos- position the block is at
-
toggleBlockClosed
public abstract void toggleBlockClosed(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Toggles the given state to closed- Parameters:
entity- the entity doing it.state- state to toggleworld- world to usepos- position the block is at
-