Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Commit
4b1c291fca
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -26,166 +26,168 @@ public class Entity1_14Types {
|
||||
ENTITY(-1),
|
||||
|
||||
AREA_EFFECT_CLOUD(0, ENTITY),
|
||||
ENDER_CRYSTAL(16, ENTITY),
|
||||
EVOCATION_FANGS(20, ENTITY),
|
||||
XP_ORB(22, ENTITY),
|
||||
EYE_OF_ENDER_SIGNAL(23, ENTITY),
|
||||
FALLING_BLOCK(24, ENTITY),
|
||||
FIREWORKS_ROCKET(25, ENTITY),
|
||||
ITEM(32, ENTITY),
|
||||
LLAMA_SPIT(37, ENTITY),
|
||||
TNT(56, ENTITY),
|
||||
SHULKER_BULLET(61, ENTITY),
|
||||
FISHING_BOBBER(96, ENTITY),
|
||||
ENDER_CRYSTAL(17, ENTITY),
|
||||
EVOCATION_FANGS(21, ENTITY),
|
||||
XP_ORB(23, ENTITY),
|
||||
EYE_OF_ENDER_SIGNAL(24, ENTITY),
|
||||
FALLING_BLOCK(25, ENTITY),
|
||||
FIREWORKS_ROCKET(26, ENTITY),
|
||||
ITEM(33, ENTITY),
|
||||
LLAMA_SPIT(38, ENTITY),
|
||||
TNT(57, ENTITY),
|
||||
SHULKER_BULLET(62, ENTITY),
|
||||
FISHING_BOBBER(97, ENTITY),
|
||||
|
||||
LIVINGENTITY(-1, ENTITY),
|
||||
ARMOR_STAND(1, LIVINGENTITY),
|
||||
PLAYER(95, LIVINGENTITY),
|
||||
PLAYER(96, LIVINGENTITY),
|
||||
|
||||
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
||||
ENDER_DRAGON(17, ABSTRACT_INSENTIENT),
|
||||
ENDER_DRAGON(18, ABSTRACT_INSENTIENT),
|
||||
|
||||
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
|
||||
|
||||
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
|
||||
VILLAGER(80, ABSTRACT_AGEABLE),
|
||||
VILLAGER(81, ABSTRACT_AGEABLE),
|
||||
|
||||
// Animals
|
||||
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
|
||||
CHICKEN(7, ABSTRACT_ANIMAL),
|
||||
COW(9, ABSTRACT_ANIMAL),
|
||||
MOOSHROOM(47, COW),
|
||||
PIG(52, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(55, ABSTRACT_ANIMAL),
|
||||
RABBIT(57, ABSTRACT_ANIMAL),
|
||||
SHEEP(59, ABSTRACT_ANIMAL),
|
||||
TURTLE(74, ABSTRACT_ANIMAL),
|
||||
DOLPHIN(13, ABSTRACT_INSENTIENT),
|
||||
CHICKEN(8, ABSTRACT_ANIMAL),
|
||||
COW(10, ABSTRACT_ANIMAL),
|
||||
MOOSHROOM(48, COW),
|
||||
PIG(53, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(56, ABSTRACT_ANIMAL),
|
||||
RABBIT(58, ABSTRACT_ANIMAL),
|
||||
SHEEP(60, ABSTRACT_ANIMAL),
|
||||
TURTLE(75, ABSTRACT_ANIMAL),
|
||||
|
||||
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
|
||||
OCELOT(48, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(88, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
CAT(6, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
OCELOT(49, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(89, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
|
||||
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
PARROT(51, ABSTRACT_PARROT),
|
||||
PARROT(52, ABSTRACT_PARROT),
|
||||
|
||||
// Horses
|
||||
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
|
||||
CHESTED_HORSE(-1, ABSTRACT_HORSE),
|
||||
DONKEY(11, CHESTED_HORSE),
|
||||
MULE(46, CHESTED_HORSE),
|
||||
LLAMA(36, CHESTED_HORSE),
|
||||
HORSE(29, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(64, ABSTRACT_HORSE),
|
||||
ZOMBIE_HORSE(90, ABSTRACT_HORSE),
|
||||
DONKEY(12, CHESTED_HORSE),
|
||||
MULE(47, CHESTED_HORSE),
|
||||
LLAMA(37, CHESTED_HORSE),
|
||||
HORSE(30, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(65, ABSTRACT_HORSE),
|
||||
ZOMBIE_HORSE(91, ABSTRACT_HORSE),
|
||||
|
||||
// Golem
|
||||
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
|
||||
SNOWMAN(66, ABSTRACT_GOLEM),
|
||||
VILLAGER_GOLEM(81, ABSTRACT_GOLEM),
|
||||
SHULKER(60, ABSTRACT_GOLEM),
|
||||
SNOWMAN(68, ABSTRACT_GOLEM),
|
||||
VILLAGER_GOLEM(82, ABSTRACT_GOLEM),
|
||||
SHULKER(61, ABSTRACT_GOLEM),
|
||||
|
||||
// Fish
|
||||
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
|
||||
COD_MOB(8, ABSTRACT_FISHES),
|
||||
PUFFER_FISH(53, ABSTRACT_FISHES),
|
||||
SALMON_MOB(58, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(73, ABSTRACT_FISHES),
|
||||
COD(9, ABSTRACT_FISHES),
|
||||
PUFFER_FISH(54, ABSTRACT_FISHES),
|
||||
SALMON_MOB(59, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(74, ABSTRACT_FISHES),
|
||||
|
||||
// Monsters
|
||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||
BLAZE(4, ABSTRACT_MONSTER),
|
||||
CREEPER(10, ABSTRACT_MONSTER),
|
||||
ENDERMITE(19, ABSTRACT_MONSTER),
|
||||
ENDERMAN(18, ABSTRACT_MONSTER),
|
||||
GIANT(27, ABSTRACT_MONSTER),
|
||||
SILVERFISH(62, ABSTRACT_MONSTER),
|
||||
VEX(79, ABSTRACT_MONSTER),
|
||||
WITCH(84, ABSTRACT_MONSTER),
|
||||
WITHER(85, ABSTRACT_MONSTER),
|
||||
CREEPER(11, ABSTRACT_MONSTER),
|
||||
ENDERMITE(20, ABSTRACT_MONSTER),
|
||||
ENDERMAN(19, ABSTRACT_MONSTER),
|
||||
GIANT(28, ABSTRACT_MONSTER),
|
||||
SILVERFISH(63, ABSTRACT_MONSTER),
|
||||
VEX(80, ABSTRACT_MONSTER),
|
||||
WITCH(85, ABSTRACT_MONSTER),
|
||||
WITHER(86, ABSTRACT_MONSTER),
|
||||
|
||||
// Illagers
|
||||
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
|
||||
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
|
||||
EVOCATION_ILLAGER(21, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
ILLUSION_ILLAGER(31, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
VINDICATION_ILLAGER(81, ABSTRACT_ILLAGER_BASE),
|
||||
EVOCATION_ILLAGER(22, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
ILLUSION_ILLAGER(32, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
VINDICATION_ILLAGER(83, ABSTRACT_ILLAGER_BASE),
|
||||
|
||||
// Skeletons
|
||||
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
|
||||
SKELETON(63, ABSTRACT_SKELETON),
|
||||
STRAY(72, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(86, ABSTRACT_SKELETON),
|
||||
SKELETON(64, ABSTRACT_SKELETON),
|
||||
STRAY(73, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(87, ABSTRACT_SKELETON),
|
||||
|
||||
// Guardians
|
||||
GUARDIAN(28, ABSTRACT_MONSTER),
|
||||
ELDER_GUARDIAN(15, GUARDIAN),
|
||||
GUARDIAN(29, ABSTRACT_MONSTER),
|
||||
ELDER_GUARDIAN(16, GUARDIAN),
|
||||
|
||||
// Spiders
|
||||
SPIDER(70, ABSTRACT_MONSTER),
|
||||
CAVE_SPIDER(6, SPIDER),
|
||||
SPIDER(71, ABSTRACT_MONSTER),
|
||||
CAVE_SPIDER(7, SPIDER),
|
||||
|
||||
// Zombies - META CHECKED
|
||||
ZOMBIE(89, ABSTRACT_MONSTER),
|
||||
DROWNED(14, ZOMBIE),
|
||||
HUSK(30, ZOMBIE),
|
||||
ZOMBIE_PIGMAN(54, ZOMBIE),
|
||||
ZOMBIE_VILLAGER(91, ZOMBIE),
|
||||
ZOMBIE(90, ABSTRACT_MONSTER),
|
||||
DROWNED(15, ZOMBIE),
|
||||
HUSK(31, ZOMBIE),
|
||||
ZOMBIE_PIGMAN(55, ZOMBIE),
|
||||
ZOMBIE_VILLAGER(92, ZOMBIE),
|
||||
|
||||
// Flying entities
|
||||
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
|
||||
GHAST(26, ABSTRACT_FLYING),
|
||||
PHANTOM(92, ABSTRACT_FLYING),
|
||||
GHAST(27, ABSTRACT_FLYING),
|
||||
PHANTOM(93, ABSTRACT_FLYING),
|
||||
|
||||
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
|
||||
BAT(3, ABSTRACT_AMBIENT),
|
||||
|
||||
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
|
||||
SQUID(71, ABSTRACT_WATERMOB),
|
||||
SQUID(72, ABSTRACT_WATERMOB),
|
||||
|
||||
// Slimes
|
||||
SLIME(65, ABSTRACT_INSENTIENT),
|
||||
MAGMA_CUBE(38, SLIME),
|
||||
SLIME(66, ABSTRACT_INSENTIENT),
|
||||
MAGMA_CUBE(39, SLIME),
|
||||
|
||||
// Hangable objects
|
||||
ABSTRACT_HANGING(-1, ENTITY),
|
||||
LEASH_KNOT(35, ABSTRACT_HANGING),
|
||||
ITEM_FRAME(33, ABSTRACT_HANGING),
|
||||
PAINTING(49, ABSTRACT_HANGING),
|
||||
LEASH_KNOT(36, ABSTRACT_HANGING),
|
||||
ITEM_FRAME(34, ABSTRACT_HANGING),
|
||||
PAINTING(50, ABSTRACT_HANGING),
|
||||
|
||||
ABSTRACT_LIGHTNING(-1, ENTITY),
|
||||
LIGHTNING_BOLT(94, ABSTRACT_LIGHTNING),
|
||||
LIGHTNING_BOLT(95, ABSTRACT_LIGHTNING),
|
||||
|
||||
// Arrows
|
||||
ABSTRACT_ARROW(-1, ENTITY),
|
||||
ARROW(2, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(69, ABSTRACT_ARROW),
|
||||
TRIDENT(97, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(70, ABSTRACT_ARROW),
|
||||
TRIDENT(98, ABSTRACT_ARROW),
|
||||
|
||||
// Fireballs
|
||||
ABSTRACT_FIREBALL(-1, ENTITY),
|
||||
DRAGON_FIREBALL(13, ABSTRACT_FIREBALL),
|
||||
FIREBALL(34, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(66, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(87, ABSTRACT_FIREBALL),
|
||||
DRAGON_FIREBALL(14, ABSTRACT_FIREBALL),
|
||||
FIREBALL(35, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(67, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(88, ABSTRACT_FIREBALL),
|
||||
|
||||
// Projectiles
|
||||
PROJECTILE_ABSTRACT(-1, ENTITY),
|
||||
SNOWBALL(68, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(76, PROJECTILE_ABSTRACT),
|
||||
EGG(75, PROJECTILE_ABSTRACT),
|
||||
POTION(78, PROJECTILE_ABSTRACT),
|
||||
XP_BOTTLE(77, PROJECTILE_ABSTRACT),
|
||||
SNOWBALL(69, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(77, PROJECTILE_ABSTRACT),
|
||||
EGG(76, PROJECTILE_ABSTRACT),
|
||||
POTION(79, PROJECTILE_ABSTRACT),
|
||||
XP_BOTTLE(78, PROJECTILE_ABSTRACT),
|
||||
|
||||
// Vehicles
|
||||
MINECART_ABSTRACT(-1, ENTITY),
|
||||
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT),
|
||||
CHEST_MINECART(40, CHESTED_MINECART_ABSTRACT),
|
||||
HOPPER_MINECART(43, CHESTED_MINECART_ABSTRACT),
|
||||
MINECART(39, MINECART_ABSTRACT),
|
||||
FURNACE_MINECART(42, MINECART_ABSTRACT),
|
||||
COMMANDBLOCK_MINECART(41, MINECART_ABSTRACT),
|
||||
TNT_MINECART(45, MINECART_ABSTRACT),
|
||||
SPAWNER_MINECART(44, MINECART_ABSTRACT),
|
||||
CHEST_MINECART(41, CHESTED_MINECART_ABSTRACT),
|
||||
HOPPER_MINECART(44, CHESTED_MINECART_ABSTRACT),
|
||||
MINECART(40, MINECART_ABSTRACT),
|
||||
FURNACE_MINECART(43, MINECART_ABSTRACT),
|
||||
COMMANDBLOCK_MINECART(42, MINECART_ABSTRACT),
|
||||
TNT_MINECART(46, MINECART_ABSTRACT),
|
||||
SPAWNER_MINECART(45, MINECART_ABSTRACT),
|
||||
BOAT(5, ENTITY),
|
||||
;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ProtocolVersion {
|
||||
register(v1_13 = new ProtocolVersion(393, "1.13"));
|
||||
register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
|
||||
register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
|
||||
register(v1_14 = new ProtocolVersion(442, "1.14"));
|
||||
register(v1_14 = new ProtocolVersion(444, "1.14"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package us.myles.ViaVersion.api.type.types.version;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
|
||||
@ -38,6 +37,6 @@ public class ChunkSectionType1_8 extends Type<ChunkSection> {
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
||||
throw new NotImplementedException();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
@ -29,18 +29,18 @@ public class MappingData {
|
||||
JsonObject mapping1_12 = loadData("mapping-1.12.json");
|
||||
JsonObject mapping1_13 = loadData("mapping-1.13.json");
|
||||
|
||||
Via.getPlatform().getLogger().info("Loading block mapping...");
|
||||
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 block mapping...");
|
||||
blockMappings = new BlockMappingsShortArray(mapping1_12.getAsJsonObject("blocks"), mapping1_13.getAsJsonObject("blocks"));
|
||||
Via.getPlatform().getLogger().info("Loading item mapping...");
|
||||
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 item mapping...");
|
||||
mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items"));
|
||||
Via.getPlatform().getLogger().info("Loading new tags...");
|
||||
Via.getPlatform().getLogger().info("Loading new 1.13 tags...");
|
||||
loadTags(blockTags, mapping1_13.getAsJsonObject("block_tags"));
|
||||
loadTags(itemTags, mapping1_13.getAsJsonObject("item_tags"));
|
||||
loadTags(fluidTags, mapping1_13.getAsJsonObject("fluid_tags"));
|
||||
Via.getPlatform().getLogger().info("Loading enchantments...");
|
||||
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 enchantment mapping...");
|
||||
loadEnchantments(oldEnchantmentsIds, mapping1_12.getAsJsonObject("enchantments"));
|
||||
enchantmentMappings = new EnchantmentMappingByteArray(mapping1_12.getAsJsonObject("enchantments"), mapping1_13.getAsJsonObject("enchantments"));
|
||||
Via.getPlatform().getLogger().info("Loading sound mapping...");
|
||||
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 sound mapping...");
|
||||
soundMappings = new SoundMappingShortArray(mapping1_12.getAsJsonArray("sounds"), mapping1_13.getAsJsonArray("sounds"));
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2;
|
||||
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.EntityPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.PlayerPackets;
|
||||
@ -15,6 +17,11 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class Protocol1_14To1_13_2 extends Protocol {
|
||||
|
||||
static {
|
||||
MappingData.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
InventoryPackets.register(this);
|
||||
@ -118,161 +125,30 @@ public class Protocol1_14To1_13_2 extends Protocol {
|
||||
}
|
||||
|
||||
public static int getNewSoundId(int id) {
|
||||
// AUTO GENERATED - todo compact this?
|
||||
if (id < 15) return id + 0; // 15 = block.beacon.activate
|
||||
if (id < 19) return id + 29; // 19 = block.brewing_stand.brew
|
||||
if (id < 25) return id + 42; // 25 = block.chest.close
|
||||
if (id < 28) return id + 54; // 28 = block.chorus_flower.death
|
||||
if (id < 30) return id + 59; // 30 = block.wool.break
|
||||
if (id < 35) return id + 60; // 35 = block.comparator.click
|
||||
if (id < 41) return id + 64; // 41 = block.dispenser.dispense
|
||||
if (id < 44) return id + 80; // 44 = block.enchantment_table.use
|
||||
if (id < 45) return id + 114; // 45 = block.end_gateway.spawn
|
||||
if (id < 46) return id + 136; // 46 = block.end_portal.spawn
|
||||
if (id < 47) return id + 137; // 47 = block.end_portal_frame.fill
|
||||
if (id < 48) return id + 135; // 48 = block.ender_chest.close
|
||||
if (id < 50) return id + 111; // 50 = block.fence_gate.close
|
||||
if (id < 52) return id + 144; // 52 = block.fire.ambient
|
||||
if (id < 54) return id + 153; // 54 = block.furnace.fire_crackle
|
||||
if (id < 55) return id + 155; // 55 = block.glass.break
|
||||
if (id < 80) return id + 172; // 80 = block.iron_door.close
|
||||
if (id < 82) return id + 219; // 82 = block.iron_trapdoor.close
|
||||
if (id < 84) return id + 223; // 84 = block.ladder.break
|
||||
if (id < 92) return id + 230; // 92 = block.lever.click
|
||||
if (id < 93) return id + 232; // 93 = block.metal.break
|
||||
if (id < 97) return id + 248; // 97 = block.metal.step
|
||||
if (id < 98) return id + 250; // 98 = block.metal_pressure_plate.click_off
|
||||
if (id < 100) return id + 247; // 100 = block.note_block.basedrum
|
||||
if (id < 111) return id + 263; // 111 = block.piston.contract
|
||||
if (id < 113) return id + 325; // 113 = block.portal.ambient
|
||||
if (id < 116) return id + 349; // 116 = block.pumpkin.carve
|
||||
if (id < 117) return id + 356; // 117 = block.redstone_torch.burnout
|
||||
if (id < 118) return id + 373; // 118 = block.sand.break
|
||||
if (id < 123) return id + 377; // 123 = block.shulker_box.close
|
||||
if (id < 125) return id + 386; // 125 = block.slime_block.break
|
||||
if (id < 130) return id + 417; // 130 = block.snow.break
|
||||
if (id < 132) return id + 425; // 132 = block.snow.hit
|
||||
if (id < 135) return id + 429; // 135 = block.stone.break
|
||||
if (id < 136) return id + 439; // 136 = block.stone.fall
|
||||
if (id < 139) return id + 441; // 139 = block.stone.step
|
||||
if (id < 140) return id + 443; // 140 = block.stone_button.click_off
|
||||
if (id < 142) return id + 435; // 142 = block.stone_pressure_plate.click_off
|
||||
if (id < 144) return id + 438; // 144 = block.tripwire.attach
|
||||
if (id < 148) return id + 454; // 148 = block.water.ambient
|
||||
if (id < 149) return id + 490; // 149 = block.lily_pad.place
|
||||
if (id < 150) return id + 488; // 150 = block.wood.break
|
||||
if (id < 151) return id + 519; // 151 = block.wood.fall
|
||||
if (id < 154) return id + 521; // 154 = block.wood.step
|
||||
if (id < 155) return id + 523; // 155 = block.wooden_button.click_off
|
||||
if (id < 157) return id + 515; // 157 = block.wooden_pressure_plate.click_off
|
||||
if (id < 159) return id + 518; // 159 = block.wooden_door.close
|
||||
if (id < 163) return id + 506; // 163 = enchant.thorns.hit
|
||||
if (id < 164) return id + 424; // 164 = entity.armor_stand.break
|
||||
if (id < 171) return id + -141; // 171 = entity.bat.ambient
|
||||
if (id < 176) return id + -132; // 176 = entity.blaze.ambient
|
||||
if (id < 186) return id + -128; // 186 = entity.cat.ambient
|
||||
if (id < 192) return id + -113; // 192 = entity.chicken.ambient
|
||||
if (id < 197) return id + -110; // 197 = entity.cod.ambient
|
||||
if (id < 201) return id + -102; // 201 = entity.cow.ambient
|
||||
if (id < 209) return id + -96; // 209 = entity.dolphin.ambient
|
||||
if (id < 242) return id + -85; // 242 = entity.ender_dragon.ambient
|
||||
if (id < 244) return id + -81; // 244 = entity.ender_dragon.flap
|
||||
if (id < 248) return id + -80; // 248 = entity.dragon_fireball.explode
|
||||
if (id < 249) return id + -85; // 249 = entity.ender_eye.death
|
||||
if (id < 262) return id + -81; // 262 = entity.evoker.ambient
|
||||
if (id < 265) return id + -78; // 265 = entity.evoker.hurt
|
||||
if (id < 269) return id + -77; // 269 = entity.evoker_fangs.attack
|
||||
if (id < 270) return id + -82; // 270 = entity.experience_bottle.throw
|
||||
if (id < 272) return id + -78; // 272 = entity.firework_rocket.blast
|
||||
if (id < 280) return id + -75; // 280 = entity.fish.swim
|
||||
if (id < 281) return id + -73; // 281 = entity.generic.big_fall
|
||||
if (id < 298) return id + -71; // 298 = entity.guardian.ambient
|
||||
if (id < 306) return id + -46; // 306 = entity.horse.ambient
|
||||
if (id < 330) return id + -45; // 330 = entity.illusioner.ambient
|
||||
if (id < 337) return id + -38; // 337 = entity.iron_golem.attack
|
||||
if (id < 341) return id + -36; // 341 = entity.item.break
|
||||
if (id < 343) return id + -29; // 343 = entity.item_frame.add_item
|
||||
if (id < 348) return id + -36; // 348 = entity.leash_knot.break
|
||||
if (id < 350) return id + -26; // 350 = entity.lightning_bolt.impact
|
||||
if (id < 366) return id + -25; // 366 = entity.minecart.inside
|
||||
if (id < 373) return id + -18; // 373 = entity.painting.break
|
||||
if (id < 375) return id + 1; // 375 = entity.parrot.ambient
|
||||
if (id < 421) return id + 12; // 421 = entity.player.attack.crit
|
||||
if (id < 445) return id + 17; // 445 = entity.puffer_fish.ambient
|
||||
if (id < 452) return id + 20; // 452 = entity.rabbit.ambient
|
||||
if (id < 457) return id + 21; // 457 = entity.salmon.ambient
|
||||
if (id < 461) return id + 34; // 461 = entity.sheep.ambient
|
||||
if (id < 466) return id + 39; // 466 = entity.shulker.ambient
|
||||
if (id < 467) return id + 42; // 467 = entity.shulker.close
|
||||
if (id < 474) return id + 46; // 474 = entity.shulker_bullet.hit
|
||||
if (id < 476) return id + 37; // 476 = entity.silverfish.ambient
|
||||
if (id < 482) return id + 44; // 482 = entity.skeleton.hurt
|
||||
if (id < 485) return id + 52; // 485 = entity.skeleton_horse.ambient
|
||||
if (id < 493) return id + 41; // 493 = entity.slime.attack
|
||||
if (id < 498) return id + 44; // 498 = entity.magma_cube.death_small
|
||||
if (id < 505) return id + 49; // 505 = entity.snow_golem.ambient
|
||||
if (id < 509) return id + 52; // 509 = entity.snowball.throw
|
||||
if (id < 510) return id + 45; // 510 = entity.spider.ambient
|
||||
if (id < 520) return id + 54; // 520 = entity.stray.ambient
|
||||
if (id < 524) return id + 63; // 524 = entity.tnt.primed
|
||||
if (id < 525) return id + 64; // 525 = entity.tropical_fish.ambient
|
||||
if (id < 541) return id + 77; // 541 = entity.vex.ambient
|
||||
if (id < 554) return id + 83; // 554 = entity.witch.ambient
|
||||
if (id < 564) return id + 87; // 564 = entity.wither.spawn
|
||||
if (id < 565) return id + 91; // 565 = entity.wither_skeleton.ambient
|
||||
if (id < 569) return id + 86; // 569 = entity.wolf.ambient
|
||||
if (id < 578) return id + 87; // 578 = entity.zombie.ambient
|
||||
if (id < 585) return id + 100; // 585 = entity.zombie.hurt
|
||||
if (id < 587) return id + 103; // 587 = entity.zombie.step
|
||||
if (id < 588) return id + 107; // 588 = entity.zombie_horse.ambient
|
||||
if (id < 591) return id + 97; // 591 = entity.zombie_pigman.ambient
|
||||
if (id < 595) return id + 99; // 595 = entity.zombie_villager.ambient
|
||||
if (id < 601) return id + 100; // 601 = item.armor.equip_chain
|
||||
if (id < 609) return id + -586; // 609 = item.axe.strip
|
||||
if (id < 610) return id + -579; // 610 = item.bottle.empty
|
||||
if (id < 613) return id + -552; // 613 = item.bucket.empty
|
||||
if (id < 619) return id + -546; // 619 = item.chorus_fruit.teleport
|
||||
if (id < 620) return id + -530; // 620 = item.elytra.flying
|
||||
if (id < 621) return id + -463; // 621 = item.firecharge.use
|
||||
if (id < 622) return id + -425; // 622 = item.flintandsteel.use
|
||||
if (id < 623) return id + -414; // 623 = item.hoe.till
|
||||
if (id < 624) return id + -363; // 624 = item.shield.block
|
||||
if (id < 627) return id + -119; // 627 = item.totem.use
|
||||
if (id < 636) return id + -38; // 636 = music.creative
|
||||
if (id < 644) return id + -281; // 644 = music_disc.11
|
||||
if (id < 656) return id + -166; // 656 = ui.button.click
|
||||
if (id < 657) return id + -38; // 657 = ui.toast.challenge_complete
|
||||
if (id < 660) return id + -36; // 660 = weather.rain
|
||||
return id + -21;
|
||||
int newId = MappingData.soundMappings.getNewSound(id);
|
||||
if (newId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Missing 1.14 sound for 1.13.2 sound " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
if (id < 1121) return id;
|
||||
else if (id < 3108) return id + 3;
|
||||
else if (id < 3278) return id + 163;
|
||||
else if (id < 3978) return id + 203;
|
||||
else if (id < 3984) return id + 207;
|
||||
else if (id < 3988) return id + 197;
|
||||
else if (id < 5284) return id + 203;
|
||||
else if (id < 7300) return id + 206;
|
||||
else if (id < 8591) return id + 212;
|
||||
else if (id < 8595) return id + 226;
|
||||
else return id + 2192;
|
||||
int newId = MappingData.blockStateMappings.getNewBlock(id);
|
||||
if (newId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Missing 1.14 blockstate for 1.13.2 blockstate " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getNewBlockId(int id) {
|
||||
// AUTO GENERATED
|
||||
if (id < 128) return id + 0; // 128 = minecraft:brown_mushroom
|
||||
if (id < 151) return id + 3; // 151 = minecraft:oak_door
|
||||
if (id < 156) return id + 8; // 156 = minecraft:lever
|
||||
if (id < 208) return id + 13; // 208 = minecraft:infested_stone
|
||||
if (id < 214) return id + 17; // 214 = minecraft:stone_bricks
|
||||
if (id < 218) return id + 7; // 218 = minecraft:brown_mushroom_block
|
||||
if (id < 278) return id + 13; // 278 = minecraft:potted_red_mushroom
|
||||
if (id < 435) return id + 16; // 435 = minecraft:sandstone_slab
|
||||
if (id < 594) return id + 17; // 594 = minecraft:void_air
|
||||
if (id < 597) return id + 20; // 597 = minecraft:structure_block
|
||||
return id + 59;
|
||||
int newId = MappingData.blockMappings.getNewBlock(id);
|
||||
if (newId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Missing 1.14 block for 1.13.2 block " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,51 +10,93 @@ public class EntityTypeRewriter {
|
||||
private static Map<Integer, Integer> objectTypes = new HashMap<>();
|
||||
|
||||
static {
|
||||
regEnt(74, 75); // egg
|
||||
regEnt(75, 76); // ender_pearl
|
||||
regEnt(76, 77); // experience_bottle
|
||||
regEnt(93, 96); // fishing_bobber
|
||||
regEnt(80, 81); // iron_golem
|
||||
regEnt(91, 94); // lightning_bolt
|
||||
regEnt(50, 51); // parrot
|
||||
regEnt(90, 92); // phantom
|
||||
regEnt(51, 52); // pig
|
||||
regEnt(92, 95); // player
|
||||
regEnt(54, 55); // polar_bear
|
||||
regEnt(77, 78); // potion
|
||||
regEnt(52, 53); // pufferfish
|
||||
regEnt(56, 57); // rabbit
|
||||
regEnt(57, 58); // salmon
|
||||
regEnt(58, 59); // sheep
|
||||
regEnt(59, 60); // shulker
|
||||
regEnt(60, 61); // shulker_bullet
|
||||
regEnt(61, 62); // silverfish
|
||||
regEnt(62, 63); // skeleton
|
||||
regEnt(63, 64); // skeleton_horse
|
||||
regEnt(64, 65); // slime
|
||||
regEnt(65, 66); // small_fireball
|
||||
regEnt(66, 67); // snowgolem
|
||||
regEnt(67, 68); // snowball
|
||||
regEnt(68, 69); // spectral_arrow
|
||||
regEnt(69, 70); // spider
|
||||
regEnt(70, 71); // squid
|
||||
regEnt(71, 72); // stray
|
||||
regEnt(55, 56); // tnt
|
||||
regEnt(94, 97); // trident
|
||||
regEnt(72, 73); // tropical_fish
|
||||
regEnt(73, 74); // turtle
|
||||
regEnt(78, 79); // vex
|
||||
regEnt(79, 80); // villager
|
||||
regEnt(81, 82); // vindicator
|
||||
regEnt(82, 84); // witch
|
||||
regEnt(83, 85); // wither
|
||||
regEnt(84, 86); // wither_skeleton
|
||||
regEnt(85, 87); // wither_skull
|
||||
regEnt(86, 88); // wolf
|
||||
regEnt(87, 89); // zombie
|
||||
regEnt(88, 90); // zombie_horse
|
||||
regEnt(53, 54); // zombie_pigman
|
||||
regEnt(89, 91); // zombie_villager
|
||||
regEnt(6, 7); // cave_spider
|
||||
regEnt(7, 8); // chicken
|
||||
regEnt(8, 9); // cod
|
||||
regEnt(9, 10); // cow
|
||||
regEnt(10, 11); // creeper
|
||||
regEnt(11, 12); // donkey
|
||||
regEnt(12, 13); // dolphin
|
||||
regEnt(13, 14); // dragon_fireball
|
||||
regEnt(14, 15); // drowned
|
||||
regEnt(15, 16); // elder_guardian
|
||||
regEnt(16, 17); // end_crystal
|
||||
regEnt(17, 18); // ender_dragon
|
||||
regEnt(18, 19); // enderman
|
||||
regEnt(19, 20); // endermite
|
||||
regEnt(20, 21); // evoker_fangs
|
||||
regEnt(21, 22); // evoker
|
||||
regEnt(22, 23); // experience_orb
|
||||
regEnt(23, 24); // eye_of_ender
|
||||
regEnt(24, 25); // falling_block
|
||||
regEnt(25, 26); // firework_rocket
|
||||
regEnt(26, 27); // ghast
|
||||
regEnt(27, 28); // giant
|
||||
regEnt(28, 29); // guardian
|
||||
regEnt(29, 30); // husk
|
||||
regEnt(31, 32); // illusioner
|
||||
regEnt(32, 33); // item
|
||||
regEnt(33, 34); // item_frame
|
||||
regEnt(35, 36); // leash_knot
|
||||
regEnt(34, 35); // fireball
|
||||
regEnt(36, 37); // llama
|
||||
regEnt(37, 38); // llama_spit
|
||||
regEnt(38, 39); // magma_cube
|
||||
regEnt(39, 40); // minecart
|
||||
regEnt(40, 41); // chest_minecart
|
||||
regEnt(41, 42); // command_block_minecart
|
||||
regEnt(42, 43); // furnace_minecart
|
||||
regEnt(43, 44); // hopper_minecart
|
||||
regEnt(45, 46); // tnt_minecart
|
||||
regEnt(46, 47); // mule
|
||||
regEnt(47, 48); // mooshroom
|
||||
regEnt(48, 49); // ocelot
|
||||
regEnt(49, 50); // painting
|
||||
regEnt(50, 52); // parrot
|
||||
regEnt(51, 53); // pig
|
||||
regEnt(52, 54); // pufferfish
|
||||
regEnt(53, 55); // zombie_pigman
|
||||
regEnt(54, 56); // polar_bear
|
||||
regEnt(55, 57); // tnt
|
||||
regEnt(56, 58); // rabbit
|
||||
regEnt(57, 59); // salmon
|
||||
regEnt(58, 60); // sheep
|
||||
regEnt(59, 61); // shulker
|
||||
regEnt(60, 62); // shulker_bullet
|
||||
regEnt(61, 63); // silverfish
|
||||
regEnt(62, 64); // skeleton
|
||||
regEnt(63, 65); // skeleton_horse
|
||||
regEnt(64, 66); // slime
|
||||
regEnt(65, 67); // small_fireball
|
||||
regEnt(66, 68); // snowgolem
|
||||
regEnt(67, 69); // snowball
|
||||
regEnt(68, 70); // spectral_arrow
|
||||
regEnt(69, 71); // spider
|
||||
regEnt(70, 72); // squid
|
||||
regEnt(71, 73); // stray
|
||||
regEnt(72, 74); // tropical_fish
|
||||
regEnt(73, 75); // turtle
|
||||
regEnt(74, 76); // egg
|
||||
regEnt(75, 77); // ender_pearl
|
||||
regEnt(76, 78); // experience_bottle
|
||||
regEnt(77, 79); // potion
|
||||
regEnt(78, 80); // vex
|
||||
regEnt(79, 81); // villager
|
||||
regEnt(80, 82); // iron_golem
|
||||
regEnt(81, 83); // vindicator
|
||||
regEnt(82, 85); // witch
|
||||
regEnt(83, 86); // wither
|
||||
regEnt(84, 87); // wither_skeleton
|
||||
regEnt(85, 88); // wither_skull
|
||||
regEnt(86, 89); // wolf
|
||||
regEnt(87, 90); // zombie
|
||||
regEnt(88, 91); // zombie_horse
|
||||
regEnt(89, 92); // zombie_villager
|
||||
regEnt(90, 93); // phantom
|
||||
regEnt(91, 95); // lightning_bolt
|
||||
regEnt(92, 96); // player
|
||||
regEnt(93, 97); // fishing_bobber
|
||||
regEnt(94, 98); // trident
|
||||
}
|
||||
|
||||
private static void regEnt(int type1_13, int type1_14) {
|
||||
|
@ -0,0 +1,148 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
public class MappingData {
|
||||
public static BiMap<Integer, Integer> oldToNewItems = HashBiMap.create();
|
||||
public static BlockMappings blockStateMappings;
|
||||
public static BlockMappings blockMappings;
|
||||
public static SoundMappings soundMappings;
|
||||
|
||||
public static void init() {
|
||||
JsonObject mapping1_13_2 = loadData("mapping-1.13.2.json");
|
||||
JsonObject mapping1_14 = loadData("mapping-1.14.json");
|
||||
|
||||
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 blockstate mapping...");
|
||||
blockStateMappings = new BlockMappingsShortArray(mapping1_13_2.getAsJsonObject("blockstates"), mapping1_14.getAsJsonObject("blockstates"));
|
||||
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 block mapping...");
|
||||
blockMappings = new BlockMappingsShortArray(mapping1_13_2.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks"));
|
||||
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 item mapping...");
|
||||
mapIdentifiers(oldToNewItems, mapping1_13_2.getAsJsonObject("items"), mapping1_14.getAsJsonObject("items"));
|
||||
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 sound mapping...");
|
||||
soundMappings = new SoundMappingShortArray(mapping1_13_2.getAsJsonArray("sounds"), mapping1_14.getAsJsonArray("sounds"));
|
||||
}
|
||||
|
||||
public static JsonObject loadData(String name) {
|
||||
InputStream stream = MappingData.class.getClassLoader().getResourceAsStream("assets/viaversion/data/" + name);
|
||||
InputStreamReader reader = new InputStreamReader(stream);
|
||||
try {
|
||||
return GsonUtil.getGson().fromJson(reader, JsonObject.class);
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException ignored) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void mapIdentifiers(Map<Integer, Integer> output, JsonObject oldIdentifiers, JsonObject newIdentifiers) {
|
||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
||||
if (value == null) {
|
||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
output.put(Integer.parseInt(entry.getKey()), Integer.parseInt(value.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void mapIdentifiers(short[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers) {
|
||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
||||
if (value == null) {
|
||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
output[Integer.parseInt(entry.getKey())] = Short.parseShort(value.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
private static void mapIdentifiers(short[] output, JsonArray oldIdentifiers, JsonArray newIdentifiers) {
|
||||
for (int i = 0; i < oldIdentifiers.size(); i++) {
|
||||
JsonElement v = oldIdentifiers.get(i);
|
||||
Integer index = findIndex(newIdentifiers, v.getAsString());
|
||||
if (index == null) {
|
||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
output[i] = index.shortValue();
|
||||
}
|
||||
}
|
||||
|
||||
private static Map.Entry<String, JsonElement> findValue(JsonObject object, String needle) {
|
||||
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
String value = entry.getValue().getAsString();
|
||||
if (value.equals(needle)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Integer findIndex(JsonArray array, String value) {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JsonElement v = array.get(i);
|
||||
if (v.getAsString().equals(value)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public interface SoundMappings {
|
||||
int getNewSound(int old);
|
||||
}
|
||||
|
||||
private static class SoundMappingShortArray implements SoundMappings {
|
||||
private short[] oldToNew;
|
||||
|
||||
private SoundMappingShortArray(JsonArray mapping1_13_2, JsonArray mapping1_14) {
|
||||
oldToNew = new short[mapping1_13_2.size()];
|
||||
Arrays.fill(oldToNew, (short) -1);
|
||||
mapIdentifiers(oldToNew, mapping1_13_2, mapping1_14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNewSound(int old) {
|
||||
return old >= 0 && old < oldToNew.length ? oldToNew[old] : -1;
|
||||
}
|
||||
}
|
||||
|
||||
public interface BlockMappings {
|
||||
int getNewBlock(int old);
|
||||
}
|
||||
|
||||
private static class BlockMappingsShortArray implements BlockMappings {
|
||||
private short[] oldToNew;
|
||||
|
||||
private BlockMappingsShortArray(JsonObject mapping1_13_2, JsonObject mapping1_14) {
|
||||
oldToNew = new short[mapping1_13_2.entrySet().size()];
|
||||
Arrays.fill(oldToNew, (short) -1);
|
||||
mapIdentifiers(oldToNew, mapping1_13_2, mapping1_14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNewBlock(int old) {
|
||||
return old >= 0 && old < oldToNew.length ? oldToNew[old] : -1;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets;
|
||||
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
|
||||
public class InventoryPackets {
|
||||
|
||||
@ -201,16 +203,12 @@ public class InventoryPackets {
|
||||
}
|
||||
|
||||
public static int getNewItemId(int id) {
|
||||
if (id < 108) return id;
|
||||
else if (id < 119) return id + 3;
|
||||
else if (id < 460) return id + 4;
|
||||
else if (id < 542) return id + 43;
|
||||
else if (id < 561) return id + 48;
|
||||
else if (id < 593) return id + 49;
|
||||
else if (id < 657) return id + 53;
|
||||
else if (id < 662) return id + 54;
|
||||
else if (id < 665) return id + 55;
|
||||
else return id + 56;
|
||||
Integer newId = MappingData.oldToNewItems.get(id);
|
||||
if (newId == null) {
|
||||
Via.getPlatform().getLogger().warning("Missing 1.14 item for 1.13.2 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static void toServer(Item item) {
|
||||
@ -219,25 +217,7 @@ public class InventoryPackets {
|
||||
}
|
||||
|
||||
public static int getOldItemId(int id) {
|
||||
if (id < 108) return id;
|
||||
else if (id < 111) return 1;
|
||||
else if (id < 122) return id - 3;
|
||||
else if (id < 123) return 1;
|
||||
else if (id < 464) return id - 4;
|
||||
else if (id < 503) return 1;
|
||||
else if (id < 585) return id - 43;
|
||||
else if (id < 590) return 1;
|
||||
else if (id < 609) return id - 48;
|
||||
else if (id < 610) return 1;
|
||||
else if (id < 642) return id - 49;
|
||||
else if (id < 646) return 1;
|
||||
else if (id < 710) return id - 53;
|
||||
else if (id < 711) return 1;
|
||||
else if (id < 716) return id - 54;
|
||||
else if (id < 717) return 1;
|
||||
else if (id < 720) return id - 55;
|
||||
else if (id < 721) return 1;
|
||||
else if (id < 846) return id - 56;
|
||||
else return 1;
|
||||
Integer oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||
return oldId != null ? oldId : 1;
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,14 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class WorldPackets {
|
||||
private static final int AIR = MappingData.blockStateMappings.getNewBlock(0);
|
||||
private static final int VOID_AIR = MappingData.blockStateMappings.getNewBlock(8591);
|
||||
private static final int CAVE_AIR = MappingData.blockStateMappings.getNewBlock(8592);
|
||||
|
||||
public static void register(Protocol protocol) {
|
||||
|
||||
@ -91,6 +95,7 @@ public class WorldPackets {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//Chunk
|
||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
||||
@Override
|
||||
@ -107,10 +112,10 @@ public class WorldPackets {
|
||||
boolean hasBlock = false;
|
||||
for (int i = 0; i < section.getPalette().size(); i++) {
|
||||
int old = section.getPalette().get(i);
|
||||
if (!hasBlock && !(old == 0 || old == 8591 || old == 8592)) { // air, void_air, cave_air
|
||||
int newId = Protocol1_14To1_13_2.getNewBlockStateId(old);
|
||||
if (!hasBlock && newId != AIR && newId != VOID_AIR && newId != CAVE_AIR) { // air, void_air, cave_air
|
||||
hasBlock = true;
|
||||
}
|
||||
int newId = Protocol1_14To1_13_2.getNewBlockStateId(old);
|
||||
section.getPalette().set(i, newId);
|
||||
}
|
||||
if (!hasBlock) {
|
||||
@ -122,7 +127,7 @@ public class WorldPackets {
|
||||
for (int y = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int id = section.getFlatBlock(x, y, z);
|
||||
if (id == 0 || id == 8591 || id == 8592) {
|
||||
if (id != AIR && id != VOID_AIR && id != CAVE_AIR) {
|
||||
nonAirBlockCount++;
|
||||
}
|
||||
}
|
||||
@ -146,6 +151,8 @@ public class WorldPackets {
|
||||
}
|
||||
lightPacket.write(Type.VAR_INT, skyLightMask);
|
||||
lightPacket.write(Type.VAR_INT, blockLightMask);
|
||||
lightPacket.write(Type.VAR_INT, 0); //TODO find out what these two bitmasks mean
|
||||
lightPacket.write(Type.VAR_INT, 0); //TODO
|
||||
for (ChunkSection section : chunk.getSections()) {
|
||||
if (section == null || !section.hasSkyLight()) continue;
|
||||
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
||||
|
@ -77,6 +77,7 @@ public class Chunk1_14Type extends PartialType<Chunk, ClientWorld> {
|
||||
|
||||
output.writeBoolean(chunk.isGroundUp());
|
||||
Type.VAR_INT.write(output, chunk.getBitmask());
|
||||
Type.NBT.write(output, new CompoundTag("")); //TODO unknown compound tag
|
||||
|
||||
ByteBuf buf = output.alloc().buffer();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
|
10659
common/src/main/resources/assets/viaversion/data/mapping-1.13.2.json
Normale Datei
10659
common/src/main/resources/assets/viaversion/data/mapping-1.13.2.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
13117
common/src/main/resources/assets/viaversion/data/mapping-1.14.json
Normale Datei
13117
common/src/main/resources/assets/viaversion/data/mapping-1.14.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>viaversion-jar</name>
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.6.1-18w43c</version>
|
||||
<version>1.6.1-18w45a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren