Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Hacky fix to noteblock
Dieser Commit ist enthalten in:
Ursprung
019bccd24a
Commit
f15c841b99
@ -14,6 +14,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
@ -86,6 +87,55 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Block action
|
||||||
|
protocol.registerOutgoing(State.PLAY, 0xA, 0xA, 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 {
|
||||||
|
Position pos = wrapper.get(Type.POSITION, 0);
|
||||||
|
short action = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||||
|
short param = wrapper.get(Type.UNSIGNED_BYTE, 1);
|
||||||
|
int blockId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
|
||||||
|
if (blockId == 25)
|
||||||
|
blockId = 73;
|
||||||
|
else if (blockId == 33)
|
||||||
|
blockId = 99;
|
||||||
|
else if (blockId == 29)
|
||||||
|
blockId = 92;
|
||||||
|
else if (blockId == 54)
|
||||||
|
blockId = 142;
|
||||||
|
else if (blockId == 146)
|
||||||
|
blockId = 305;
|
||||||
|
else if (blockId == 130)
|
||||||
|
blockId = 249;
|
||||||
|
else if (blockId == 138)
|
||||||
|
blockId = 257;
|
||||||
|
else if (blockId == 52)
|
||||||
|
blockId = 140;
|
||||||
|
else if (blockId == 209)
|
||||||
|
blockId = 472;
|
||||||
|
else if (blockId >= 219 && blockId <= 234)
|
||||||
|
blockId = blockId - 219 + 483;
|
||||||
|
|
||||||
|
if (blockId == 73) { // Note block
|
||||||
|
PacketWrapper blockChange = wrapper.create(0x0B); // block change
|
||||||
|
blockChange.write(Type.POSITION, new Position(pos.getX(), pos.getY(), pos.getZ())); // Clone because position is mutable
|
||||||
|
blockChange.write(Type.VAR_INT, 248 + (action * 24 * 2) + (param * 2));
|
||||||
|
blockChange.send(Protocol1_13To1_12_2.class, true, true);
|
||||||
|
}
|
||||||
|
wrapper.set(Type.VAR_INT, 0, blockId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Block Change
|
// Block Change
|
||||||
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren