Class ActionSetBlockProperty<T>

java.lang.Object
com.blamejared.crafttweaker.api.action.block.ActionSetBlockProperty<T>
All Implemented Interfaces:
IAction, IRuntimeAction, IUndoableAction

public class ActionSetBlockProperty<T> extends Object implements IUndoableAction
  • Constructor Details

    • ActionSetBlockProperty

      public ActionSetBlockProperty(net.minecraft.world.level.block.Block block, String propertyName, T newValue, T oldValue, Consumer<T> valueSetter)
    • ActionSetBlockProperty

      public ActionSetBlockProperty(net.minecraft.world.level.block.Block block, String propertyName, T newValue, T oldValue, Consumer<T> valueSetter, Function<T,String> valueNameGetter)
    • ActionSetBlockProperty

      public ActionSetBlockProperty(net.minecraft.world.level.block.state.BlockState blockState, String propertyName, T newValue, T oldValue, Consumer<T> valueSetter, Function<T,String> valueNameGetter)
    • ActionSetBlockProperty

      public ActionSetBlockProperty(net.minecraft.world.level.block.state.BlockState blockState, String propertyName, T newValue, T oldValue, Consumer<T> valueSetter)
  • Method Details

    • apply

      public void apply()
      Description copied from interface: IAction
      Applies the action, executing all code necessary.
      Specified by:
      apply in interface IAction
    • describe

      public String describe()
      Description copied from interface: IAction
      Gets a human-readable description of the action.

      This message is used for logging and to surface information to the user when something goes wrong. It is thus customary to describe the action as accurately as possible without being too verbose.

      It is not allowed to return a null or otherwise empty description for the action: doing so will raise an error at runtime.

      Specified by:
      describe in interface IAction
      Returns:
      A description of the current action.
    • undo

      public void undo()
      Description copied from interface: IUndoableAction
      Undoes all changes carried out by the action.
      Specified by:
      undo in interface IUndoableAction
    • describeUndo

      public String describeUndo()
      Description copied from interface: IUndoableAction
      Gets a human-readable description of the action rollback.

      This message is used for logging and to surface information to the user when something goes wrong. It is thus customary to describe the rollback as accurately as possible without being too verbose.

      It is not allowed to return a null or otherwise empty description for the rollback: doing so will raise an error at runtime.

      Specified by:
      describeUndo in interface IUndoableAction
      Returns:
      A description of the current action rollback.
    • shouldApplyOn

      public boolean shouldApplyOn(IScriptLoadSource source)
      Description copied from interface: IAction
      Determines whether an action should be applied for scripts loading in the given IScriptLoadSource.
      Specified by:
      shouldApplyOn in interface IAction
      Parameters:
      source - The IScriptLoadSource responsible for loading the scripts.
      Returns:
      If the action should be applied.
    • getTargetCommandString

      public String getTargetCommandString()