This commit is contained in:
KennyTV 2020-03-18 20:35:56 +01:00
parent 6b73de2510
commit 3b24b0dfe1
5 changed files with 54 additions and 6 deletions

View File

@ -650,7 +650,8 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag;
String newId = (String) enchantmentEntry.get("id").getValue();
Number levelValue = (Number) enchantmentEntry.get("lvl").getValue();
short level = levelValue.shortValue();
int intValue = levelValue.intValue();
short level = intValue < Short.MAX_VALUE ? levelValue.shortValue() : Short.MAX_VALUE;
String mappedEnchantmentId = enchantmentMappings.get(newId);
if (mappedEnchantmentId != null) {

View File

@ -15,6 +15,8 @@ import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import java.util.UUID;
public class Protocol1_15_2To1_16 extends BackwardsProtocol {
private BlockItemPackets1_16 blockItemPackets;
@ -40,6 +42,18 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
soundRewriter.registerSound(0x52, 0x52);
soundRewriter.registerNamedSound(0x1A, 0x1A);
// Login success
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
// Transform int array to plain string
UUID uuid = wrapper.read(Type.UUID_INT_ARRAY);
wrapper.write(Type.STRING, uuid.toString());
});
}
});
// Advancements
registerOutgoing(State.PLAY, 0x58, 0x58, new PacketRemapper() {
@Override
@ -110,6 +124,19 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
});
}
});
registerOutgoing(State.PLAY, 0x43, 0x4E);
registerOutgoing(State.PLAY, 0x44, 0x43);
registerOutgoing(State.PLAY, 0x46, 0x45);
registerOutgoing(State.PLAY, 0x47, 0x46);
registerOutgoing(State.PLAY, 0x49, 0x48);
registerOutgoing(State.PLAY, 0x4A, 0x49);
registerOutgoing(State.PLAY, 0x4B, 0x4A);
registerOutgoing(State.PLAY, 0x4C, 0x4B);
registerOutgoing(State.PLAY, 0x4D, 0x4C);
registerOutgoing(State.PLAY, 0x4E, 0x4D);
}
public static int getNewBlockStateId(int id) {

View File

@ -85,7 +85,7 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
});
// Entity Equipment Packet
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47);
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x48, 0x47);
// Click window packet
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);

View File

@ -49,7 +49,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
registerEntityDestroy(0x38, 0x38);
// Entity Metadata packet
registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST);
registerMetadataRewriter(0x45, 0x44, Types1_14.METADATA_LIST);
}
@Override

View File

@ -5348,7 +5348,15 @@
"minecraft:twisting_vines[age=23]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]",
"minecraft:twisting_vines[age=24]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]",
"minecraft:twisting_vines[age=25]": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]",
"minecraft:twisting_vines_plant": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]"
"minecraft:twisting_vines_plant": "minecraft:vine[east=true,north=true,south=true,up=false,west=true]",
"minecraft:polished_basalt[axis=x]": "minecraft:gray_glazed_terracotta[facing=north]",
"minecraft:polished_basalt[axis=y]": "minecraft:gray_glazed_terracotta[facing=north]",
"minecraft:polished_basalt[axis=z]": "minecraft:gray_glazed_terracotta[facing=north]",
"minecraft:respawn_anchor[charges=0]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=1]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=2]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=3]": "minecraft:obsidian",
"minecraft:respawn_anchor[charges=4]": "minecraft:obsidian"
},
"items": {
"minecraft:crimson_nylium": {
@ -5598,6 +5606,14 @@
"minecraft:twisting_vines": {
"id": "minecraft:vine",
"name": "1.16 Twisting Vines"
},
"minecraft:respawn_anchor": {
"id": "minecraft:obsidian",
"name": "1.16 Respawn Anchor"
},
"minecraft:polished_basalt": {
"id": "minecraft:gray_glazed_terracotta",
"name": "1.16 Polished Basalt"
}
},
"sounds": {
@ -5722,7 +5738,11 @@
"ambient.warped_forest.loop": "",
"ambient.warped_forest.mood": "",
"block.smithing_table.use": "block.anvil.use",
"particle.soul_escape": "",
"block.vine.step": "block.wet_grass.step"
"particle.soul_escape": "",
"block.vine.step": "block.wet_grass.step",
"block.respawn_anchor.ambient": "block.beacon.ambient",
"block.respawn_anchor.charge": "block.beacon.activate",
"block.respawn_anchor.deplete": "block.beacon.deactivate",
"block.respawn_anchor.set_spawn": "block.beacon.power_select"
}
}