Class EntityAIInteractToggleAble.ToggleAble

java.lang.Object
com.minecolonies.core.entity.ai.minimal.EntityAIInteractToggleAble.ToggleAble
Enclosing class:
EntityAIInteractToggleAble

public abstract static class EntityAIInteractToggleAble.ToggleAble extends Object
Helper class for determining toggleables and toggling them.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canOpen(net.minecraft.world.level.block.state.BlockState state)
    Check if the block can be opened.
    abstract boolean
    isBlockToggleAble(net.minecraft.world.level.block.state.BlockState state)
    Determines whether the given blockstate is valid
    boolean
    Check if the citizen should always close or only close when they were the ones that opened.
    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
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 toggle
      world - world to use
      pos - 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 toggle
      world - world to use
      pos - position the block is at