3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Consistency changes, 1.11->1.12 packet constants

Almost there! :>
Dieser Commit ist enthalten in:
KennyTV 2020-06-05 23:06:00 +02:00
Ursprung 9f80553749
Commit 38f845bb7e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
16 geänderte Dateien mit 193 neuen und 161 gelöschten Zeilen

Datei anzeigen

@ -87,13 +87,13 @@ public class BlockRewriter {
});
}
public void registerSpawnParticle(Type<?> coordType, ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType) {
registerSpawnParticle(coordType, packetType, blockId, fallingDustId, itemId, null, itemRewriteFunction, itemType);
public void registerSpawnParticle(ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType, Type<?> coordType) {
registerSpawnParticle(packetType, blockId, fallingDustId, itemId, null, itemRewriteFunction, itemType, coordType);
}
public void registerSpawnParticle(Type<?> coordType, ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
IdRewriteFunction particleRewriteFunction, ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType) {
public void registerSpawnParticle(ClientboundPacketType packetType, int blockId, int fallingDustId, int itemId,
IdRewriteFunction particleRewriteFunction, ItemRewriter.RewriteFunction itemRewriteFunction, Type<Item> itemType, Type<?> coordType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {

Datei anzeigen

@ -21,7 +21,7 @@ public class ItemRewriter {
this.toServer = toServer;
}
public void registerWindowItems(Type<Item[]> type, ClientboundPacketType packetType) {
public void registerWindowItems(ClientboundPacketType packetType, Type<Item[]> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
@ -33,7 +33,7 @@ public class ItemRewriter {
});
}
public void registerSetSlot(Type<Item> type, ClientboundPacketType packetType) {
public void registerSetSlot(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
@ -46,7 +46,7 @@ public class ItemRewriter {
});
}
public void registerEntityEquipment(Type<Item> type, ClientboundPacketType packetType) {
public void registerEntityEquipment(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
@ -59,7 +59,7 @@ public class ItemRewriter {
});
}
public void registerCreativeInvAction(Type<Item> type, ServerboundPacketType packetType) {
public void registerCreativeInvAction(ServerboundPacketType packetType, Type<Item> type) {
protocol.registerIncoming(packetType, new PacketRemapper() {
@Override
public void registerMap() {
@ -71,7 +71,7 @@ public class ItemRewriter {
});
}
public void registerClickWindow(Type<Item> type, ServerboundPacketType packetType) {
public void registerClickWindow(ServerboundPacketType packetType, Type<Item> type) {
protocol.registerIncoming(packetType, new PacketRemapper() {
@Override
public void registerMap() {

Datei anzeigen

@ -4,7 +4,6 @@ import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
public class SoundRewriter {
protected final Protocol protocol;
@ -16,17 +15,9 @@ public class SoundRewriter {
this.idRewriter = idRewriter;
}
// The same for entity sound effect
public void registerSound(int oldId, int newId) {
protocol.registerOutgoing(State.PLAY, oldId, newId, getRemapper());
}
// The same for entity sound
public void registerSound(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, getRemapper());
}
protected PacketRemapper getRemapper() {
return new PacketRemapper() {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Sound Id
@ -40,6 +31,6 @@ public class SoundRewriter {
}
});
}
};
});
}
}

Datei anzeigen

@ -0,0 +1,83 @@
package us.myles.ViaVersion.protocols.protocol1_11to1_10;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
public enum ClientboundPackets1_11 implements ClientboundPacketType {
SPAWN_ENTITY, // 0x00
SPAWN_EXPERIENCE_ORB, // 0x01
SPAWN_GLOBAL_ENTITY, // 0x02
SPAWN_MOB, // 0x03
SPAWN_PAINTING, // 0x04
SPAWN_PLAYER, // 0x05
ENTITY_ANIMATION, // 0x06
STATISTICS, // 0x07
BLOCK_BREAK_ANIMATION, // 0x08
BLOCK_ENTITY_DATA, // 0x09
BLOCK_ACTION, // 0x0A
BLOCK_CHANGE, // 0x0B
BOSSBAR, // 0x0C
SERVER_DIFFICULTY, // 0x0D
TAB_COMPLETE, // 0x0E
CHAT_MESSAGE, // 0x0F
MULTI_BLOCK_CHANGE, // 0x10
WINDOW_CONFIRMATION, // 0x11
CLOSE_WINDOW, // 0x12
OPEN_WINDOW, // 0x13
WINDOW_ITEMS, // 0x14
WINDOW_PROPERTY, // 0x15
SET_SLOT, // 0x16
COOLDOWN, // 0x17
PLUGIN_MESSAGE, // 0x18
NAMED_SOUND, // 0x19
DISCONNECT, // 0x1A
ENTITY_STATUS, // 0x1B
EXPLOSION, // 0x1C
UNLOAD_CHUNK, // 0x1D
GAME_EVENT, // 0x1E
KEEP_ALIVE, // 0x1F
CHUNK_DATA, // 0x20
EFFECT, // 0x21
SPAWN_PARTICLE, // 0x22
JOIN_GAME, // 0x23
MAP_DATA, // 0x24
ENTITY_POSITION, // 0x26
ENTITY_POSITION_AND_ROTATION, // 0x27
ENTITY_ROTATION, // 0x28
ENTITY_MOVEMENT, // 0x25
VEHICLE_MOVE, // 0x29
OPEN_SIGN_EDITOR, // 0x2A
PLAYER_ABILITIES, // 0x2B
COMBAT_EVENT, // 0x2C
PLAYER_INFO, // 0x2D
PLAYER_POSITION, // 0x2E
USE_BED, // 0x2F
DESTROY_ENTITIES, // 0x31
REMOVE_ENTITY_EFFECT, // 0x32
RESOURCE_PACK, // 0x33
RESPAWN, // 0x34
ENTITY_HEAD_LOOK, // 0x35
WORLD_BORDER, // 0x37
CAMERA, // 0x38
HELD_ITEM_CHANGE, // 0x39
DISPLAY_SCOREBOARD, // 0x3A
ENTITY_METADATA, // 0x3B
ATTACH_ENTITY, // 0x3C
ENTITY_VELOCITY, // 0x3D
ENTITY_EQUIPMENT, // 0x3E
SET_EXPERIENCE, // 0x3F
UPDATE_HEALTH, // 0x40
SCOREBOARD_OBJECTIVE, // 0x41
SET_PASSENGERS, // 0x42
TEAMS, // 0x43
UPDATE_SCORE, // 0x44
SPAWN_POSITION, // 0x45
TIME_UPDATE, // 0x46
TITLE, // 0x47
SOUND, // 0x48
TAB_LIST, // 0x49
COLLECT_ITEM, // 0x4A
ENTITY_TELEPORT, // 0x4B
ENTITY_PROPERTIES, // 0x4D
ENTITY_EFFECT, // 0x4E
}

Datei anzeigen

@ -87,7 +87,7 @@ public class Protocol1_11To1_10 extends Protocol {
}
});
new SoundRewriter(this, this::getNewSoundId).registerSound(0x46, 0x46);
//new SoundRewriter(this, this::getNewSoundId).registerSound(0x46, 0x46); //TODO _------------------------------------------------------
// Collect item packet
registerOutgoing(State.PLAY, 0x48, 0x48, new PacketRemapper() {

Datei anzeigen

@ -0,0 +1,37 @@
package us.myles.ViaVersion.protocols.protocol1_11to1_10;
import us.myles.ViaVersion.api.protocol.ServerboundPacketType;
public enum ServerboundPackets1_11 implements ServerboundPacketType {
TELEPORT_CONFIRM, // 0x00
TAB_COMPLETE, // 0x01
CHAT_MESSAGE, // 0x02
CLIENT_STATUS, // 0x03
CLIENT_SETTINGS, // 0x04
WINDOW_CONFIRMATION, // 0x05
CLICK_WINDOW_BUTTON, // 0x06
CLICK_WINDOW, // 0x07
CLOSE_WINDOW, // 0x08
PLUGIN_MESSAGE, // 0x09
INTERACT_ENTITY, // 0x0A
KEEP_ALIVE, // 0x0B
PLAYER_POSITION, // 0x0C
PLAYER_POSITION_AND_ROTATION, // 0x0D
PLAYER_ROTATION, // 0x0E
PLAYER_MOVEMENT, // 0x0F
VEHICLE_MOVE, // 0x10
STEER_BOAT, // 0x11
PLAYER_ABILITIES, // 0x12
PLAYER_DIGGING, // 0x13
ENTITY_ACTION, // 0x14
STEER_VEHICLE, // 0x15
RESOURCE_PACK_STATUS, // 0x16
HELD_ITEM_CHANGE, // 0x17
CREATIVE_INVENTORY_ACTION, // 0x18
UPDATE_SIGN, // 0x19
ANIMATION, // 0x1A
SPECTATE, // 0x1B
PLAYER_BLOCK_PLACEMENT, // 0x1C
USE_ITEM, // 0x1D
}

Datei anzeigen

@ -16,7 +16,8 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_12;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_11to1_10.ClientboundPackets1_11;
import us.myles.ViaVersion.protocols.protocol1_11to1_10.ServerboundPackets1_11;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.metadata.MetadataRewriter1_12To1_11_1;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
@ -28,14 +29,17 @@ import us.myles.ViaVersion.util.GsonUtil;
public class Protocol1_12To1_11_1 extends Protocol {
public Protocol1_12To1_11_1() {
super(ClientboundPackets1_11.class, ClientboundPackets1_12.class, ServerboundPackets1_11.class, ServerboundPackets1_12.class);
}
@Override
protected void registerPackets() {
MetadataRewriter1_12To1_11_1 metadataRewriter = new MetadataRewriter1_12To1_11_1(this);
InventoryPackets.register(this);
// Outgoing
// Spawn Object
registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
registerOutgoing(ClientboundPackets1_11.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -47,8 +51,7 @@ public class Protocol1_12To1_11_1 extends Protocol {
}
});
// Spawn mob packet
registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
registerOutgoing(ClientboundPackets1_11.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -70,8 +73,7 @@ public class Protocol1_12To1_11_1 extends Protocol {
}
});
// Chat message packet
registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() {
registerOutgoing(ClientboundPackets1_11.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 0 - Chat Message (json)
@ -97,8 +99,7 @@ public class Protocol1_12To1_11_1 extends Protocol {
}
});
// Chunk Data
registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
registerOutgoing(ClientboundPackets1_11.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -141,66 +142,19 @@ public class Protocol1_12To1_11_1 extends Protocol {
}
});
// Join Packet
metadataRewriter.registerJoinGame(0x23, 0x23, null);
metadataRewriter.registerJoinGame(ClientboundPackets1_11.JOIN_GAME, null);
metadataRewriter.registerEntityDestroy(ClientboundPackets1_11.DESTROY_ENTITIES);
metadataRewriter.registerRespawn(ClientboundPackets1_11.RESPAWN);
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_11.ENTITY_METADATA, Types1_12.METADATA_LIST);
// 0x28 moved to 0x25
registerOutgoing(State.PLAY, 0x28, 0x25);
registerOutgoing(State.PLAY, 0x25, 0x26);
registerOutgoing(State.PLAY, 0x26, 0x27);
registerOutgoing(State.PLAY, 0x27, 0x28);
new SoundRewriter(this, this::getNewSoundId).registerSound(ClientboundPackets1_11.SOUND);
// New packet at 0x30
// Destroy entities
metadataRewriter.registerEntityDestroy(0x30, 0x31);
registerOutgoing(State.PLAY, 0x31, 0x32);
registerOutgoing(State.PLAY, 0x32, 0x33);
// Respawn Packet
metadataRewriter.registerRespawn(0x33, 0x34);
registerOutgoing(State.PLAY, 0x34, 0x35);
// New packet at 0x36
registerOutgoing(State.PLAY, 0x35, 0x37);
registerOutgoing(State.PLAY, 0x36, 0x38);
registerOutgoing(State.PLAY, 0x37, 0x39);
registerOutgoing(State.PLAY, 0x38, 0x3a);
// Metadata packet
metadataRewriter.registerMetadataRewriter(0x39, 0x3b, null, Types1_12.METADATA_LIST);
registerOutgoing(State.PLAY, 0x3a, 0x3c);
registerOutgoing(State.PLAY, 0x3b, 0x3d);
// registerOutgoing(State.PLAY, 0x3c, 0x3e); - Handled in InventoryPackets
registerOutgoing(State.PLAY, 0x3d, 0x3f);
registerOutgoing(State.PLAY, 0x3e, 0x40);
registerOutgoing(State.PLAY, 0x3f, 0x41);
registerOutgoing(State.PLAY, 0x40, 0x42);
registerOutgoing(State.PLAY, 0x41, 0x43);
registerOutgoing(State.PLAY, 0x42, 0x44);
registerOutgoing(State.PLAY, 0x43, 0x45);
registerOutgoing(State.PLAY, 0x44, 0x46);
registerOutgoing(State.PLAY, 0x45, 0x47);
new SoundRewriter(this, this::getNewSoundId).registerSound(0x46, 0x48);
registerOutgoing(State.PLAY, 0x47, 0x49);
registerOutgoing(State.PLAY, 0x48, 0x4a);
registerOutgoing(State.PLAY, 0x49, 0x4b);
// New packet at 0x4c
registerOutgoing(State.PLAY, 0x4a, 0x4d);
registerOutgoing(State.PLAY, 0x4b, 0x4e);
// Incoming
// New packet at 0x01
cancelIncoming(State.PLAY, 0x01, 0x01);
cancelIncoming(ServerboundPackets1_12.PREPARE_CRAFTING_GRID);
registerIncoming(State.PLAY, 0x01, 0x02);
registerIncoming(State.PLAY, 0x02, 0x03);
registerIncoming(State.PLAY, 0x03, 0x04);
// Client Settings (max length changed)
registerIncoming(State.PLAY, 0x04, 0x05, new PacketRemapper() {
registerIncoming(ServerboundPackets1_12.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Locale
@ -229,41 +183,12 @@ public class Protocol1_12To1_11_1 extends Protocol {
});
}
});
registerIncoming(State.PLAY, 0x05, 0x06);
registerIncoming(State.PLAY, 0x06, 0x07);
// registerIncoming(State.PLAY, 0x07, 0x08); - Handled in InventoryPackets
registerIncoming(State.PLAY, 0x08, 0x09);
registerIncoming(State.PLAY, 0x09, 0x0a);
registerIncoming(State.PLAY, 0x0a, 0x0b);
registerIncoming(State.PLAY, 0x0b, 0x0c);
// Mojang swapped 0x0F to 0x0D
registerIncoming(State.PLAY, 0x0f, 0x0d);
registerIncoming(State.PLAY, 0x0c, 0x0e);
// Mojang swapped 0x0F to 0x0D
registerIncoming(State.PLAY, 0x0d, 0x0f);
registerIncoming(State.PLAY, 0x0e, 0x10);
registerIncoming(State.PLAY, 0x10, 0x11);
registerIncoming(State.PLAY, 0x11, 0x12);
registerIncoming(State.PLAY, 0x12, 0x13);
registerIncoming(State.PLAY, 0x13, 0x14);
registerIncoming(State.PLAY, 0x14, 0x15);
registerIncoming(State.PLAY, 0x15, 0x16);
// New packet at 0x17
cancelIncoming(State.PLAY, 0x17, 0x17);
registerIncoming(State.PLAY, 0x16, 0x18);
cancelIncoming(ServerboundPackets1_12.RECIPE_BOOK_DATA);
// New packet 0x19
cancelIncoming(State.PLAY, 0x19, 0x19);
registerIncoming(State.PLAY, 0x17, 0x1a);
// registerIncoming(State.PLAY, 0x18, 0x1b); - Handled in InventoryPackets
registerIncoming(State.PLAY, 0x19, 0x1c);
registerIncoming(State.PLAY, 0x1a, 0x1d);
registerIncoming(State.PLAY, 0x1b, 0x1e);
registerIncoming(State.PLAY, 0x1c, 0x1f);
registerIncoming(State.PLAY, 0x1d, 0x20);
cancelIncoming(ServerboundPackets1_12.ADVANCEMENT_TAB);
}
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.

Datei anzeigen

@ -5,13 +5,13 @@ import com.google.gson.JsonObject;
import us.myles.ViaVersion.api.data.UserConnection;
public class TranslateRewriter {
public static boolean toClient(JsonElement element, UserConnection user) {
if (element instanceof JsonObject) {
JsonObject obj = (JsonObject) element;
if (obj.has("translate")) {
if (obj.get("translate").getAsString().equals("chat.type.achievement")) {
return false;
}
JsonElement translate = obj.get("translate");
if (translate != null) {
return !translate.getAsString().equals("chat.type.achievement");
}
}
return true;

Datei anzeigen

@ -7,9 +7,10 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_11to1_10.ClientboundPackets1_11;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.BedRewriter;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ServerboundPackets1_12;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
public class InventoryPackets {
@ -17,17 +18,12 @@ public class InventoryPackets {
public static void register(Protocol1_12To1_11_1 protocol) {
ItemRewriter itemRewriter = new ItemRewriter(protocol, BedRewriter::toClientItem, BedRewriter::toServerItem);
// Set slot packet
itemRewriter.registerSetSlot(Type.ITEM, 0x16, 0x16);
// Window items packet
itemRewriter.registerWindowItems(Type.ITEM_ARRAY, 0x14, 0x14);
// Entity Equipment Packet
itemRewriter.registerEntityEquipment(Type.ITEM, 0x3C, 0x3E);
itemRewriter.registerSetSlot(ClientboundPackets1_11.SET_SLOT, Type.ITEM);
itemRewriter.registerWindowItems(ClientboundPackets1_11.WINDOW_ITEMS, Type.ITEM_ARRAY);
itemRewriter.registerEntityEquipment(ClientboundPackets1_11.ENTITY_EQUIPMENT, Type.ITEM);
// Plugin message Packet -> Trading
protocol.registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
protocol.registerOutgoing(ClientboundPackets1_11.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel
@ -44,8 +40,9 @@ public class InventoryPackets {
BedRewriter.toClientItem(wrapper.passthrough(Type.ITEM)); // Output Item
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
if (secondItem)
if (secondItem) {
BedRewriter.toClientItem(wrapper.passthrough(Type.ITEM)); // Second Item
}
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
wrapper.passthrough(Type.INT); // Number of tools uses
@ -58,8 +55,7 @@ public class InventoryPackets {
});
// Click window packet
protocol.registerIncoming(State.PLAY, 0x07, 0x08, new PacketRemapper() {
protocol.registerIncoming(ServerboundPackets1_12.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -100,6 +96,6 @@ public class InventoryPackets {
);
// Creative Inventory Action
itemRewriter.registerCreativeInvAction(Type.ITEM, 0x18, 0x1b);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_12.CREATIVE_INVENTORY_ACTION, Type.ITEM);
}
}

Datei anzeigen

@ -16,8 +16,8 @@ public class InventoryPackets {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN, InventoryPackets::getNewItemId);
itemRewriter.registerSetSlot(Type.FLAT_ITEM, ClientboundPackets1_13.SET_SLOT);
itemRewriter.registerWindowItems(Type.FLAT_ITEM_ARRAY, ClientboundPackets1_13.WINDOW_ITEMS);
itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_ITEM);
itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_ITEM_ARRAY);
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
@ -53,7 +53,7 @@ public class InventoryPackets {
}
});
itemRewriter.registerEntityEquipment(Type.FLAT_ITEM, ClientboundPackets1_13.ENTITY_EQUIPMENT);
itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
@Override
@ -103,8 +103,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerClickWindow(Type.FLAT_ITEM, ServerboundPackets1_13.CLICK_WINDOW);
itemRewriter.registerCreativeInvAction(Type.FLAT_ITEM, ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION);
itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM);
}
public static void toClient(Item item) {

Datei anzeigen

@ -77,6 +77,6 @@ public class WorldPackets {
}
});
blockRewriter.registerSpawnParticle(Type.FLOAT, ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27, InventoryPackets::toClient, Type.FLAT_ITEM);
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27, InventoryPackets::toClient, Type.FLAT_ITEM, Type.FLOAT);
}
}

