diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java b/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java index 920c016a2..07a2646db 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java @@ -106,4 +106,6 @@ public interface MappingData { @Nullable Mappings getEnchantmentMappings(); @Nullable FullMappingData getArgumentTypeMappings(); + + @Nullable Mappings getPaintingMappings(); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java index 206db497a..2b89182eb 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java @@ -52,6 +52,7 @@ public class MappingDataBase implements MappingData { protected Mappings soundMappings; protected Mappings statisticsMappings; protected Mappings enchantmentMappings; + protected Mappings paintingMappings; protected Map> tags; protected boolean loadItems = true; @@ -78,6 +79,7 @@ public class MappingDataBase implements MappingData { soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds"); statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics"); enchantmentMappings = loadFromArray(oldMappings, newMappings, diffmapping, "enchantments"); + paintingMappings = loadFromArray(oldMappings, newMappings, diffmapping, "paintings"); Mappings argumentTypeMappings = loadFromArray(oldMappings, newMappings, diffmapping, "argumenttypes"); if (argumentTypeMappings != null) { @@ -210,6 +212,11 @@ public class MappingDataBase implements MappingData { return argumentTypeMappings; } + @Override + public @Nullable Mappings getPaintingMappings() { + return paintingMappings; + } + protected @Nullable Mappings loadFromArray(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) { if (!oldMappings.has(key) || !newMappings.has(key)) return null; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java new file mode 100644 index 000000000..8bc95d605 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java @@ -0,0 +1,47 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2022 ViaVersion and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.viaversion.viaversion.api.minecraft; + +public class Position3d { + private final double x; + private final double y; + private final double z; + + public Position3d(final double x, final double y, final double z) { + this.x = x; + this.y = y; + this.z = z; + } + + public double x() { + return x; + } + + public double y() { + return y; + } + + public double z() { + return z; + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java index de893883c..efa2b6716 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java @@ -50,9 +50,10 @@ public final class MetaTypes1_19 extends AbstractMetaTypes { public final MetaType catVariantType = add(19, Type.VAR_INT); public final MetaType frogVariantType = add(20, Type.VAR_INT); public final MetaType optionalGlobalPosition = add(21, Type.OPTIONAL_GLOBAL_POSITION); + public final MetaType paintingVariantType = add(22, Type.VAR_INT); public MetaTypes1_19(final ParticleType particleType) { - super(22); + super(23); this.particleType = add(15, particleType); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java index 9491d299c..cda9f73cf 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java @@ -80,7 +80,7 @@ public class ProtocolVersion { public static final ProtocolVersion v1_17_1 = register(756, "1.17.1"); public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1)); public static final ProtocolVersion v1_18_2 = register(758, "1.18.2"); - public static final ProtocolVersion v1_19 = register(759, 79, "1.19"); + public static final ProtocolVersion v1_19 = register(759, 80, "1.19"); public static final ProtocolVersion unknown = register(-1, "UNKNOWN"); public static ProtocolVersion register(int version, String name) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/ClientboundPackets1_19.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/ClientboundPackets1_19.java index c5a7309da..966cc7248 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/ClientboundPackets1_19.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/ClientboundPackets1_19.java @@ -23,106 +23,105 @@ public enum ClientboundPackets1_19 implements ClientboundPacketType { SPAWN_ENTITY, // 0x00 SPAWN_EXPERIENCE_ORB, // 0x01 - SPAWN_PAINTING, // 0x02 - SPAWN_PLAYER, // 0x03 - ENTITY_ANIMATION, // 0x04 - STATISTICS, // 0x05 - BLOCK_CHANGED_ACK, // 0x06 - BLOCK_BREAK_ANIMATION, // 0x07 - BLOCK_ENTITY_DATA, // 0x08 - BLOCK_ACTION, // 0x09 - BLOCK_CHANGE, // 0x0A - BOSSBAR, // 0x0B - SERVER_DIFFICULTY, // 0x0C - CHAT_MESSAGE, // 0x0D - CLEAR_TITLES, // 0x0E - TAB_COMPLETE, // 0x0F - DECLARE_COMMANDS, // 0x10 - CLOSE_WINDOW, // 0x11 - WINDOW_ITEMS, // 0x12 - WINDOW_PROPERTY, // 0x13 - SET_SLOT, // 0x14 - COOLDOWN, // 0x15 - PLUGIN_MESSAGE, // 0x16 - NAMED_SOUND, // 0x17 - DISCONNECT, // 0x18 - ENTITY_STATUS, // 0x19 - EXPLOSION, // 0x1A - UNLOAD_CHUNK, // 0x1B - GAME_EVENT, // 0x1C - OPEN_HORSE_WINDOW, // 0x1D - WORLD_BORDER_INIT, // 0x1E - KEEP_ALIVE, // 0x1F - CHUNK_DATA, // 0x20 - EFFECT, // 0x21 - SPAWN_PARTICLE, // 0x22 - UPDATE_LIGHT, // 0x23 - JOIN_GAME, // 0x24 - MAP_DATA, // 0x25 - TRADE_LIST, // 0x26 - ENTITY_POSITION, // 0x27 - ENTITY_POSITION_AND_ROTATION, // 0x28 - ENTITY_ROTATION, // 0x29 - VEHICLE_MOVE, // 0x2A - OPEN_BOOK, // 0x2B - OPEN_WINDOW, // 0x2C - OPEN_SIGN_EDITOR, // 0x2D - PING, // 0x2E - CRAFT_RECIPE_RESPONSE, // 0x2F - PLAYER_ABILITIES, // 0x30 - COMBAT_END, // 0x31 - COMBAT_ENTER, // 0x32 - COMBAT_KILL, // 0x33 - PLAYER_INFO, // 0x34 - FACE_PLAYER, // 0x35 - PLAYER_POSITION, // 0x36 - UNLOCK_RECIPES, // 0x37 - REMOVE_ENTITIES, // 0x38 - REMOVE_ENTITY_EFFECT, // 0x39 - RESOURCE_PACK, // 0x3A - RESPAWN, // 0x3B - ENTITY_HEAD_LOOK, // 0x3C - MULTI_BLOCK_CHANGE, // 0x3D - SELECT_ADVANCEMENTS_TAB, // 0x3E - ACTIONBAR, // 0x3F - WORLD_BORDER_CENTER, // 0x40 - WORLD_BORDER_LERP_SIZE, // 0x41 - WORLD_BORDER_SIZE, // 0x42 - WORLD_BORDER_WARNING_DELAY, // 0x43 - WORLD_BORDER_WARNING_DISTANCE, // 0x44 - CAMERA, // 0x45 - HELD_ITEM_CHANGE, // 0x46 - UPDATE_VIEW_POSITION, // 0x47 - UPDATE_VIEW_DISTANCE, // 0x48 - SPAWN_POSITION, // 0x49 - DISPLAY_SCOREBOARD, // 0x4A - ENTITY_METADATA, // 0x4B - ATTACH_ENTITY, // 0x4C - ENTITY_VELOCITY, // 0x4D - ENTITY_EQUIPMENT, // 0x4E - SET_EXPERIENCE, // 0x4F - UPDATE_HEALTH, // 0x50 - SCOREBOARD_OBJECTIVE, // 0x51 - SET_PASSENGERS, // 0x52 - TEAMS, // 0x53 - UPDATE_SCORE, // 0x54 - SET_SIMULATION_DISTANCE, // 0x55 - TITLE_SUBTITLE, // 0x56 - TIME_UPDATE, // 0x57 - TITLE_TEXT, // 0x58 - TITLE_TIMES, // 0x59 - ENTITY_SOUND, // 0x5A - SOUND, // 0x5B - STOP_SOUND, // 0x5C - TAB_LIST, // 0x5D - NBT_QUERY, // 0x5E - COLLECT_ITEM, // 0x5F - ENTITY_TELEPORT, // 0x60 - ADVANCEMENTS, // 0x61 - ENTITY_PROPERTIES, // 0x62 - ENTITY_EFFECT, // 0x63 - DECLARE_RECIPES, // 0x64 - TAGS; // 0x65 + SPAWN_PLAYER, // 0x02 + ENTITY_ANIMATION, // 0x03 + STATISTICS, // 0x04 + BLOCK_CHANGED_ACK, // 0x05 + BLOCK_BREAK_ANIMATION, // 0x06 + BLOCK_ENTITY_DATA, // 0x07 + BLOCK_ACTION, // 0x08 + BLOCK_CHANGE, // 0x09 + BOSSBAR, // 0x0A + SERVER_DIFFICULTY, // 0x0B + CHAT_MESSAGE, // 0x0C + CLEAR_TITLES, // 0x0D + TAB_COMPLETE, // 0x0E + DECLARE_COMMANDS, // 0x0F + CLOSE_WINDOW, // 0x10 + WINDOW_ITEMS, // 0x11 + WINDOW_PROPERTY, // 0x12 + SET_SLOT, // 0x13 + COOLDOWN, // 0x14 + PLUGIN_MESSAGE, // 0x15 + NAMED_SOUND, // 0x16 + DISCONNECT, // 0x17 + ENTITY_STATUS, // 0x18 + EXPLOSION, // 0x19 + UNLOAD_CHUNK, // 0x1A + GAME_EVENT, // 0x1B + OPEN_HORSE_WINDOW, // 0x1C + WORLD_BORDER_INIT, // 0x1D + KEEP_ALIVE, // 0x1E + CHUNK_DATA, // 0x1F + EFFECT, // 0x20 + SPAWN_PARTICLE, // 0x21 + UPDATE_LIGHT, // 0x22 + JOIN_GAME, // 0x23 + MAP_DATA, // 0x24 + TRADE_LIST, // 0x25 + ENTITY_POSITION, // 0x26 + ENTITY_POSITION_AND_ROTATION, // 0x27 + ENTITY_ROTATION, // 0x28 + VEHICLE_MOVE, // 0x29 + OPEN_BOOK, // 0x2A + OPEN_WINDOW, // 0x2B + OPEN_SIGN_EDITOR, // 0x2C + PING, // 0x2D + CRAFT_RECIPE_RESPONSE, // 0x2E + PLAYER_ABILITIES, // 0x2F + COMBAT_END, // 0x30 + COMBAT_ENTER, // 0x31 + COMBAT_KILL, // 0x32 + PLAYER_INFO, // 0x33 + FACE_PLAYER, // 0x34 + PLAYER_POSITION, // 0x35 + UNLOCK_RECIPES, // 0x36 + REMOVE_ENTITIES, // 0x37 + REMOVE_ENTITY_EFFECT, // 0x38 + RESOURCE_PACK, // 0x39 + RESPAWN, // 0x3A + ENTITY_HEAD_LOOK, // 0x3B + MULTI_BLOCK_CHANGE, // 0x3C + SELECT_ADVANCEMENTS_TAB, // 0x3D + ACTIONBAR, // 0x3E + WORLD_BORDER_CENTER, // 0x3F + WORLD_BORDER_LERP_SIZE, // 0x40 + WORLD_BORDER_SIZE, // 0x41 + WORLD_BORDER_WARNING_DELAY, // 0x42 + WORLD_BORDER_WARNING_DISTANCE, // 0x43 + CAMERA, // 0x44 + HELD_ITEM_CHANGE, // 0x45 + UPDATE_VIEW_POSITION, // 0x46 + UPDATE_VIEW_DISTANCE, // 0x47 + SPAWN_POSITION, // 0x48 + DISPLAY_SCOREBOARD, // 0x49 + ENTITY_METADATA, // 0x4A + ATTACH_ENTITY, // 0x4B + ENTITY_VELOCITY, // 0x4C + ENTITY_EQUIPMENT, // 0x4D + SET_EXPERIENCE, // 0x4E + UPDATE_HEALTH, // 0x4F + SCOREBOARD_OBJECTIVE, // 0x50 + SET_PASSENGERS, // 0x51 + TEAMS, // 0x52 + UPDATE_SCORE, // 0x53 + SET_SIMULATION_DISTANCE, // 0x54 + TITLE_SUBTITLE, // 0x55 + TIME_UPDATE, // 0x56 + TITLE_TEXT, // 0x57 + TITLE_TIMES, // 0x58 + ENTITY_SOUND, // 0x59 + SOUND, // 0x5A + STOP_SOUND, // 0x5B + TAB_LIST, // 0x5C + NBT_QUERY, // 0x5D + COLLECT_ITEM, // 0x5E + ENTITY_TELEPORT, // 0x5F + ADVANCEMENTS, // 0x60 + ENTITY_PROPERTIES, // 0x61 + ENTITY_EFFECT, // 0x62 + DECLARE_RECIPES, // 0x63 + TAGS; // 0x64 @Override public int getId() { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java index 2fc64500c..a1c9f7d5f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/packets/EntityPackets.java @@ -17,9 +17,13 @@ */ package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets; +import com.viaversion.viaversion.api.minecraft.Position; +import com.viaversion.viaversion.api.minecraft.Position3d; import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; +import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.version.Types1_18; @@ -27,8 +31,12 @@ import com.viaversion.viaversion.api.type.types.version.Types1_19; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2; +import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.util.PaintingOffsetUtil; import com.viaversion.viaversion.rewriter.EntityRewriter; +import java.util.ArrayList; +import java.util.List; + public final class EntityPackets extends EntityRewriter { public EntityPackets(final Protocol1_19To1_18_2 protocol) { @@ -66,6 +74,43 @@ public final class EntityPackets extends EntityRewriter { } }); + protocol.registerClientbound(ClientboundPackets1_18.SPAWN_PAINTING, ClientboundPackets1_19.SPAWN_ENTITY, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.VAR_INT); // Entity id + map(Type.UUID); // Entity UUID + create(Type.VAR_INT, Entity1_19Types.PAINTING.getId()); + handler(wrapper -> { + final int motive = wrapper.read(Type.VAR_INT); + final Position blockPosition = wrapper.read(Type.POSITION1_14); + final byte direction = wrapper.read(Type.BYTE); + + final Position3d position = PaintingOffsetUtil.fixOffset(blockPosition, motive, direction); //TODO no worky? teleportation needed...? + wrapper.write(Type.DOUBLE, position.x()); + wrapper.write(Type.DOUBLE, position.y()); + wrapper.write(Type.DOUBLE, position.z()); + wrapper.write(Type.BYTE, (byte) 0); // Pitch + wrapper.write(Type.BYTE, (byte) 0); // Yaw + wrapper.write(Type.BYTE, (byte) 0); // Head yaw + wrapper.write(Type.VAR_INT, to3dId(direction)); // Data + wrapper.write(Type.SHORT, (short) 0); // Velocity x + wrapper.write(Type.SHORT, (short) 0); // Velocity y + wrapper.write(Type.SHORT, (short) 0); // Velocity z + + wrapper.send(Protocol1_19To1_18_2.class); + wrapper.cancel(); + + // Send motive in metadata + final PacketWrapper metaPacket = wrapper.create(ClientboundPackets1_19.ENTITY_METADATA); + metaPacket.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0)); // Entity id + final List metadata = new ArrayList<>(); + metadata.add(new Metadata(8, Types1_19.META_TYPES.paintingVariantType, protocol.getMappingData().getPaintingMappings().getNewId(motive))); + metaPacket.write(Types1_19.METADATA_LIST, metadata); + metaPacket.send(Protocol1_19To1_18_2.class); + }); + } + }); + protocol.registerClientbound(ClientboundPackets1_18.SPAWN_MOB, ClientboundPackets1_19.SPAWN_ENTITY, new PacketRemapper() { @Override public void registerMap() { @@ -128,6 +173,22 @@ public final class EntityPackets extends EntityRewriter { }); } + private static int to3dId(final int id) { + switch (id) { + case -1: // Both up and down + return 1; // Up + case 2: // North + return 2; + case 0: // South + return 3; + case 1: // West + return 4; + case 3: // East + return 5; + } + throw new IllegalArgumentException("Unknown 2d id: " + id); + } + @Override protected void registerRewrites() { filter().handler((event, meta) -> meta.setMetaType(Types1_19.META_TYPES.byId(meta.metaType().typeId()))); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/util/PaintingOffsetUtil.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/util/PaintingOffsetUtil.java new file mode 100644 index 000000000..f9f69ae87 --- /dev/null +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19to1_18_2/util/PaintingOffsetUtil.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ +package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.util; + +import com.viaversion.viaversion.api.minecraft.Position; +import com.viaversion.viaversion.api.minecraft.Position3d; + +public final class PaintingOffsetUtil { + + private static final double MAGIC_OFFSET = -0.46875; + private static final PaintingVariant[] VARIANTS = { + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(16, 16), + new PaintingVariant(32, 16), + new PaintingVariant(32, 16), + new PaintingVariant(32, 16), + new PaintingVariant(32, 16), + new PaintingVariant(32, 16), + new PaintingVariant(16, 32), + new PaintingVariant(16, 32), + new PaintingVariant(32, 32), + new PaintingVariant(32, 32), + new PaintingVariant(32, 32), + new PaintingVariant(32, 32), + new PaintingVariant(32, 32), + new PaintingVariant(32, 32), + new PaintingVariant(64, 32), + new PaintingVariant(64, 64), + new PaintingVariant(64, 64), + new PaintingVariant(64, 64), + new PaintingVariant(64, 48), + new PaintingVariant(64, 48) + }; + + public static Position3d fixOffset(final Position position, final int motive, final int direction) { + final PaintingVariant variant = VARIANTS[motive]; + final double offY = variant.height > 1 && variant.height != 3 ? 0.5 : 0; + final double offX; + final double offZ; + final double widthOffset = variant.width > 1 ? 0.5 : 0; + switch (direction) { + case 0: + offX = widthOffset; + offZ = MAGIC_OFFSET; + break; + case 1: + offX = -MAGIC_OFFSET; + offZ = widthOffset; + break; + case 2: + offX = -widthOffset; + offZ = -MAGIC_OFFSET; + break; + case 3: + offX = MAGIC_OFFSET; + offZ = -widthOffset; + break; + default: + throw new IllegalArgumentException("Invalid direction: " + direction); + } + return new Position3d(position.x() + offX + 0.5d, position.y() + offY + 0.5d, position.z() + offZ + 0.5d); + } + + private static final class PaintingVariant { + private final int width; + private final int height; + + private PaintingVariant(final int width, final int height) { + this.width = width / 16; + this.height = height / 16; + } + } +} diff --git a/common/src/main/resources/assets/viaversion/data/mapping-1.18.json b/common/src/main/resources/assets/viaversion/data/mapping-1.18.json index da3ae74a6..6694af266 100644 --- a/common/src/main/resources/assets/viaversion/data/mapping-1.18.json +++ b/common/src/main/resources/assets/viaversion/data/mapping-1.18.json @@ -23764,5 +23764,33 @@ "minecraft:piercing", "minecraft:mending", "minecraft:vanishing_curse" + ], + "paintings": [ + "minecraft:kebab", + "minecraft:aztec", + "minecraft:alban", + "minecraft:aztec2", + "minecraft:bomb", + "minecraft:plant", + "minecraft:wasteland", + "minecraft:pool", + "minecraft:courbet", + "minecraft:sea", + "minecraft:sunset", + "minecraft:creebet", + "minecraft:wanderer", + "minecraft:graham", + "minecraft:match", + "minecraft:bust", + "minecraft:stage", + "minecraft:void", + "minecraft:skull_and_roses", + "minecraft:wither", + "minecraft:fighters", + "minecraft:pointer", + "minecraft:pigscene", + "minecraft:burning_skull", + "minecraft:skeleton", + "minecraft:donkey_kong" ] } \ No newline at end of file diff --git a/common/src/main/resources/assets/viaversion/data/mapping-1.19.json b/common/src/main/resources/assets/viaversion/data/mapping-1.19.json index e20cbc9fa..a0374060d 100644 --- a/common/src/main/resources/assets/viaversion/data/mapping-1.19.json +++ b/common/src/main/resources/assets/viaversion/data/mapping-1.19.json @@ -22506,27 +22506,27 @@ "118": "minecraft:stripped_jungle_log", "119": "minecraft:stripped_acacia_log", "120": "minecraft:stripped_dark_oak_log", - "121": "minecraft:stripped_crimson_stem", - "122": "minecraft:stripped_warped_stem", - "123": "minecraft:stripped_mangrove_log", + "121": "minecraft:stripped_mangrove_log", + "122": "minecraft:stripped_crimson_stem", + "123": "minecraft:stripped_warped_stem", "124": "minecraft:stripped_oak_wood", "125": "minecraft:stripped_spruce_wood", "126": "minecraft:stripped_birch_wood", "127": "minecraft:stripped_jungle_wood", "128": "minecraft:stripped_acacia_wood", "129": "minecraft:stripped_dark_oak_wood", - "130": "minecraft:stripped_crimson_hyphae", - "131": "minecraft:stripped_warped_hyphae", - "132": "minecraft:stripped_mangrove_wood", + "130": "minecraft:stripped_mangrove_wood", + "131": "minecraft:stripped_crimson_hyphae", + "132": "minecraft:stripped_warped_hyphae", "133": "minecraft:oak_wood", "134": "minecraft:spruce_wood", "135": "minecraft:birch_wood", "136": "minecraft:jungle_wood", "137": "minecraft:acacia_wood", "138": "minecraft:dark_oak_wood", - "139": "minecraft:crimson_hyphae", - "140": "minecraft:warped_hyphae", - "141": "minecraft:mangrove_wood", + "139": "minecraft:mangrove_wood", + "140": "minecraft:crimson_hyphae", + "141": "minecraft:warped_hyphae", "142": "minecraft:oak_leaves", "143": "minecraft:spruce_leaves", "144": "minecraft:birch_leaves", @@ -23456,93 +23456,95 @@ "1068": "minecraft:music_disc_11", "1069": "minecraft:music_disc_wait", "1070": "minecraft:music_disc_otherside", - "1071": "minecraft:music_disc_pigstep", - "1072": "minecraft:trident", - "1073": "minecraft:phantom_membrane", - "1074": "minecraft:nautilus_shell", - "1075": "minecraft:heart_of_the_sea", - "1076": "minecraft:crossbow", - "1077": "minecraft:suspicious_stew", - "1078": "minecraft:loom", - "1079": "minecraft:flower_banner_pattern", - "1080": "minecraft:creeper_banner_pattern", - "1081": "minecraft:skull_banner_pattern", - "1082": "minecraft:mojang_banner_pattern", - "1083": "minecraft:globe_banner_pattern", - "1084": "minecraft:piglin_banner_pattern", - "1085": "minecraft:composter", - "1086": "minecraft:barrel", - "1087": "minecraft:smoker", - "1088": "minecraft:blast_furnace", - "1089": "minecraft:cartography_table", - "1090": "minecraft:fletching_table", - "1091": "minecraft:grindstone", - "1092": "minecraft:smithing_table", - "1093": "minecraft:stonecutter", - "1094": "minecraft:bell", - "1095": "minecraft:lantern", - "1096": "minecraft:soul_lantern", - "1097": "minecraft:sweet_berries", - "1098": "minecraft:glow_berries", - "1099": "minecraft:campfire", - "1100": "minecraft:soul_campfire", - "1101": "minecraft:shroomlight", - "1102": "minecraft:honeycomb", - "1103": "minecraft:bee_nest", - "1104": "minecraft:beehive", - "1105": "minecraft:honey_bottle", - "1106": "minecraft:honeycomb_block", - "1107": "minecraft:lodestone", - "1108": "minecraft:crying_obsidian", - "1109": "minecraft:blackstone", - "1110": "minecraft:blackstone_slab", - "1111": "minecraft:blackstone_stairs", - "1112": "minecraft:gilded_blackstone", - "1113": "minecraft:polished_blackstone", - "1114": "minecraft:polished_blackstone_slab", - "1115": "minecraft:polished_blackstone_stairs", - "1116": "minecraft:chiseled_polished_blackstone", - "1117": "minecraft:polished_blackstone_bricks", - "1118": "minecraft:polished_blackstone_brick_slab", - "1119": "minecraft:polished_blackstone_brick_stairs", - "1120": "minecraft:cracked_polished_blackstone_bricks", - "1121": "minecraft:respawn_anchor", - "1122": "minecraft:candle", - "1123": "minecraft:white_candle", - "1124": "minecraft:orange_candle", - "1125": "minecraft:magenta_candle", - "1126": "minecraft:light_blue_candle", - "1127": "minecraft:yellow_candle", - "1128": "minecraft:lime_candle", - "1129": "minecraft:pink_candle", - "1130": "minecraft:gray_candle", - "1131": "minecraft:light_gray_candle", - "1132": "minecraft:cyan_candle", - "1133": "minecraft:purple_candle", - "1134": "minecraft:blue_candle", - "1135": "minecraft:brown_candle", - "1136": "minecraft:green_candle", - "1137": "minecraft:red_candle", - "1138": "minecraft:black_candle", - "1139": "minecraft:small_amethyst_bud", - "1140": "minecraft:medium_amethyst_bud", - "1141": "minecraft:large_amethyst_bud", - "1142": "minecraft:amethyst_cluster", - "1143": "minecraft:pointed_dripstone", - "1144": "minecraft:ochre_froglight", - "1145": "minecraft:verdant_froglight", - "1146": "minecraft:pearlescent_froglight", - "1147": "minecraft:frogspawn", - "1148": "minecraft:echo_shard" + "1071": "minecraft:music_disc_5", + "1072": "minecraft:music_disc_pigstep", + "1073": "minecraft:disc_fragment_5", + "1074": "minecraft:trident", + "1075": "minecraft:phantom_membrane", + "1076": "minecraft:nautilus_shell", + "1077": "minecraft:heart_of_the_sea", + "1078": "minecraft:crossbow", + "1079": "minecraft:suspicious_stew", + "1080": "minecraft:loom", + "1081": "minecraft:flower_banner_pattern", + "1082": "minecraft:creeper_banner_pattern", + "1083": "minecraft:skull_banner_pattern", + "1084": "minecraft:mojang_banner_pattern", + "1085": "minecraft:globe_banner_pattern", + "1086": "minecraft:piglin_banner_pattern", + "1087": "minecraft:composter", + "1088": "minecraft:barrel", + "1089": "minecraft:smoker", + "1090": "minecraft:blast_furnace", + "1091": "minecraft:cartography_table", + "1092": "minecraft:fletching_table", + "1093": "minecraft:grindstone", + "1094": "minecraft:smithing_table", + "1095": "minecraft:stonecutter", + "1096": "minecraft:bell", + "1097": "minecraft:lantern", + "1098": "minecraft:soul_lantern", + "1099": "minecraft:sweet_berries", + "1100": "minecraft:glow_berries", + "1101": "minecraft:campfire", + "1102": "minecraft:soul_campfire", + "1103": "minecraft:shroomlight", + "1104": "minecraft:honeycomb", + "1105": "minecraft:bee_nest", + "1106": "minecraft:beehive", + "1107": "minecraft:honey_bottle", + "1108": "minecraft:honeycomb_block", + "1109": "minecraft:lodestone", + "1110": "minecraft:crying_obsidian", + "1111": "minecraft:blackstone", + "1112": "minecraft:blackstone_slab", + "1113": "minecraft:blackstone_stairs", + "1114": "minecraft:gilded_blackstone", + "1115": "minecraft:polished_blackstone", + "1116": "minecraft:polished_blackstone_slab", + "1117": "minecraft:polished_blackstone_stairs", + "1118": "minecraft:chiseled_polished_blackstone", + "1119": "minecraft:polished_blackstone_bricks", + "1120": "minecraft:polished_blackstone_brick_slab", + "1121": "minecraft:polished_blackstone_brick_stairs", + "1122": "minecraft:cracked_polished_blackstone_bricks", + "1123": "minecraft:respawn_anchor", + "1124": "minecraft:candle", + "1125": "minecraft:white_candle", + "1126": "minecraft:orange_candle", + "1127": "minecraft:magenta_candle", + "1128": "minecraft:light_blue_candle", + "1129": "minecraft:yellow_candle", + "1130": "minecraft:lime_candle", + "1131": "minecraft:pink_candle", + "1132": "minecraft:gray_candle", + "1133": "minecraft:light_gray_candle", + "1134": "minecraft:cyan_candle", + "1135": "minecraft:purple_candle", + "1136": "minecraft:blue_candle", + "1137": "minecraft:brown_candle", + "1138": "minecraft:green_candle", + "1139": "minecraft:red_candle", + "1140": "minecraft:black_candle", + "1141": "minecraft:small_amethyst_bud", + "1142": "minecraft:medium_amethyst_bud", + "1143": "minecraft:large_amethyst_bud", + "1144": "minecraft:amethyst_cluster", + "1145": "minecraft:pointed_dripstone", + "1146": "minecraft:ochre_froglight", + "1147": "minecraft:verdant_froglight", + "1148": "minecraft:pearlescent_froglight", + "1149": "minecraft:frogspawn", + "1150": "minecraft:echo_shard" }, "sounds": [ "entity.allay.ambient_with_item", "entity.allay.ambient_without_item", "entity.allay.death", - "entity.allay.flap", "entity.allay.hurt", "entity.allay.item_given", "entity.allay.item_taken", + "entity.allay.item_thrown", "ambient.cave", "ambient.basalt_deltas.additions", "ambient.basalt_deltas.loop", @@ -24204,6 +24206,7 @@ "entity.mule.hurt", "music.creative", "music.credits", + "music_disc.5", "music_disc.11", "music_disc.13", "music_disc.blocks", @@ -24229,6 +24232,9 @@ "music.overworld.grove", "music.overworld.jagged_peaks", "music.overworld.lush_caves", + "music.overworld.swamp", + "music.overworld.jungle_and_forest", + "music.overworld.old_growth_taiga", "music.overworld.meadow", "music.nether.nether_wastes", "music.overworld.frozen_peaks", @@ -24650,11 +24656,9 @@ "block.sweet_berry_bush.place", "block.sweet_berry_bush.pick_berries", "entity.tadpole.death", - "entity.tadpole.eat", "entity.tadpole.flop", "entity.tadpole.grow_up", "entity.tadpole.hurt", - "entity.tadpole.step", "enchant.thorns.hit", "entity.tnt.primed", "item.totem.use", @@ -24938,8 +24942,7 @@ "wax_off", "electric_spark", "scrape", - "shriek", - "allay_dust" + "shriek" ], "blockentities": [ "furnace", @@ -25067,5 +25070,37 @@ "minecraft:piercing", "minecraft:mending", "minecraft:vanishing_curse" + ], + "paintings": [ + "minecraft:kebab", + "minecraft:aztec", + "minecraft:alban", + "minecraft:aztec2", + "minecraft:bomb", + "minecraft:plant", + "minecraft:wasteland", + "minecraft:pool", + "minecraft:courbet", + "minecraft:sea", + "minecraft:sunset", + "minecraft:creebet", + "minecraft:wanderer", + "minecraft:graham", + "minecraft:match", + "minecraft:bust", + "minecraft:stage", + "minecraft:void", + "minecraft:skull_and_roses", + "minecraft:wither", + "minecraft:fighters", + "minecraft:pointer", + "minecraft:pigscene", + "minecraft:burning_skull", + "minecraft:skeleton", + "minecraft:earth", + "minecraft:wind", + "minecraft:water", + "minecraft:fire", + "minecraft:donkey_kong" ] } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 97f8f4ba0..6661158fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Project properties - we put these here so they can be modified without causing a recompile of the build scripts -projectVersion=4.3.0-22w15a-SNAPSHOT +projectVersion=4.3.0-22w16a-SNAPSHOT # Gradle properties org.gradle.daemon=true