From d209e9b768a13f5616e5852008688b427bacae3a Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 22 Jul 2020 21:52:48 +0200 Subject: [PATCH] 20w30a, bump version to match VV's --- all/pom.xml | 2 +- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- core/pom.xml | 2 +- .../data/BackwardsBiomeMappings.java | 36 ------------------- .../packets/BlockItemPackets1_16_2.java | 9 ----- .../packets/EntityPackets1_16_2.java | 14 +++++++- .../data/mapping-1.16to1.16.2.json | 22 ++++++++---- fabric/pom.xml | 2 +- pom.xml | 4 +-- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 12 files changed, 37 insertions(+), 62 deletions(-) delete mode 100644 core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/data/BackwardsBiomeMappings.java diff --git a/all/pom.xml b/all/pom.xml index 1c30cf03..df974341 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-all diff --git a/bukkit/pom.xml b/bukkit/pom.xml index efb493a7..f0a141fb 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-bukkit diff --git a/bungee/pom.xml b/bungee/pom.xml index 580c41b6..c5114996 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-bungee diff --git a/core/pom.xml b/core/pom.xml index 64cda064..2369edc6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-core diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/data/BackwardsBiomeMappings.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/data/BackwardsBiomeMappings.java deleted file mode 100644 index df6b2eba..00000000 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/data/BackwardsBiomeMappings.java +++ /dev/null @@ -1,36 +0,0 @@ -package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data; -import nl.matsv.viabackwards.ViaBackwards; -import us.myles.ViaVersion.api.Via; -import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.BiomeMappings; -import us.myles.viaversion.libs.fastutil.ints.Int2IntMap; -import us.myles.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; - -public class BackwardsBiomeMappings { - - private static final Int2IntMap BIOMES = new Int2IntOpenHashMap(); - private static final int HIGHEST_VANILLA_BIOME; - - static { - int lastBiome = 0; - for (Int2IntMap.Entry entry : BiomeMappings.getBiomes().int2IntEntrySet()) { - int newBiome = entry.getIntValue(); - BIOMES.put(newBiome, entry.getIntKey()); - if (newBiome > lastBiome) { - lastBiome = newBiome; - } - } - - HIGHEST_VANILLA_BIOME = lastBiome; - } - - public static int getOldBiomeId(int biomeId) { - if (biomeId > HIGHEST_VANILLA_BIOME) { - if (!Via.getConfig().isSuppressConversionWarnings()) { - ViaBackwards.getPlatform().getLogger().warning("Custom biome id could not be mapped: " + biomeId); - } - return 0; - } - - return BIOMES.getOrDefault(biomeId, biomeId); - } -} diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java index 2d6e786a..e7b3c96e 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/BlockItemPackets1_16_2.java @@ -3,7 +3,6 @@ package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.packets; import nl.matsv.viabackwards.ViaBackwards; import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter; import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2; -import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsBiomeMappings; import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsMappings; import us.myles.ViaVersion.api.minecraft.BlockChangeRecord; import us.myles.ViaVersion.api.minecraft.BlockChangeRecord1_8; @@ -72,14 +71,6 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters. Chunk chunk = wrapper.read(new Chunk1_16_2Type(clientWorld)); wrapper.write(new Chunk1_16Type(clientWorld), chunk); - if (chunk.isBiomeData()) { - int[] biomes = chunk.getBiomeData(); - for (int i = 0; i < biomes.length; i++) { - int biome = biomes[i]; - biomes[i] = BackwardsBiomeMappings.getOldBiomeId(biome); - } - } - for (int i = 0; i < chunk.getSections().length; i++) { ChunkSection section = chunk.getSections()[i]; if (section == null) continue; diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java index f1bc8c56..028ab722 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_16_1to1_16_2/packets/EntityPackets1_16_2.java @@ -16,6 +16,9 @@ import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_ import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.EntityPackets; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.viaversion.libs.gson.JsonElement; +import us.myles.viaversion.libs.opennbt.NBTIO; + +import java.io.File; public class EntityPackets1_16_2 extends EntityRewriter { @@ -49,7 +52,7 @@ public class EntityPackets1_16_2 extends EntityRewriter map(Type.STRING_ARRAY); // World List handler(wrapper -> { // Just screw the registry and write the defaults for 1.16 and 1.16.1 clients - wrapper.read(Type.NBT); + NBTIO.writeFile(wrapper.read(Type.NBT), new File("oo.jbt")); wrapper.write(Type.NBT, EntityPackets.DIMENSIONS_TAG); }); map(Type.STRING); // Dimension Type @@ -90,6 +93,15 @@ public class EntityPackets1_16_2 extends EntityRewriter mapTypes(Entity1_16_2Types.EntityType.values(), Entity1_16Types.EntityType.class); mapEntity(Entity1_16_2Types.EntityType.PIGLIN_BRUTE, Entity1_16_2Types.EntityType.PIGLIN).jsonName("Piglin Brute"); + + registerMetaHandler().filter(Entity1_16_2Types.EntityType.ABSTRACT_PIGLIN).handle(meta -> { + if (meta.getIndex() == 15) { + meta.getData().setId(16); + } else if (meta.getIndex() == 16) { + meta.getData().setId(15); + } + return meta.getData(); + }); } @Override diff --git a/core/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json b/core/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json index 25b3ea2f..a4fe55e8 100644 --- a/core/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json +++ b/core/src/main/resources/assets/viabackwards/data/mapping-1.16to1.16.2.json @@ -1,5 +1,13 @@ { "blockstates": { + "minecraft:lantern[hanging=true,waterlogged=true]": "minecraft:lantern[hanging=true]", + "minecraft:lantern[hanging=true,waterlogged=false]": "minecraft:lantern[hanging=true]", + "minecraft:lantern[hanging=false,waterlogged=true]": "minecraft:lantern[hanging=false]", + "minecraft:lantern[hanging=false,waterlogged=false]": "minecraft:lantern[hanging=false]", + "minecraft:soul_lantern[hanging=true,waterlogged=true]": "minecraft:soul_lantern[hanging=true]", + "minecraft:soul_lantern[hanging=true,waterlogged=false]": "minecraft:soul_lantern[hanging=true]", + "minecraft:soul_lantern[hanging=false,waterlogged=true]": "minecraft:soul_lantern[hanging=false]", + "minecraft:soul_lantern[hanging=false,waterlogged=false]": "minecraft:soul_lantern[hanging=false]" }, "items": { "minecraft:piglin_brute_spawn_egg": { @@ -8,12 +16,12 @@ } }, "sounds": { - "entity.parrot.imitate.piglin_brute" : "entity.parrot.imitate.piglin", - "entity.piglin_brute.ambient" : "entity.piglin.ambient", - "entity.piglin_brute.angry" : "entity.piglin.angry", - "entity.piglin_brute.death" : "entity.piglin.death", - "entity.piglin_brute.hurt" : "entity.piglin.hurt", - "entity.piglin_brute.step" : "entity.piglin.step", - "entity.piglin_brute.converted_to_zombified" : "entity.piglin.converted_to_zombified" + "entity.parrot.imitate.piglin_brute": "entity.parrot.imitate.piglin", + "entity.piglin_brute.ambient": "entity.piglin.ambient", + "entity.piglin_brute.angry": "entity.piglin.angry", + "entity.piglin_brute.death": "entity.piglin.death", + "entity.piglin_brute.hurt": "entity.piglin.hurt", + "entity.piglin_brute.step": "entity.piglin.step", + "entity.piglin_brute.converted_to_zombified": "entity.piglin.converted_to_zombified" } } \ No newline at end of file diff --git a/fabric/pom.xml b/fabric/pom.xml index 67225f86..66922513 100644 --- a/fabric/pom.xml +++ b/fabric/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-fabric diff --git a/pom.xml b/pom.xml index f45ca8a7..893f231f 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ nl.matsv viabackwards-parent - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT pom Allow older clients to join newer server versions. @@ -65,7 +65,7 @@ us.myles viaversion - 3.0.2-20w28a + 3.1.0-20w30a provided diff --git a/sponge/pom.xml b/sponge/pom.xml index 1110c88d..3c8f0766 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-sponge diff --git a/velocity/pom.xml b/velocity/pom.xml index db83d496..9950c06e 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -16,7 +16,7 @@ viabackwards-parent nl.matsv - 3.0.2-SNAPSHOT + 3.1.0-SNAPSHOT viabackwards-velocity