Record Class BlockChange
java.lang.Object
java.lang.Record
com.sk89q.worldedit.history.change.BlockChange
- Record Components:
position
- the positionprevious
- the previous blockcurrent
- the current block
- All Implemented Interfaces:
Change
public record BlockChange(BlockVector3 position, BaseBlock previous, BaseBlock current)
extends Record
implements Change
Represents a block change that may be undone or replayed.
This block change does not have an Extent
assigned to it because
one will be taken from the passed UndoContext
. If the context
does not have an extent (it is null), cryptic errors may occur.
-
Constructor Summary
ConstructorDescriptionBlockChange
(BlockVector3 position, BP previous, BC current) Create a new block change.BlockChange
(BlockVector3 position, BaseBlock previous, BaseBlock current) Create a new block change. -
Method Summary
Modifier and TypeMethodDescriptioncurrent()
Returns the value of thecurrent
record component.final boolean
Indicates whether some other object is "equal to" this one.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.useposition()
Deprecated, for removal: This API element is subject to removal in a future version.useprevious()
final int
hashCode()
Returns a hash code value for this object.position()
Returns the value of theposition
record component.previous()
Returns the value of theprevious
record component.void
redo
(UndoContext context) Perform an redo.final String
toString()
Returns a string representation of this record class.void
undo
(UndoContext context) Perform an undo.
-
Constructor Details
-
BlockChange
Create a new block change. -
BlockChange
Create a new block change.- Parameters:
position
- the positionprevious
- the previous blockcurrent
- the current block
-
-
Method Details
-
getPosition
Deprecated, for removal: This API element is subject to removal in a future version.useposition()
Get the position.- Returns:
- the position
-
getPrevious
Deprecated, for removal: This API element is subject to removal in a future version.useprevious()
Get the previous block.- Returns:
- the previous block
-
getCurrent
Deprecated, for removal: This API element is subject to removal in a future version.usecurrent()
Get the current block.- Returns:
- the current block
-
undo
Description copied from interface:Change
Perform an undo. This method may not be available if the object was returned fromChangeSet.forwardIterator()
.- Specified by:
undo
in interfaceChange
- Parameters:
context
- a context for undo- Throws:
WorldEditException
- on an error
-
redo
Description copied from interface:Change
Perform an redo. This method may not be available if the object was returned fromChangeSet.backwardIterator()
()}.- Specified by:
redo
in interfaceChange
- Parameters:
context
- a context for redo- Throws:
WorldEditException
- on an error
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
position
Returns the value of theposition
record component.- Returns:
- the value of the
position
record component
-
previous
Returns the value of theprevious
record component.- Returns:
- the value of the
previous
record component
-
current
Returns the value of thecurrent
record component.- Returns:
- the value of the
current
record component
-
current()