mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-08 16:56:25 +00:00
Not worth,
This commit is contained in:
@@ -44,6 +44,44 @@ public class PaletteHunk<T> extends StorageHunk<T> implements Hunk<T> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Hunk<T> iterateSync(Consumer4<Integer, Integer, Integer, T> c) {
|
||||
for(int i = 0; i < getWidth(); i++)
|
||||
{
|
||||
for(int j = 0; j < getHeight(); j++)
|
||||
{
|
||||
for(int k = 0; k < getDepth(); k++)
|
||||
{
|
||||
T t = getRaw(i,j,k);
|
||||
if(t != null)
|
||||
{
|
||||
c.accept(i,j,k,t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Hunk<T> iterateSyncIO(Consumer4IO<Integer, Integer, Integer, T> c) throws IOException {
|
||||
for(int i = 0; i < getWidth(); i++)
|
||||
{
|
||||
for(int j = 0; j < getHeight(); j++)
|
||||
{
|
||||
for(int k = 0; k < getDepth(); k++)
|
||||
{
|
||||
T t = getRaw(i,j,k);
|
||||
if(t != null)
|
||||
{
|
||||
c.accept(i,j,k,t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, T t) {
|
||||
data.set(x,y,z,t);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util.hunk.storage;
|
||||
|
||||
import com.volmit.iris.util.data.palette.PalettedContainer;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.function.Consumer4IO;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
@@ -33,6 +34,23 @@ public class PaletteOrHunk<T> extends StorageHunk<T> implements Hunk<T> {
|
||||
hunk = width == 16 && height == 16 && depth == 16 ? new PaletteHunk<>() : factory.get();
|
||||
}
|
||||
|
||||
public PalettedContainer<T> palette()
|
||||
{
|
||||
return isPalette() ? ((PaletteHunk<T>)hunk).getData() : null;
|
||||
}
|
||||
|
||||
public void palette(PalettedContainer<T> t)
|
||||
{
|
||||
if(isPalette()){
|
||||
((PaletteHunk<T>)hunk).setData(t);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPalette()
|
||||
{
|
||||
return getWidth() == 16 && getHeight() == 16 && getDepth() == 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, T t) {
|
||||
hunk.setRaw(x,y,z,t);
|
||||
|
||||
Reference in New Issue
Block a user