3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00
Dieser Commit ist enthalten in:
Gerrygames 2019-01-09 18:26:08 +01:00
Ursprung 6b7bf843a1
Commit bea74661d1
12 geänderte Dateien mit 185 neuen und 58 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -67,7 +67,7 @@ public class ProtocolVersion {
register(v1_13 = new ProtocolVersion(393, "1.13")); register(v1_13 = new ProtocolVersion(393, "1.13"));
register(v1_13_1 = new ProtocolVersion(401, "1.13.1")); register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
register(v1_13_2 = new ProtocolVersion(404, "1.13.2")); register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
register(v1_14 = new ProtocolVersion(451, "1.14")); register(v1_14 = new ProtocolVersion(452, "1.14"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

Datei anzeigen

@ -29,18 +29,80 @@ public class InventoryPackets {
Outgoing packets Outgoing packets
*/ */
// Set slot packet protocol.registerOutgoing(State.PLAY, 0x14, -1, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.BYTE); // 0 - Window ID
map(Type.SHORT); // 1 - Slot ID
map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0)); Short windowsId = wrapper.read(Type.UNSIGNED_BYTE);
String type = wrapper.read(Type.STRING);
String title = wrapper.read(Type.STRING);
Short slots = wrapper.read(Type.UNSIGNED_BYTE);
if (type.equals("EntityHorse")) {
wrapper.setId(0x14);
int entityId = wrapper.read(Type.INT);
wrapper.write(Type.UNSIGNED_BYTE, windowsId);
wrapper.write(Type.VAR_INT, slots.intValue());
wrapper.write(Type.INT, entityId);
} else {
wrapper.setId(0x59);
wrapper.write(Type.VAR_INT, windowsId.intValue());
int typeId = -1;
switch (type) {
case "minecraft:container":
case "minecraft:chest":
switch (slots) {
case 27:
typeId = 0;
break;
case 54:
typeId = 1;
break;
}
break;
case "minecraft:crafting_table":
typeId = 7;
break;
case "minecraft:furnace":
typeId = 9;
break;
case "minecraft:dropper":
case "minecraft:dispenser":
typeId = 2;
break;
case "minecraft:enchanting_table":
typeId = 8;
break;
case "minecraft:brewing_stand":
typeId = 6;
break;
case "minecraft:villager":
typeId = 14;
break;
case "minecraft:beacon":
typeId = 4;
break;
case "minecraft:anvil":
typeId = 3;
break;
case "minecraft:hopper":
typeId = 11;
break;
case "minecraft:shulker_box":
typeId = 15;
break;
}
if (typeId == -1) {
Via.getPlatform().getLogger().warning("Can't open inventory for 1.14 player! Type: " + type + " Size: " + slots);
}
wrapper.write(Type.VAR_INT, typeId);
wrapper.write(Type.STRING, title);
}
} }
}); });
} }
@ -63,6 +125,23 @@ public class InventoryPackets {
} }
}); });
// Set slot packet
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
map(Type.SHORT); // 1 - Slot ID
map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
}
});
}
});
// Plugin message // Plugin message
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
@Override @Override
@ -73,7 +152,12 @@ public class InventoryPackets {
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
String channel = wrapper.get(Type.STRING, 0); String channel = wrapper.get(Type.STRING, 0);
if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) { if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID wrapper.setId(0x5A);
wrapper.resetReader();
wrapper.read(Type.STRING); // Remove channel
int windowId = wrapper.read(Type.INT);
wrapper.write(Type.VAR_INT, windowId);
int size = wrapper.passthrough(Type.UNSIGNED_BYTE); int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {

Datei anzeigen

@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler; 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.remapper.ValueCreator;
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.types.Chunk1_13Type; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
@ -248,6 +249,22 @@ public class WorldPackets {
} }
}); });
//Map Data
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
map(Type.BYTE);
map(Type.BOOLEAN);
create(new ValueCreator() {
@Override
public void write(PacketWrapper wrapper) throws Exception {
wrapper.write(Type.BOOLEAN, false); // new value, probably if the map is locked (added in 19w02a), old maps are not locked
}
});
}
});
//respawn //respawn
protocol.registerOutgoing(State.PLAY, 0x38, 0x39, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x38, 0x39, new PacketRemapper() {
@Override @Override

Datei anzeigen

@ -10859,44 +10859,64 @@
"10856": "minecraft:grindstone[face=ceiling,facing=south]", "10856": "minecraft:grindstone[face=ceiling,facing=south]",
"10857": "minecraft:grindstone[face=ceiling,facing=west]", "10857": "minecraft:grindstone[face=ceiling,facing=west]",
"10858": "minecraft:grindstone[face=ceiling,facing=east]", "10858": "minecraft:grindstone[face=ceiling,facing=east]",
"10859": "minecraft:lectern[facing=north]", "10859": "minecraft:lectern[facing=north,has_book=true,powered=true]",
"10860": "minecraft:lectern[facing=south]", "10860": "minecraft:lectern[facing=north,has_book=true,powered=false]",
"10861": "minecraft:lectern[facing=west]", "10861": "minecraft:lectern[facing=north,has_book=false,powered=true]",
"10862": "minecraft:lectern[facing=east]", "10862": "minecraft:lectern[facing=north,has_book=false,powered=false]",
"10863": "minecraft:smithing_table", "10863": "minecraft:lectern[facing=south,has_book=true,powered=true]",
"10864": "minecraft:stonecutter", "10864": "minecraft:lectern[facing=south,has_book=true,powered=false]",
"10865": "minecraft:bell[attachment=floor,facing=north]", "10865": "minecraft:lectern[facing=south,has_book=false,powered=true]",
"10866": "minecraft:bell[attachment=floor,facing=south]", "10866": "minecraft:lectern[facing=south,has_book=false,powered=false]",
"10867": "minecraft:bell[attachment=floor,facing=west]", "10867": "minecraft:lectern[facing=west,has_book=true,powered=true]",
"10868": "minecraft:bell[attachment=floor,facing=east]", "10868": "minecraft:lectern[facing=west,has_book=true,powered=false]",
"10869": "minecraft:bell[attachment=ceiling,facing=north]", "10869": "minecraft:lectern[facing=west,has_book=false,powered=true]",
"10870": "minecraft:bell[attachment=ceiling,facing=south]", "10870": "minecraft:lectern[facing=west,has_book=false,powered=false]",
"10871": "minecraft:bell[attachment=ceiling,facing=west]", "10871": "minecraft:lectern[facing=east,has_book=true,powered=true]",
"10872": "minecraft:bell[attachment=ceiling,facing=east]", "10872": "minecraft:lectern[facing=east,has_book=true,powered=false]",
"10873": "minecraft:bell[attachment=single_wall,facing=north]", "10873": "minecraft:lectern[facing=east,has_book=false,powered=true]",
"10874": "minecraft:bell[attachment=single_wall,facing=south]", "10874": "minecraft:lectern[facing=east,has_book=false,powered=false]",
"10875": "minecraft:bell[attachment=single_wall,facing=west]", "10875": "minecraft:smithing_table",
"10876": "minecraft:bell[attachment=single_wall,facing=east]", "10876": "minecraft:stonecutter",
"10877": "minecraft:bell[attachment=double_wall,facing=north]", "10877": "minecraft:bell[attachment=floor,facing=north]",
"10878": "minecraft:bell[attachment=double_wall,facing=south]", "10878": "minecraft:bell[attachment=floor,facing=south]",
"10879": "minecraft:bell[attachment=double_wall,facing=west]", "10879": "minecraft:bell[attachment=floor,facing=west]",
"10880": "minecraft:bell[attachment=double_wall,facing=east]", "10880": "minecraft:bell[attachment=floor,facing=east]",
"10881": "minecraft:lantern[hanging=true]", "10881": "minecraft:bell[attachment=ceiling,facing=north]",
"10882": "minecraft:lantern[hanging=false]", "10882": "minecraft:bell[attachment=ceiling,facing=south]",
"10883": "minecraft:sweet_berry_bush[age=0]", "10883": "minecraft:bell[attachment=ceiling,facing=west]",
"10884": "minecraft:sweet_berry_bush[age=1]", "10884": "minecraft:bell[attachment=ceiling,facing=east]",
"10885": "minecraft:sweet_berry_bush[age=2]", "10885": "minecraft:bell[attachment=single_wall,facing=north]",
"10886": "minecraft:sweet_berry_bush[age=3]", "10886": "minecraft:bell[attachment=single_wall,facing=south]",
"10887": "minecraft:structure_block[mode=save]", "10887": "minecraft:bell[attachment=single_wall,facing=west]",
"10888": "minecraft:structure_block[mode=load]", "10888": "minecraft:bell[attachment=single_wall,facing=east]",
"10889": "minecraft:structure_block[mode=corner]", "10889": "minecraft:bell[attachment=double_wall,facing=north]",
"10890": "minecraft:structure_block[mode=data]", "10890": "minecraft:bell[attachment=double_wall,facing=south]",
"10891": "minecraft:jigsaw[facing=north]", "10891": "minecraft:bell[attachment=double_wall,facing=west]",
"10892": "minecraft:jigsaw[facing=east]", "10892": "minecraft:bell[attachment=double_wall,facing=east]",
"10893": "minecraft:jigsaw[facing=south]", "10893": "minecraft:lantern[hanging=true]",
"10894": "minecraft:jigsaw[facing=west]", "10894": "minecraft:lantern[hanging=false]",
"10895": "minecraft:jigsaw[facing=up]", "10895": "minecraft:sweet_berry_bush[age=0]",
"10896": "minecraft:jigsaw[facing=down]" "10896": "minecraft:sweet_berry_bush[age=1]",
"10897": "minecraft:sweet_berry_bush[age=2]",
"10898": "minecraft:sweet_berry_bush[age=3]",
"10899": "minecraft:campfire[lit=true,signal_fire=true,waterlogged=true]",
"10900": "minecraft:campfire[lit=true,signal_fire=true,waterlogged=false]",
"10901": "minecraft:campfire[lit=true,signal_fire=false,waterlogged=true]",
"10902": "minecraft:campfire[lit=true,signal_fire=false,waterlogged=false]",
"10903": "minecraft:campfire[lit=false,signal_fire=true,waterlogged=true]",
"10904": "minecraft:campfire[lit=false,signal_fire=true,waterlogged=false]",
"10905": "minecraft:campfire[lit=false,signal_fire=false,waterlogged=true]",
"10906": "minecraft:campfire[lit=false,signal_fire=false,waterlogged=false]",
"10907": "minecraft:structure_block[mode=save]",
"10908": "minecraft:structure_block[mode=load]",
"10909": "minecraft:structure_block[mode=corner]",
"10910": "minecraft:structure_block[mode=data]",
"10911": "minecraft:jigsaw[facing=north]",
"10912": "minecraft:jigsaw[facing=east]",
"10913": "minecraft:jigsaw[facing=south]",
"10914": "minecraft:jigsaw[facing=west]",
"10915": "minecraft:jigsaw[facing=up]",
"10916": "minecraft:jigsaw[facing=down]"
}, },
"items": { "items": {
"0": "minecraft:air", "0": "minecraft:air",
@ -11766,7 +11786,8 @@
"864": "minecraft:stonecutter", "864": "minecraft:stonecutter",
"865": "minecraft:bell", "865": "minecraft:bell",
"866": "minecraft:lantern", "866": "minecraft:lantern",
"867": "minecraft:sweet_berries" "867": "minecraft:sweet_berries",
"868": "minecraft:campfire"
}, },
"sounds": [ "sounds": [
"ambient.cave", "ambient.cave",
@ -11825,6 +11846,8 @@
"entity.blaze.shoot", "entity.blaze.shoot",
"entity.boat.paddle_land", "entity.boat.paddle_land",
"entity.boat.paddle_water", "entity.boat.paddle_water",
"item.book.page_turn",
"item.book.put",
"entity.fishing_bobber.retrieve", "entity.fishing_bobber.retrieve",
"entity.fishing_bobber.splash", "entity.fishing_bobber.splash",
"entity.fishing_bobber.throw", "entity.fishing_bobber.throw",
@ -11843,6 +11866,7 @@
"item.bucket.fill", "item.bucket.fill",
"item.bucket.fill_fish", "item.bucket.fill_fish",
"item.bucket.fill_lava", "item.bucket.fill_lava",
"block.campfire.crackle",
"entity.cat.ambient", "entity.cat.ambient",
"entity.cat.stray_ambient", "entity.cat.stray_ambient",
"entity.cat.death", "entity.cat.death",
@ -12404,6 +12428,7 @@
"ui.button.click", "ui.button.click",
"ui.loom.select_pattern", "ui.loom.select_pattern",
"ui.loom.take_result", "ui.loom.take_result",
"ui.cartography_table.take_result",
"ui.toast.challenge_complete", "ui.toast.challenge_complete",
"ui.toast.in", "ui.toast.in",
"ui.toast.out", "ui.toast.out",
@ -13156,7 +13181,8 @@
"667": "bell", "667": "bell",
"668": "lantern", "668": "lantern",
"669": "sweet_berry_bush", "669": "sweet_berry_bush",
"670": "structure_block", "670": "campfire",
"671": "jigsaw" "671": "structure_block",
"672": "jigsaw"
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name> <name>viaversion-jar</name>

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>viaversion-parent</name> <name>viaversion-parent</name>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-18w50a</version> <version>2.0.0-19w02a</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>