Dieser Commit ist enthalten in:
Ursprung
a69a5bfe36
Commit
e9dc60de38
@ -27,7 +27,7 @@ import java.util.Set;
|
|||||||
public class ChunkHider14 extends ChunkHider9 {
|
public class ChunkHider14 extends ChunkHider9 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out) {
|
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||||
out.writeShort(in.readShort()); // Block count
|
out.writeShort(in.readShort()); // Block count
|
||||||
byte bitsPerBlock = in.readByte();
|
byte bitsPerBlock = in.readByte();
|
||||||
out.writeByte(bitsPerBlock);
|
out.writeByte(bitsPerBlock);
|
||||||
@ -37,6 +37,6 @@ public class ChunkHider14 extends ChunkHider9 {
|
|||||||
obfuscate = Collections.emptySet();
|
obfuscate = Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock);
|
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class ChunkHider18 implements ChunkHider {
|
|||||||
int zOffset = 16*chunkZ;
|
int zOffset = 16*chunkZ;
|
||||||
for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) {
|
for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) {
|
||||||
int finalYOffset = yOffset;
|
int finalYOffset = yOffset;
|
||||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+finalYOffset, z+zOffset), obfuscationTarget, obfuscate, in, out);
|
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+finalYOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, yOffset/16, chunkZ));
|
||||||
}
|
}
|
||||||
out.writeBytes(in); // MC appends a 0 byte at the end if there is a full chunk, idk why
|
out.writeBytes(in); // MC appends a 0 byte at the end if there is a full chunk, idk why
|
||||||
|
|
||||||
@ -95,10 +95,10 @@ public class ChunkHider18 implements ChunkHider {
|
|||||||
return !hiddenBlockEntities.contains((String) getName.invoke(getKey.invoke(tileEntityTypes, entityType.get(tile))));
|
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) {
|
private void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||||
out.writeShort(in.readShort()); // Block count
|
out.writeShort(in.readShort()); // Block count
|
||||||
|
|
||||||
containerWalker(in, out, 15, obfuscationTarget, obfuscate, (paletteTarget, dataArrayLength, bitsPerBlock) -> {
|
containerWalker(in, out, 15, obfuscationTarget, skip ? Collections.emptySet() : obfuscate, (paletteTarget, dataArrayLength, bitsPerBlock) -> {
|
||||||
Set<Integer> palettedObfuscate;
|
Set<Integer> palettedObfuscate;
|
||||||
if(bitsPerBlock < 15) {
|
if(bitsPerBlock < 15) {
|
||||||
palettedObfuscate = Collections.emptySet();
|
palettedObfuscate = Collections.emptySet();
|
||||||
@ -107,6 +107,11 @@ public class ChunkHider18 implements ChunkHider {
|
|||||||
palettedObfuscate = obfuscate;
|
palettedObfuscate = obfuscate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(skip || dataArrayLength == 0) {
|
||||||
|
out.writeBytes(in, dataArrayLength*8);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
long[] array = new long[dataArrayLength];
|
long[] array = new long[dataArrayLength];
|
||||||
for(int i = 0; i < dataArrayLength; i++)
|
for(int i = 0; i < dataArrayLength; i++)
|
||||||
array[i] = in.readLong();
|
array[i] = in.readLong();
|
||||||
|
@ -77,7 +77,7 @@ public class ProtocolWrapper18 implements ProtocolWrapper {
|
|||||||
newPos[i] = poss.get(i);
|
newPos[i] = poss.get(i);
|
||||||
|
|
||||||
multiBlockChangePos.set(packet, newPos);
|
multiBlockChangePos.set(packet, newPos);
|
||||||
multiBlockChangeBlocks.set(packet, blocks.toArray());
|
multiBlockChangeBlocks.set(packet, blocks.toArray(new IBlockData[0]));
|
||||||
return packet;
|
return packet;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import com.comphenix.tinyprotocol.Reflection;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
@ -67,7 +68,7 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
|||||||
if(blockChangeInfos.isEmpty())
|
if(blockChangeInfos.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
multiBlockChangeInfos.set(packet, blockChangeInfos.toArray(mbcis));
|
multiBlockChangeInfos.set(packet, blockChangeInfos.toArray((Object[])Array.newInstance(multiBlockChangeInfo, 0)));
|
||||||
return packet;
|
return packet;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class ChunkHider9 extends ChunkHider8 {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int yOffset = 16*chunkY;
|
int yOffset = 16*chunkY;
|
||||||
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+yOffset, z+zOffset), obfuscationTarget, obfuscate, in, out);
|
dataHider((x, y, z) -> locationEvaluator.check(p, x+xOffset, y+yOffset, z+zOffset), obfuscationTarget, obfuscate, in, out, locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ));
|
||||||
}
|
}
|
||||||
byte[] data = new byte[out.readableBytes()];
|
byte[] data = new byte[out.readableBytes()];
|
||||||
out.readBytes(data);
|
out.readBytes(data);
|
||||||
@ -77,25 +77,30 @@ public class ChunkHider9 extends ChunkHider8 {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out) {
|
protected void dataHider(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, boolean skip) {
|
||||||
byte bitsPerBlock = in.readByte();
|
byte bitsPerBlock = in.readByte();
|
||||||
out.writeByte(bitsPerBlock);
|
out.writeByte(bitsPerBlock);
|
||||||
|
|
||||||
int paletteTarget = ChunkHider.processPalette(obfuscationTarget, obfuscate, in, out);
|
int paletteTarget = ChunkHider.processPalette(obfuscationTarget, skip ? Collections.emptySet() : obfuscate, in, out);
|
||||||
if(bitsPerBlock < 13) {
|
if(bitsPerBlock < 13) {
|
||||||
obfuscationTarget = paletteTarget;
|
obfuscationTarget = paletteTarget;
|
||||||
obfuscate = Collections.emptySet();
|
obfuscate = Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock);
|
processDataArray(locationEvaluator, obfuscationTarget, obfuscate, in, out, bitsPerBlock, skip);
|
||||||
|
|
||||||
out.writeBytes(in, 4096); //Skylight (Not in Nether/End!!!) 2048 + Blocklight 2048
|
out.writeBytes(in, 4096); //Skylight (Not in Nether/End!!!) 2048 + Blocklight 2048
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processDataArray(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, int bitsPerBlock) {
|
protected void processDataArray(PosEvaluator locationEvaluator, int obfuscationTarget, Set<Integer> obfuscate, ByteBuf in, ByteBuf out, int bitsPerBlock, boolean skip) {
|
||||||
int dataArrayLength = ProtocolUtils.readVarInt(in);
|
int dataArrayLength = ProtocolUtils.readVarInt(in);
|
||||||
ProtocolUtils.writeVarInt(out, dataArrayLength);
|
ProtocolUtils.writeVarInt(out, dataArrayLength);
|
||||||
|
|
||||||
|
if(skip) {
|
||||||
|
out.writeBytes(in, dataArrayLength*8);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, in);
|
VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, in);
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren