code stringlengths 31 2.05k | label_name stringclasses 5 values | label int64 0 4 |
|---|---|---|
public void writeData(LPDataOutput output) throws IOException {
output.writeInt(satID);
super.writeData(output);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
satID = input.readInt();
super.readData(input);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
super.readData(input);
side = input.readForgeDirection();
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
super.writeData(output);
output.writeForgeDirection(side);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
super.writeData(output);
output.writeForgeDirection(side);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
super.readData(input);
side = input.readForgeDirection();
} | Base | 1 |
public boolean getTurtleConnect() {
if (container instanceof LogisticsTileGenericPipe) {
return container.getTurtleConnect();
}
return false;
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
isOpaqueClientSide = input.readBoolean();
} | Base | 1 |
public void setTurtleConnect(Boolean flag) {
if (container instanceof LogisticsTileGenericPipe) {
container.setTurtleConnect(flag);
}
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeBoolean(isOpaque());
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
pipeId = input.readInt();
} | Base | 1 |
public void setTurtleConnect(boolean flag) {
SimpleServiceLocator.ccProxy.setTurtleConnect(flag, this);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeInt(pipeId);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
if (orientation == null) {
output.writeBoolean(false);
} else {
output.writeBoolean(true);
output.writeEnum(orientation);
}
} | Base | 1 |
public void setOnPipe(CoreMultiBlockPipe pipe) {
((HSTubeCurve) pipe).orientation = this;
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
if (input.readBoolean()) {
orientation = input.readEnum(CurveOrientation.class);
}
} | Base | 1 |
public void rotatePositions(IPositionRotateble set) {
renderOrientation.rotatePositions(set);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
if (orientation == null) {
output.writeBoolean(false);
} else {
output.writeBoolean(true);
output.writeEnum(orientation);
}
} | Base | 1 |
TubeGainRenderOrientation(ForgeDirection dir) {
this.dir = dir;
} | Base | 1 |
public void rotatePositions(IPositionRotateble set) {
renderOrientation.rotateOrientation(set);
} | Base | 1 |
public void setOnPipe(CoreMultiBlockPipe pipe) {
((HSTubeGain) pipe).orientation = this;
} | Base | 1 |
public void rotateOrientation(IPositionRotateble set) {
if (this == EAST) {
set.rotateRight();
} else if (this == WEST) {
set.rotateLeft();
} else if (this == SOUTH) {
set.rotateLeft();
set.rotateLeft();
}
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
if (input.readBoolean()) {
orientation = input.readEnum(TubeGainOrientation.class);
}
} | Base | 1 |
TubeGainOrientation(TubeGainRenderOrientation render, DoubleCoordinates off, ForgeDirection dir) {
renderOrientation = render;
offset = off;
this.dir = dir;
} | Base | 1 |
public void rotatePositions(IPositionRotateble set) {
renderOrientation.rotateOrientation(set);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
if (orientation == null) {
output.writeBoolean(false);
} else {
output.writeBoolean(true);
output.writeEnum(orientation);
}
} | Base | 1 |
public void setOnPipe(CoreMultiBlockPipe pipe) {
((HSTubeLine) pipe).orientation = this;
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
if (input.readBoolean()) {
orientation = input.readEnum(TubeLineOrientation.class);
}
} | Base | 1 |
TubeLineRenderOrientation(ForgeDirection dir) {
this.dir = dir;
} | Base | 1 |
TubeLineOrientation(TubeLineRenderOrientation render, DoubleCoordinates off, ForgeDirection dir) {
renderOrientation = render;
offset = off;
this.dir = dir;
} | Base | 1 |
public void rotateOrientation(IPositionRotateble set) {
if (this == EAST_WEST) {
set.rotateLeft();
}
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
if (input.readBoolean()) {
orientation = input.readEnum(CurveSOrientation.class);
}
} | Base | 1 |
public void rotatePositions(IPositionRotateble set) {
renderOrientation.rotatePositions(set);
} | Base | 1 |
public void setOnPipe(CoreMultiBlockPipe pipe) {
((HSTubeSCurve) pipe).orientation = this;
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
if (orientation == null) {
output.writeBoolean(false);
} else {
output.writeBoolean(true);
output.writeEnum(orientation);
}
} | Base | 1 |
public void rotatePositions(IPositionRotateble set) {
if (this == SOUTH) {
set.rotateLeft();
set.rotateLeft();
} else if (this == EAST) {
set.rotateRight();
} else if (this == WEST) {
set.rotateLeft();
}
} | Base | 1 |
public ITubeRenderOrientation getRenderOrientation() {
return this;
} | Base | 1 |
public DoubleCoordinates getOffset() {
return new DoubleCoordinates(0, 0, 0);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
orientation = input.readEnum(SpeedupDirection.class);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeEnum(orientation);
} | Base | 1 |
public void setOnPipe(CoreMultiBlockPipe pipe) {
((HSTubeSpeedup) pipe).orientation = this;
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {} | Base | 1 |
public void readData_LP(LPDataInput input) throws IOException {
if (input.readBoolean()) {
ByteBuf buf = input.readByteBuf();
readData(buf);
}
} | Base | 1 |
public void writeData_LP(LPDataOutput output) throws IOException {
output.writeBoolean(true);
ByteBuf buf = Unpooled.buffer(128);
writeData(buf);
output.writeByteBuf(buf);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
ByteBuf buf = Unpooled.buffer(128);
this.writeData(buf);
output.writeByteBuf(buf);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
ByteBuf buf = input.readByteBuf();
this.readData(buf);
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeByte(mask);
output.writeByte(isBCPipeMask);
output.writeByte(isTDPipeMask);
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
byte newMask = input.readByte();
if (newMask != mask) {
mask = newMask;
dirty = true;
}
newMask = input.readByte();
if (newMask != isBCPipeMask) {
isBCPipeMask = newMask;
dirty = true;
}
newMask = input.readByte();
if (newMask != isTDPipeMask) {
isTDPipeMask = newMask;
dirty = true;
}
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
pipeConnectionMatrix.writeData(output);
textureMatrix.writeData(output);
bcRenderState.writeData_LP(output); //Always needs to be last. Different length depending on proxy loading state.
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
pipeConnectionMatrix.readData(input);
textureMatrix.readData(input);
bcRenderState.readData_LP(input); //Always needs to be last. Different length depending on proxy loading state.
} | Base | 1 |
public void readData(LPDataInput input) throws IOException {
for (int i = 0; i < iconIndexes.length; i++) {
int icon = input.readByte();
if (iconIndexes[i] != icon) {
iconIndexes[i] = icon;
dirty = true;
}
}
textureIndex = input.readInt();
isRouted = input.readBoolean();
isRoutedInDir = input.readBooleanArray();
isSubPowerInDir = input.readBooleanArray();
hasPowerUpgrade = input.readBoolean();
hasPower = input.readBoolean();
isFluid = input.readBoolean();
pointedOrientation = input.readForgeDirection();
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
for (int iconIndexe : iconIndexes) {
output.writeByte(iconIndexe);
}
output.writeInt(textureIndex);
output.writeBoolean(isRouted);
output.writeBooleanArray(isRoutedInDir);
output.writeBooleanArray(isSubPowerInDir);
output.writeBoolean(hasPowerUpgrade);
output.writeBoolean(hasPower);
output.writeBoolean(isFluid);
output.writeForgeDirection(pointedOrientation);
} | Base | 1 |
public void setCCType(Object type) {
ccObject = type;
} | Base | 1 |
public DictResource(LPDataInput input) throws IOException {
stack = input.readItemIdentifierStack();
requester = null;
BitSet bits = input.readBitSet();
use_od = bits.get(0);
ignore_dmg = bits.get(1);
ignore_nbt = bits.get(2);
use_category = bits.get(3);
} | Base | 1 |
public Object getCCType() {
return ccObject;
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeItemIdentifierStack(stack);
BitSet bits = new BitSet();
bits.set(0, use_od);
bits.set(1, ignore_dmg);
bits.set(2, ignore_nbt);
bits.set(3, use_category);
output.writeBitSet(bits);
} | Base | 1 |
public Object getCCType() {
return ccObject;
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeItemIdentifier(liquid.getItemIdentifier());
output.writeInt(amount);
} | Base | 1 |
public FluidResource(LPDataInput input) throws IOException {
liquid = FluidIdentifier.get(input.readItemIdentifier());
amount = input.readInt();
target = null;
} | Base | 1 |
public void setCCType(Object type) {
ccObject = type;
} | Base | 1 |
public ItemResource(LPDataInput input) throws IOException {
stack = input.readItemIdentifierStack();
requester = null;
} | Base | 1 |
public void setCCType(Object type) {
ccObject = type;
} | Base | 1 |
public Object getCCType() {
return ccObject;
} | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeItemIdentifierStack(stack);
} | Base | 1 |
public static IResource readResource(LPDataInput input) throws IOException {
int id = input.readInt();
if (id == -1) {
return null;
}
return ResourceNetwork.values()[id].readData(input);
} | Base | 1 |
ItemResource(ItemResource.class) {
@Override
protected IResource readData(LPDataInput input) throws IOException {
return new ItemResource(input);
}
}, | Base | 1 |
public static void writeResource(LPDataOutput output, IResource resource) throws IOException {
if (resource == null) {
output.writeInt(-1);
return;
}
ResourceNetwork[] values = ResourceNetwork.values();
for (ResourceNetwork value : values) {
if (value.clazz.isAssignableFrom(resource.getClass())) {
output.writeInt(value.ordinal());
resource.writeData(output);
return;
}
}
throw new UnsupportedOperationException(resource.getClass().toString());
} | Base | 1 |
FluidResource(FluidResource.class) {
@Override
protected IResource readData(LPDataInput input) throws IOException {
return new FluidResource(input);
}
}; | Base | 1 |
DictResource(DictResource.class) {
@Override
protected IResource readData(LPDataInput input) throws IOException {
return new DictResource(input);
}
}, | Base | 1 |
public void writeData(LPDataOutput output) throws IOException {
output.writeInt(posX);
output.writeInt(posY);
output.writeInt(posZ);
output.writeByte(dir.ordinal());
output.writeBoolean(finalPipe);
output.writeBoolean(startPipe);
output.writeInt(length);
for (PipeRoutingConnectionType type : PipeRoutingConnectionType.values()) {
output.writeBoolean(connectionType.contains(type));
}
} | Base | 1 |
public LaserData readData(LPDataInput input) throws IOException {
posX = input.readInt();
posY = input.readInt();
posZ = input.readInt();
dir = ForgeDirection.values()[input.readByte()];
finalPipe = input.readBoolean();
startPipe = input.readBoolean();
length = input.readInt();
connectionType = EnumSet.noneOf(PipeRoutingConnectionType.class);
for (PipeRoutingConnectionType type : PipeRoutingConnectionType.values()) {
if (input.readBoolean()) {
connectionType.add(type);
}
}
return this;
} | Base | 1 |
private static byte[] compress(byte[] content) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gzipOutputStream.write(content);
gzipOutputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return byteArrayOutputStream.toByteArray();
} | Base | 1 |
public void setPause(boolean flag) {
clientCompressorThread.setPause(flag);
} | Base | 1 |
public void clear() {
clientCompressorThread.clear();
clientDecompressorThread.clear();
} | Base | 1 |
private void handlePacketData(final Pair<EntityPlayer, byte[]> playerDataPair) {
try {
LPDataIOWrapper.provideData(playerDataPair.getValue2(), input -> {
PacketHandler.onPacketData(input, playerDataPair.getValue1());
});
} catch (IOException e) {
System.err.println("IO Error in handlePacketData for player " + playerDataPair.getValue1().getCommandSenderName());
e.printStackTrace();
}
} | Base | 1 |
private static byte[] decompress(byte[] contentBytes) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(contentBytes));
int buffer = 0;
while ((buffer = gzip.read()) != -1) {
out.write(buffer);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return out.toByteArray();
} | Base | 1 |
public void run() {
while (true) {
boolean flag;
do {
flag = false;
byte[] buffer = null;
synchronized (queue) {
if (queue.size() > 0) {
flag = true;
buffer = queue.getFirst();
queue.removeFirst();
}
}
if (flag && buffer != null) {
byte[] packetbytes = ClientPacketBufferHandlerThread.decompress(buffer);
byte[] newBuffer = new byte[packetbytes.length + ByteBuffer.length];
System.arraycopy(ByteBuffer, 0, newBuffer, 0, ByteBuffer.length);
System.arraycopy(packetbytes, 0, newBuffer, ByteBuffer.length, packetbytes.length);
ByteBuffer = newBuffer;
}
} while (flag);
while (ByteBuffer.length >= 4) {
int size = ((ByteBuffer[0] & 255) << 24) + ((ByteBuffer[1] & 255) << 16) + ((ByteBuffer[2] & 255) << 8) + ((ByteBuffer[3] & 255) << 0);
if (size + 4 > ByteBuffer.length) {
break;
}
byte[] packet = Arrays.copyOfRange(ByteBuffer, 4, size + 4);
ByteBuffer = Arrays.copyOfRange(ByteBuffer, size + 4, ByteBuffer.length);
packetBufferLock.lock();
try {
PacketBuffer.add(new Pair<>(MainProxy.proxy.getClientPlayer(), packet));
} finally {
packetBufferLock.unlock();
}
}
synchronized (queue) {
while (queue.size() == 0) {
try {
queue.wait();
} catch (InterruptedException e) { }
}
}
if (clear) {
clear = false;
ByteBuffer = new byte[] {};
}
}
} | Base | 1 |
public ClientPacketBufferHandlerThread() {} | Base | 1 |
public void clientTick(ClientTickEvent event) {
if (event.phase != Phase.END) {
return;
}
clientDecompressorThread.clientTickEnd();
} | Base | 1 |
public void run() {
while (true) {
try {
synchronized (clientList) {
if (!pause && clientList.size() > 0) {
clientBuffer = LPDataIOWrapper.collectData(output -> {
output.writeBytes(clientBuffer);
clearLock.lock();
try {
for (ModernPacket packet : clientList) {
output.writeShort(packet.getId());
output.writeInt(packet.getDebugId());
packet.writeData(output);
}
} finally {
clientList.clear();
clearLock.unlock();
}
});
}
}
//Send Content
if (clientBuffer.length > 0) {
while (clientBuffer.length > 1024 * 32) {
byte[] sendbuffer = Arrays.copyOf(clientBuffer, 1024 * 32);
clientBuffer = Arrays.copyOfRange(clientBuffer, 1024 * 32, clientBuffer.length);
byte[] compressed = ClientPacketBufferHandlerThread.compress(sendbuffer);
MainProxy.sendPacketToServer(PacketHandler.getPacket(BufferTransfer.class).setContent(compressed));
}
byte[] sendbuffer = clientBuffer;
clientBuffer = new byte[] {};
byte[] compressed = ClientPacketBufferHandlerThread.compress(sendbuffer);
MainProxy.sendPacketToServer(PacketHandler.getPacket(BufferTransfer.class).setContent(compressed));
}
} catch (IOException e) {
e.printStackTrace();
}
synchronized (clientList) {
while (pause || clientList.size() == 0) {
try {
clientList.wait();
} catch (InterruptedException e) {}
}
}
if (clear) {
clear = false;
clientBuffer = new byte[] {};
}
}
} | Base | 1 |
public void addPacketToCompressor(ModernPacket packet) {
clientCompressorThread.addPacketToCompressor(packet);
} | Base | 1 |
public void handlePacket(byte[] content) {
clientDecompressorThread.handlePacket(content);
} | Base | 1 |
public void queueFailedPacket(ModernPacket packet, EntityPlayer player) {
clientDecompressorThread.queueFailedPacket(packet, player);
} | Base | 1 |
private void handlePacketData(final Pair<EntityPlayer, byte[]> playerDataPair) {
try {
LPDataIOWrapper.provideData(playerDataPair.getValue2(), input -> {
PacketHandler.onPacketData(input, playerDataPair.getValue1());
});
} catch (IOException e) {
System.err.println("IO Error in handlePacketData for player " + playerDataPair.getValue1().getCommandSenderName());
e.printStackTrace();
}
} | Base | 1 |
public void handlePacket(byte[] content, EntityPlayer player) {
serverDecompressorThread.handlePacket(content, player);
} | Base | 1 |
private static byte[] decompress(byte[] contentBytes) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(contentBytes));
int buffer = 0;
while ((buffer = gzip.read()) != -1) {
out.write(buffer);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return out.toByteArray();
} | Base | 1 |
public void clear(final EntityPlayer player) {
new Thread() {
@Override
public void run() {
serverCompressorThread.clear(player);
serverDecompressorThread.clear(player);
}
}.start();
} | Base | 1 |
private static byte[] compress(byte[] content) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gzipOutputStream.write(content);
gzipOutputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return byteArrayOutputStream.toByteArray();
} | Base | 1 |
public void serverTick(ServerTickEvent event) {
if (event.phase != Phase.END) {
return;
}
serverDecompressorThread.serverTickEnd();
} | Base | 1 |
public void addPacketToCompressor(ModernPacket packet, EntityPlayer player) {
serverCompressorThread.addPacketToCompressor(packet, player);
} | Base | 1 |
public void setPause(boolean flag) {
serverCompressorThread.setPause(flag);
} | Base | 1 |
public ServerPacketBufferHandlerThread() {} | Base | 1 |
public ExitRoute readExitRoute(World world) throws IOException {
IRouter destination = readIRouter(world);
IRouter root = readIRouter(world);
ForgeDirection exitOri = readForgeDirection();
ForgeDirection insertOri = readForgeDirection();
EnumSet<PipeRoutingConnectionType> connectionDetails = readEnumSet(PipeRoutingConnectionType.class);
double distanceToDestination = localBuffer.readDouble();
double destinationDistanceToRoot = localBuffer.readDouble();
int blockDistance = localBuffer.readInt();
List<DoubleCoordinates> positions = readArrayList(LPDataInput::readLPPosition);
ExitRoute e = new ExitRoute(root, destination, exitOri, insertOri, destinationDistanceToRoot, connectionDetails, blockDistance);
e.distanceToDestination = distanceToDestination;
e.debug.filterPosition = positions;
e.debug.toStringNetwork = readUTF();
e.debug.isNewlyAddedCanidate = localBuffer.readBoolean();
e.debug.isTraced = localBuffer.readBoolean();
e.debug.index = localBuffer.readInt();
return e;
} | Base | 1 |
public void writeExitRoute(ExitRoute route) throws IOException {
writeIRouter(route.destination);
writeIRouter(route.root);
writeForgeDirection(route.exitOrientation);
writeForgeDirection(route.insertOrientation);
writeEnumSet(route.connectionDetails, PipeRoutingConnectionType.class);
writeDouble(route.distanceToDestination);
writeDouble(route.destinationDistanceToRoot);
writeInt(route.blockDistance);
writeCollection(route.filters, (data, filter) -> data.writeLPPosition(filter.getLPPosition()));
writeUTF(route.toString());
writeBoolean(route.debug.isNewlyAddedCanidate);
writeBoolean(route.debug.isTraced);
writeInt(route.debug.index);
} | Base | 1 |
public String readUTF() throws IOException {
byte[] arr = readByteArray();
if (arr == null) {
return null;
} else {
return new String(arr, UTF_8);
}
} | Base | 1 |
public <T> LinkedList<T> readLinkedList(IReadListObject<T> reader) throws IOException {
int size = readInt();
if (size == -1) {
return null;
}
LinkedList<T> list = new LinkedList<>();
for (int i = 0; i < size; i++) {
list.add(reader.readObject(this));
}
return list;
} | Base | 1 |
public <T> ArrayList<T> readArrayList(IReadListObject<T> reader) throws IOException {
int size = readInt();
if (size == -1) {
return null;
}
ArrayList<T> list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
list.add(reader.readObject(this));
}
return list;
} | Base | 1 |
public IOrderInfoProvider readOrderInfo() throws IOException {
ItemIdentifierStack stack = readItemIdentifierStack();
int routerId = localBuffer.readInt();
boolean isFinished = localBuffer.readBoolean();
boolean inProgress = localBuffer.readBoolean();
IOrderInfoProvider.ResourceType type = readEnum(IOrderInfoProvider.ResourceType.class);
List<Float> list = readArrayList(LPDataInput::readFloat);
byte machineProgress = localBuffer.readByte();
DoubleCoordinates pos = readLPPosition();
ItemIdentifier ident = readItemIdentifier();
return new ClientSideOrderInfo(stack, isFinished, type, inProgress, routerId, list, machineProgress, pos, ident);
} | Base | 1 |
public static void writeData(ByteBuf dataBuffer, LPDataOutputConsumer dataOutputConsumer) throws IOException {
LPDataIOWrapper lpData = getInstance(dataBuffer);
dataOutputConsumer.accept(lpData);
lpData.unsetBuffer();
} | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.