Datei anzeigen

@ -108,8 +108,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, ClientboundPackets1_13.WINDOW_ITEMS);
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_13.SET_SLOT);
itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
@ -163,7 +163,7 @@ public class InventoryPackets {
}
});
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_13.ENTITY_EQUIPMENT);
itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
@Override
@ -215,7 +215,7 @@ public class InventoryPackets {
});
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_14.CLICK_WINDOW);
itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_14.SELECT_TRADE, new PacketRemapper() {
@Override
@ -239,7 +239,7 @@ public class InventoryPackets {
}
});
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
}
public static void toClient(Item item) {

Datei anzeigen

@ -274,8 +274,8 @@ public class WorldPackets {
}
});
blockRewriter.registerSpawnParticle(Type.FLOAT, ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27,
MetadataRewriter1_14To1_13_2::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM);
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27,
MetadataRewriter1_14To1_13_2::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM, Type.FLOAT);
protocol.registerOutgoing(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
@Override

Datei anzeigen

@ -18,7 +18,7 @@ public class InventoryPackets {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
itemRewriter.registerSetCooldown(ClientboundPackets1_14.COOLDOWN, InventoryPackets::getNewItemId);
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, ClientboundPackets1_14.WINDOW_ITEMS);
itemRewriter.registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
protocol.registerOutgoing(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
@Override
@ -59,8 +59,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_14.SET_SLOT);
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_14.ENTITY_EQUIPMENT);
itemRewriter.registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerEntityEquipment(ClientboundPackets1_14.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() {
@Override
@ -128,8 +128,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_14.CLICK_WINDOW);
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION);
itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
}
public static void toClient(Item item) {

Datei anzeigen

@ -57,7 +57,7 @@ public class InventoryPackets {
});
itemRewriter.registerSetCooldown(ClientboundPackets1_15.COOLDOWN, InventoryPackets::getNewItemId);
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, ClientboundPackets1_15.WINDOW_ITEMS);
itemRewriter.registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
protocol.registerOutgoing(ClientboundPackets1_15.TRADE_LIST, new PacketRemapper() {
@Override
@ -94,8 +94,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_15.SET_SLOT);
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, ClientboundPackets1_15.ENTITY_EQUIPMENT);
itemRewriter.registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_15.DECLARE_RECIPES, new PacketRemapper() {
@Override
@ -156,8 +156,8 @@ public class InventoryPackets {
}
});
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_16.CLICK_WINDOW);
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION);
itemRewriter.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16.EDIT_BOOK, new PacketRemapper() {
@Override

Datei anzeigen

@ -89,8 +89,8 @@ public class WorldPackets {
});
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001, InventoryPackets::getNewItemId);
blockRewriter.registerSpawnParticle(Type.DOUBLE, ClientboundPackets1_15.SPAWN_PARTICLE, 3, 23, 32,
WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM);
blockRewriter.registerSpawnParticle(ClientboundPackets1_15.SPAWN_PARTICLE, 3, 23, 32,
WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
}
public static int getNewParticleId(int id) {