Addd get/setBlock to the interface of ChunkSection

This commit is contained in:
Matsv 2017-06-01 15:44:41 +02:00
parent a8e3d9ec95
commit 08528a1745
3 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,10 @@ package us.myles.ViaVersion.api.minecraft.chunks;
import io.netty.buffer.ByteBuf;
public interface ChunkSection {
int getBlock(int x, int y, int z);
void setBlock(int x, int y, int z, int type, int data);
int getBlockId(int x, int y, int z);
void writeBlocks(ByteBuf output) throws Exception;

View File

@ -48,8 +48,12 @@ public class ChunkSection1_9_1_2 implements ChunkSection {
}
public int getBlockId(int x, int y, int z) {
return getBlock(x, y, z) >> 4;
}
public int getBlock(int x, int y, int z) {
int index = blocks[index(x, y, z)];
return palette.get(index) >> 4;
return palette.get(index);
}
/**

View File

@ -47,8 +47,12 @@ public class ChunkSection1_9to1_8 implements ChunkSection {
}
public int getBlockId(int x, int y, int z) {
return getBlock(x, y, z) >> 4;
}
public int getBlock(int x, int y, int z) {
int index = blocks[index(x, y, z)];
return palette.get(index) >> 4;
return palette.get(index);
}
/**