Package com.ldtteam.structurize.util
Class ChangeStorage
java.lang.Object
com.ldtteam.structurize.util.ChangeStorage
Change storage to store changes to an area to be able to undo them.
-
Constructor Summary
ConstructorsConstructorDescriptionChangeStorage(net.minecraft.network.chat.Component operation, UUID player) Initiate an empty changeStorage to manually fill it.ChangeStorage(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos from, net.minecraft.core.BlockPos to, net.minecraft.network.chat.Component operation) Inititate the change storage with the world to calc the positions. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntities(List<net.minecraft.world.entity.Entity> list) Add entities to list to be readded.voidaddPostDataFor(net.minecraft.core.BlockPos place, net.minecraft.world.level.Level world) Add a position storage to the list.voidaddPreviousDataFor(net.minecraft.core.BlockPos place, net.minecraft.world.level.Level world) Add a position storage to the list.voidaddToBeKilledEntity(net.minecraft.world.entity.Entity entity) Add a entity to be killed to the list.intgetID()Get this change storages unique IDnet.minecraft.network.chat.ComponentGet the operation of this changestorageGet the players IDbooleanisDone()Check whether the current operation on this is donebooleanredo(net.minecraft.world.level.Level world) Reload the previous state of the positions.voidResets the iterationbooleanundo(net.minecraft.world.level.Level world, @Nullable ChangeStorage undoStorage) Reload the previous state of the positions.
-
Constructor Details
-
ChangeStorage
Initiate an empty changeStorage to manually fill it.- Parameters:
player- the player owner of it.
-
ChangeStorage
public ChangeStorage(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos from, net.minecraft.core.BlockPos to, net.minecraft.network.chat.Component operation) Inititate the change storage with the world to calc the positions.- Parameters:
world- the world.from- the first position.to- the second position.
-
-
Method Details
-
addPreviousDataFor
public void addPreviousDataFor(net.minecraft.core.BlockPos place, net.minecraft.world.level.Level world) Add a position storage to the list.- Parameters:
place- the place.world- the world.
-
addPostDataFor
public void addPostDataFor(net.minecraft.core.BlockPos place, net.minecraft.world.level.Level world) Add a position storage to the list.- Parameters:
place- the place.world- the world.
-
addEntities
Add entities to list to be readded.- Parameters:
list- the list of entities.
-
addToBeKilledEntity
public void addToBeKilledEntity(net.minecraft.world.entity.Entity entity) Add a entity to be killed to the list.- Parameters:
entity- the place.
-
undo
public boolean undo(net.minecraft.world.level.Level world, @Nullable @Nullable ChangeStorage undoStorage) Reload the previous state of the positions.- Parameters:
world- the world to manipulate.undoStorage-- Returns:
- true if successful.
-
redo
public boolean redo(net.minecraft.world.level.Level world) Reload the previous state of the positions.- Parameters:
world- the world to manipulate.- Returns:
- true if successful.
-
getOperation
public net.minecraft.network.chat.Component getOperation()Get the operation of this changestorage- Returns:
-
resetUnRedo
public void resetUnRedo()Resets the iteration -
isDone
public boolean isDone()Check whether the current operation on this is done- Returns:
-
getID
public int getID()Get this change storages unique ID- Returns:
-
getPlayerID
Get the players ID- Returns:
-