Beautify updates keys

This commit is contained in:
Daniel Mills
2021-08-06 23:08:48 -04:00
parent e9f4c3d0c7
commit a2a7689881
6 changed files with 118 additions and 20 deletions

View File

@@ -332,4 +332,16 @@ public interface Matter {
return matter;
}
default int getTotalCount()
{
int m = 0;
for(MatterSlice<?> i : getSliceMap().values())
{
m+= i.getCount();
}
return m;
}
}

View File

@@ -26,6 +26,7 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.util.BlockVector;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -145,4 +146,19 @@ public interface MatterSlice<T> extends Hunk<T> {
default void rotateSliceInto(Matter n, double x, double y, double z) {
rotate(x, y, z, (_x, _y, _z) -> n.slice(getType()));
}
default boolean containsKey(BlockVector v)
{
return get(v.getBlockX(), v.getBlockY(), v.getBlockZ()) != null;
}
default void put(BlockVector v, T d)
{
set(v.getBlockX(), v.getBlockY(), v.getBlockZ(), d);
}
default T get(BlockVector v)
{
return get(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
}