3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 08:10:10 +01:00

Merge pull request #83 from Gerrygames/1.13

fix tab complete
Dieser Commit ist enthalten in:
Myles 2019-01-22 22:54:29 +00:00 committet von GitHub
Commit f05bbbc2a1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 49 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -17,7 +17,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.remapper.ValueTransformer;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_11to1_10.Protocol1_11To1_10;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
public class PlayerPackets1_11 {
private static final ValueTransformer<Short, Float> toNewFloat = new ValueTransformer<Short, Float>(Type.FLOAT) {
@ -45,10 +45,13 @@ public class PlayerPackets1_11 {
if (action == 2) {
// Convert to the old actionbar way
PacketWrapper actionbar = new PacketWrapper(0x0F, null, wrapper.user()); // Chat Message packet
actionbar.write(Type.STRING, wrapper.read(Type.STRING));
String msg = wrapper.read(Type.STRING);
msg = ChatRewriter.jsonTextToLegacy(msg);
msg = "{\"text\":\"" + msg + "\"}";
actionbar.write(Type.STRING, msg);
actionbar.write(Type.BYTE, (byte) 2); // Above hotbar
actionbar.send(Protocol1_11To1_10.class);
actionbar.send(Protocol1_10To1_11.class);
wrapper.cancel(); // Cancel the title packet
return;

Datei anzeigen

@ -60,6 +60,46 @@ public class BlockItemPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
@Override
protected void registerPackets(Protocol1_12_2To1_13 protocol) {
// Block Action
protocol.out(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // Location
map(Type.UNSIGNED_BYTE); // Action Id
map(Type.UNSIGNED_BYTE); // Action param
map(Type.VAR_INT); // Block Id - /!\ NOT BLOCK STATE ID
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int blockId = wrapper.get(Type.VAR_INT, 0);
if (blockId == 73)
blockId = 25;
else if (blockId == 99)
blockId = 33;
else if (blockId == 92)
blockId = 29;
else if (blockId == 142)
blockId = 54;
else if (blockId == 305)
blockId = 146;
else if (blockId == 249)
blockId = 130;
else if (blockId == 257)
blockId = 138;
else if (blockId == 140)
blockId = 52;
else if (blockId == 472)
blockId = 209;
else if (blockId >= 483 && blockId <= 498)
blockId = blockId - 483 + 219;
wrapper.set(Type.VAR_INT, 0, blockId);
}
});
}
});
// Update Block Entity
protocol.out(State.PLAY, 0x09, 0x09, new PacketRemapper() {
@Override

Datei anzeigen

@ -157,7 +157,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
String match = wrapper.read(Type.STRING);
wrapper.write(Type.STRING, (start == 0 ? "/" : "") + match);
// Ignore tooltip
wrapper.read(Type.OPTIONAL_CHAT);
if (wrapper.read(Type.BOOLEAN)) wrapper.read(Type.STRING);
}
}
});
@ -203,13 +203,9 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
if (channel.equals("MC|BSign") || channel.equals("MC|BEdit")) {
wrapper.setId(0x0B);
Item book = wrapper.read(Type.ITEM);
System.out.println(book);
BlockItemPackets1_13.toServer(book);
System.out.println(book);
wrapper.write(Type.FLAT_ITEM, book);
boolean signing = channel.equals("MC|BSign");
System.out.println(channel);
System.out.println(signing);
wrapper.write(Type.BOOLEAN, signing);
} else if (channel.equals("MC|ItemName")) {
wrapper.setId(0x1C);

Datei anzeigen

@ -182,8 +182,8 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
public static int getNewBlockStateId(int blockId) {
if (blockId > 8590) {
blockId -= 17;
} else if (blockId > 8573) {
blockId = 0; //TODO replace new blocks
} else if (blockId > 8588) {
blockId = 8573;
} else if (blockId > 8479) {
blockId -= 16;
} else if (blockId > 8469 && blockId % 2 == 0) {