commoble.bagofyurting

## Class BlockRemovalSorter

- java.lang.Object
- - commoble.bagofyurting.BlockRemovalSorter

All Implemented Interfaces:
  java.util.Comparator<net.minecraft.util.math.BlockPos>

    public class BlockRemovalSorter
    extends java.lang.Object
    implements java.util.Comparator<net.minecraft.util.math.BlockPos>

### Constructor Summary

Constructors
Constructor and Description
`BlockRemovalSorter(net.minecraft.world.World world)`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compare(net.minecraft.util.math.BlockPos posA, net.minecraft.util.math.BlockPos posB)` When we remove blocks, we want to remove them in layers from top to bottom, with the non-solid blocks in each layer being removed before the solid blocks.
`int` `getSortValue(net.minecraft.util.math.BlockPos pos)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Constructor Detail

#### BlockRemovalSorter

    public BlockRemovalSorter(net.minecraft.world.World world)

### Method Detail

#### compare

    public int compare(net.minecraft.util.math.BlockPos posA,
                       net.minecraft.util.math.BlockPos posB)

When we remove blocks, we want to remove them in layers from top to bottom, with the non-solid blocks in each layer being removed before the solid blocks. We can assume some things: -- the y-difference between posA and posB is less than a few hundred -- no y-level in posA or posB will be close to the largest positive or lowest negative integer in java if we sort a list, the lowest-valued thing will be first, so we want the highest-y-value to have the lowest sorting value Solution: "double" the y-position (all y-levels are now even) and if the block is non-solid, add 1 to it (making it appear "higher" than solid blocks in the same layer, but not higher than the next layer)

Specified by:
  `compare` in interface `java.util.Comparator<net.minecraft.util.math.BlockPos>`

#### getSortValue

    public int getSortValue(net.minecraft.util.math.BlockPos pos)