Block precise TechHider (preparation for block HullHider) #257
@ -27,7 +27,7 @@ import java.util.Set;
|
||||
public class ChunkHider14 extends ChunkHider9 {
|
||||
|
||||
@Override
|
||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip, boolean blockPrecise) {
|
||||
out.writeShort(in.readShort()); // Block count
|
||||
byte bitsPerBlock = in.readByte();
|
||||
out.writeByte(bitsPerBlock);
|
||||
@ -37,6 +37,6 @@ public class ChunkHider14 extends ChunkHider9 {
|
||||
obfuscate = Collections.emptySet();
|
||||
}
|
||||
|
||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip);
|
||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip || (!blockPrecise && bitsPerBlock < 9));
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,8 @@ public class ChunkHider18 implements ChunkHider {
|
||||
int zOffset = 16*chunkZ;
|
||||
for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) {
|
||||
int finalYOffset = yOffset;
|
||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+finalYOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, yOffset/16, chunkZ));
|
||||
int chunkY = yOffset/16;
|
||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+finalYOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ), locationEvaluator.blockPrecise(p, chunkX, chunkY, chunkZ));
|
||||
}
|
||||
out.writeBytes(in); // MC appends a 0 byte at the end if there is a full chunk, idk why
|
||||
|
||||
@ -95,7 +96,7 @@ public class ChunkHider18 implements ChunkHider {
|
||||
return !hiddenBlockEntities.contains((String) getName.invoke(getKey.invoke(tileEntityTypes, entityType.get(tile))));
|
||||
}
|
||||
|
||||
private void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||
private void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip, boolean blockPrecise) {
|
||||
out.writeShort(in.readShort()); // Block count
|
||||
|
||||
containerWalker(in, out, 15, obfuscationTarget, skip ? Collections.emptySet() : obfuscate, (paletteTarget, dataArrayLength, bitsPerBlock) -> {
|
||||
@ -107,7 +108,7 @@ public class ChunkHider18 implements ChunkHider {
|
||||
palettedObfuscate = obfuscate;
|
||||
}
|
||||
|
||||
if(skip || dataArrayLength == 0) {
|
||||
if(skip || dataArrayLength == 0 || (!blockPrecise && bitsPerBlock < 15)) {
|
||||
out.writeBytes(in, dataArrayLength*8);
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class ChunkHider9 extends ChunkHider8 {
|
||||
continue;
|
||||
|
||||
int yOffset = 16*chunkY;
|
||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+yOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ));
|
||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+yOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ), locationEvaluator.blockPrecise(p, chunkX, chunkY, chunkZ));
|
||||
}
|
||||
byte[] data = new byte[out.readableBytes()];
|
||||
out.readBytes(data);
|
||||
@ -77,7 +77,7 @@ public class ChunkHider9 extends ChunkHider8 {
|
||||
};
|
||||
}
|
||||
|
||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip, boolean blockPrecise) {
|
||||
byte bitsPerBlock = in.readByte();
|
||||
out.writeByte(bitsPerBlock);
|
||||
|
||||
@ -87,7 +87,7 @@ public class ChunkHider9 extends ChunkHider8 {
|
||||
obfuscate = Collections.emptySet();
|
||||
}
|
||||
|
||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip);
|
||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip || (!blockPrecise && bitsPerBlock < 9));
|
||||
|
||||
out.writeBytes(in, 4096); //Skylight (Not in Nether/End!!!) 2048 + Blocklight 2048
|
||||
}
|
||||
|
@ -160,5 +160,9 @@ public class TechHider {
|
||||
default State checkBlockPos(Player player, Object pos) {
|
||||
return check(player, blockPositionX.get(pos), blockPositionY.get(pos), blockPositionZ.get(pos));
|
||||
}
|
||||
|
||||
default boolean blockPrecise(Player player, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren