forked from GeyserMC/Geyser
Start chunk conversions
This commit is contained in:
parent
16cd94a95e
commit
9d9611cbbf
4 changed files with 49 additions and 20 deletions
|
@ -407,7 +407,18 @@ public class UpstreamPacketHandler implements BedrockPacketHandler {
|
|||
public boolean handle(TextPacket packet) {
|
||||
System.out.println("Handled packet: " + packet.getClass().getSimpleName());
|
||||
|
||||
if(packet.getMessage().charAt(0) == '.') {
|
||||
|
||||
ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage().replace(".", "/"));
|
||||
|
||||
session.getDownstream().getSession().send(chatPacket);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
ClientChatPacket chatPacket = new ClientChatPacket(packet.getMessage());
|
||||
|
||||
session.getDownstream().getSession().send(chatPacket);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -167,7 +167,7 @@ public class TranslatorsInit {
|
|||
TextPacket textPacket = new TextPacket();
|
||||
textPacket.setPlatformChatId("");
|
||||
textPacket.setSourceName("");
|
||||
textPacket.setXuid(session.getAuthenticationData().getXboxUUID());
|
||||
textPacket.setXuid("");
|
||||
switch (packet.getType()) {
|
||||
case CHAT:
|
||||
textPacket.setType(TextPacket.Type.CHAT);
|
||||
|
@ -192,23 +192,4 @@ public class TranslatorsInit {
|
|||
session.getUpstream().sendPacket(textPacket);
|
||||
});
|
||||
}
|
||||
|
||||
private static byte[] empty(byte[] b, Vector2i pos) {
|
||||
ByteBuf by = Unpooled.buffer();
|
||||
|
||||
GeyserUtils.writePEChunkCoord(by, pos);
|
||||
|
||||
return by.array();
|
||||
}
|
||||
|
||||
private static class CanWriteToBB extends ByteArrayOutputStream {
|
||||
|
||||
CanWriteToBB() {
|
||||
super(8192);
|
||||
}
|
||||
|
||||
void writeTo(ByteBuf buf) {
|
||||
buf.writeBytes(super.buf, 0, super.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.geysermc.connector.utils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Chunks {
|
||||
|
||||
public ChunkData getData(Column c) {
|
||||
Objects.requireNonNull(c);
|
||||
|
||||
int count = 0;
|
||||
|
||||
for(Chunk chunk : c.getChunks()) {
|
||||
if(chunk != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@AllArgsConstructor(access = AccessLevel.PACKAGE)
|
||||
public static final class ChunkData {
|
||||
public final int count;
|
||||
|
||||
public final byte[] bytes;
|
||||
|
||||
}
|
||||
}
|
|
@ -30,6 +30,10 @@ public class MessageUtils {
|
|||
strings.add("");
|
||||
}
|
||||
|
||||
if (translation.getTranslationKey().equals("command.context.here")) {
|
||||
strings.add(" - no permission or invalid command!");
|
||||
}
|
||||
|
||||
for (int j = 0; j < getTranslationParams(translation.getTranslationParams()).size(); j++) {
|
||||
strings.add(getTranslationParams(translation.getTranslationParams()).get(j));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue