Class CompoundOrderedBlockListComparator

java.lang.Object
net.rodofire.easierworldcreator.blockdata.blocklist.ordered.comparator.OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
net.rodofire.easierworldcreator.blockdata.blocklist.ordered.comparator.CompoundOrderedBlockListComparator
Direct Known Subclasses:
FullOrderedBlockListComparator

public class CompoundOrderedBlockListComparator extends OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
CompoundOrderedBlockListComparator. The class provides the ability to add Nbt Compounds to the order blockList comparator
  • Constructor Details

    • CompoundOrderedBlockListComparator

      public CompoundOrderedBlockListComparator(net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound> state, List<net.minecraft.util.math.BlockPos> posList)
      init a default ordered blockList comparator
      Parameters:
      state - the pair of state and NbtCompound that will be tested and put (in the case it doesn't exist)
      posList - the blockPos that will be put related to the given state
    • CompoundOrderedBlockListComparator

      public CompoundOrderedBlockListComparator(Map<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>,List<net.minecraft.util.math.BlockPos>> info)
      init a comparator
      Parameters:
      info - the map that will be used to init the comparator
    • CompoundOrderedBlockListComparator

      public CompoundOrderedBlockListComparator()
      init an empty Compound Comparator
  • Method Details

    • put

      public void put(CompoundOrderedBlockListComparator comparator)
    • getPairs

      public List<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>> getPairs()
      Method to get the Set of pair that are saved in the comparator
      Returns:
      the list of pair
    • getPair

      public net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound> getPair(short index)
      method to get the Pair related to the index
      Parameters:
      index - the index of the Pair
      Returns:
      the Pair related to the index
    • getFirstPair

      public net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound> getFirstPair()
      Method to get the first Pair
      Returns:
      the first Pair
    • getLastPair

      public net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound> getLastPair()
      Method to get the last Pair
      Returns:
      the last Pair
    • getBlockStates

      public Set<net.minecraft.block.BlockState> getBlockStates()
      Method to get the set of BlockStates that are saved in the comparator
      Returns:
      the set of blockStates
    • getBlockState

      public net.minecraft.block.BlockState getBlockState(short index)
      method to get the blockState related to the index
      Parameters:
      index - the index of the BlockState
      Returns:
      the blockState related to the index
    • getFirstBlockState

      public net.minecraft.block.BlockState getFirstBlockState()
      Method to get the first BlockState
      Returns:
      the first BlockState
    • getLastBlockState

      public net.minecraft.block.BlockState getLastBlockState()
      Method to get the last BlockState
      Returns:
      the last BlockState
    • getCompounds

      public Set<net.minecraft.nbt.NbtCompound> getCompounds()
      Method to get the set of compound that are saved in the comparator
      Returns:
      the set of compound
    • getCompound

      public net.minecraft.nbt.NbtCompound getCompound(short index)
      method to get the blockState related to the index
      Parameters:
      index - the index of the BlockState
      Returns:
      the blockState related to the index
    • getFirstCompound

      public net.minecraft.nbt.NbtCompound getFirstCompound()
      Method to get the first BlockState
      Returns:
      the first BlockState
    • getLastCompound

      public net.minecraft.nbt.NbtCompound getLastCompound()
      Method to get the last BlockState
      Returns:
      the last BlockState
    • place

      public void place(net.minecraft.world.StructureWorldAccess world, int index)
      method to place the Block related to the index
      Specified by:
      place in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the block will be placed
      index - the index of the BlockPos
    • placeWithDeletion

      public void placeWithDeletion(net.minecraft.world.StructureWorldAccess world, int index)
      method to place the block with the deletion of the BlockPos
      Specified by:
      placeWithDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the block will be placed
      index - the index of the block
    • placeWithVerification

      public boolean placeWithVerification(net.minecraft.world.StructureWorldAccess world, int index)
      Method to place the block related to the index. The method also performs verification to know if the block can be placed.
      Specified by:
      placeWithVerification in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the block will be placed
      index - the index of the block
      Returns:
      true if the block was placed, false if not
    • placeWithVerificationDeletion

      public boolean placeWithVerificationDeletion(net.minecraft.world.StructureWorldAccess world, int index)
      Method to place the block with the deletion of the BlockPos The method also performs verification to know if the block can be placed.
      Specified by:
      placeWithVerificationDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the block will be placed
      index - the index of the block
      Returns:
      true if the block was placed, false if not
    • placeFirst

      public void placeFirst(net.minecraft.world.StructureWorldAccess world)
      method to place the first Block
      Specified by:
      placeFirst in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the block will be placed
    • placeFirstWithDeletion

      public void placeFirstWithDeletion(net.minecraft.world.StructureWorldAccess world)
      Method to place the first Block and deleting it. You shouldn't use this method in normal case since that the method is pretty costly O(n). Use instead placeLastWithDeletion() that is faster O(1).
      Specified by:
      placeFirstWithDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world where the block will be placed
    • placeFirstWithVerification

      public boolean placeFirstWithVerification(net.minecraft.world.StructureWorldAccess world)
      Method to place the first Block.

      The method also performs verification to know if the block can be placed.

      Specified by:
      placeFirstWithVerification in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world where the block will be placed
      Returns:
      true if the block was placed, false if not.
    • placeFirstWithVerificationDeletion

      public boolean placeFirstWithVerificationDeletion(net.minecraft.world.StructureWorldAccess world)

      Method to place the first Block and deleting it.

      The method also performs verification to know if the block can be placed.

      You shouldn't use this method in normal case since that the method is pretty costly O(n).

      Use instead placeLastWithDeletion() that is faster O(1).

      Specified by:
      placeFirstWithVerificationDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world where the block will be placed
      Returns:
      true if the block was placed, false if not.
    • placeLastWithDeletion

      public void placeLastWithDeletion(net.minecraft.world.StructureWorldAccess world)
      Method to place the last Block of the comparator and removing it then. Consider using this method because it gives you better performance.
      Specified by:
      placeLastWithDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the last block will be placed
    • placeLast

      public void placeLast(net.minecraft.world.StructureWorldAccess world)
      Method to place the last Block of the comparator.
      Specified by:
      placeLast in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the last block will be placed
    • placeLastWithVerification

      public boolean placeLastWithVerification(net.minecraft.world.StructureWorldAccess world)
      Method to place the last Block.
      Specified by:
      placeLastWithVerification in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the last block will be placed The method also performs verification to know if the block can be placed.
      Returns:
      true if the block was placed, false if not
    • placeLastWithVerificationDeletion

      public boolean placeLastWithVerificationDeletion(net.minecraft.world.StructureWorldAccess world)
      Method to place the last Block of the comparator and removing it then. The method also performs verification to know if the block can be placed. Consider using this method because it gives you better performance.
      Specified by:
      placeLastWithVerificationDeletion in class OrderedBlockListComparator<net.minecraft.util.Pair<net.minecraft.block.BlockState,net.minecraft.nbt.NbtCompound>>
      Parameters:
      world - the world the last block will be placed
      Returns:
      true if the block was placed, false if not