9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 11:39:07 +00:00

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

@@ -1401,4 +1401,9 @@ public interface Hunk<T> {
c[0] = x;
c[1] = y;
}
default boolean isEmpty()
{
return false;
}
}

View File

@@ -43,6 +43,11 @@ public class MappedHunk<T> extends StorageHunk<T> implements Hunk<T> {
return data.size();
}
public boolean isEmpty()
{
return data.isEmpty();
}
@Override
public void setRaw(int x, int y, int z, T t) {
if (t == null) {

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());
}
}