diff --git a/api/build.gradle.kts b/api/build.gradle.kts index f228bf4872..22e56826a6 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -50,6 +50,8 @@ mappingCompression { compress("enchantment/enchantment_type_data.json") compress("stats/statistics.json") + + compress("world/biome_data.json") } with { diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatType.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatType.java index f27864b1c6..4ac4512b10 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatType.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatType.java @@ -49,9 +49,9 @@ static void writeDirect(PacketWrapper wrapper, ChatType chatType) { static ChatType decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { NBTCompound compound = (NBTCompound) nbt; NBTCompound chatTag = compound.getCompoundTagOrThrow("chat"); - ChatTypeDecoration chatDeco = ChatTypeDecoration.decode(chatTag, version, data); + ChatTypeDecoration chatDeco = ChatTypeDecoration.decode(chatTag, version); NBTCompound narrationTag = compound.getCompoundTagOrThrow("narration"); - ChatTypeDecoration narrationDeco = ChatTypeDecoration.decode(narrationTag, version, data); + ChatTypeDecoration narrationDeco = ChatTypeDecoration.decode(narrationTag, version); return new StaticChatType(data, chatDeco, narrationDeco); } diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatTypeDecoration.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatTypeDecoration.java index 5c86ff53b3..e8785ae84a 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatTypeDecoration.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/chat/ChatTypeDecoration.java @@ -24,17 +24,16 @@ import com.github.retrooper.packetevents.protocol.nbt.NBTString; import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.util.adventure.AdventureSerializer; -import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.util.Index; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Locale; import java.util.function.BiFunction; import static com.github.retrooper.packetevents.protocol.chat.ChatTypeDecoration.Parameter.CONTENT; @@ -71,18 +70,13 @@ public static void write(PacketWrapper wrapper, ChatTypeDecoration decoration wrapper.writeStyle(decoration.style); } - public static ChatTypeDecoration decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { + public static ChatTypeDecoration decode(NBT nbt, ClientVersion version) { NBTCompound compound = (NBTCompound) nbt; String translationKey = compound.getStringTagValueOrThrow("translation_key"); List params = new ArrayList<>(); - NBTList paramsTag = compound.getStringListTagOrNull("parameters"); - if (paramsTag != null) { - for (NBTString paramTag : paramsTag.getTags()) { - Parameter parameter = Parameter.valueByName(paramTag.getValue().toUpperCase()); - if (parameter != null) { - params.add(parameter); - } - } + NBTList paramsTag = compound.getStringListTagOrThrow("parameters"); + for (NBTString paramTag : paramsTag.getTags()) { + params.add(Parameter.ID_INDEX.valueOrThrow(paramTag.getValue())); } NBTCompound styleTag = compound.getCompoundTagOrNull("style"); Style style = styleTag == null ? empty() : @@ -93,7 +87,7 @@ public static ChatTypeDecoration decode(NBT nbt, ClientVersion version, @Nullabl public static NBT encode(ChatTypeDecoration decoration, ClientVersion version) { NBTList paramsTag = NBTList.createStringList(); for (Parameter param : decoration.parameters) { - paramsTag.addTag(new NBTString(param.name().toLowerCase(Locale.ROOT))); + paramsTag.addTag(new NBTString(param.getId())); } NBTCompound compound = new NBTCompound(); @@ -146,23 +140,30 @@ public Style getStyle() { } public enum Parameter { - SENDER((component, type) -> type.getName()), - TARGET((component, type) -> type.getTargetName() != null ? type.getTargetName() : Component.empty()), - CONTENT((component, type) -> component); + SENDER("sender", (component, type) -> type.getName()), + TARGET("target", (component, type) -> type.getTargetName() != null + ? type.getTargetName() : Component.empty()), + CONTENT("content", (component, type) -> component); + + public static final Index ID_INDEX = Index.create( + Parameter.class, Parameter::getId); + + private final String id; private final BiFunction selector; - Parameter(BiFunction selector) { + Parameter(String id, BiFunction selector) { + this.id = id; this.selector = selector; } - @Nullable - public static Parameter valueByName(String name) { - try { - return valueOf(name); - } catch (IllegalArgumentException ex) { - return null; - } + public String getId() { + return this.id; + } + + @Deprecated + public static @Nullable Parameter valueByName(String id) { + return ID_INDEX.value(id); } } } diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/component/ComponentType.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/component/ComponentType.java index a823893c09..2649286291 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/component/ComponentType.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/component/ComponentType.java @@ -29,13 +29,9 @@ public interface ComponentType extends MappedEntity { void write(PacketWrapper wrapper, T content); - default T decode(NBT nbt, ClientVersion version) { - throw new UnsupportedOperationException(); - } + T decode(NBT nbt, ClientVersion version); - default NBT encode(T value, ClientVersion version) { - throw new UnsupportedOperationException(); - } + NBT encode(T value, ClientVersion version); interface Decoder { diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/StaticWolfVariant.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/StaticWolfVariant.java new file mode 100644 index 0000000000..8f0dba80df --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/StaticWolfVariant.java @@ -0,0 +1,82 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.entity.wolfvariant; + +import com.github.retrooper.packetevents.protocol.mapper.AbstractMappedEntity; +import com.github.retrooper.packetevents.protocol.mapper.MappedEntitySet; +import com.github.retrooper.packetevents.protocol.world.biome.Biome; +import com.github.retrooper.packetevents.resources.ResourceLocation; +import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; +import org.jetbrains.annotations.Nullable; + +public class StaticWolfVariant extends AbstractMappedEntity implements WolfVariant { + + private final ResourceLocation wildTexture; + private final ResourceLocation tameTexture; + private final ResourceLocation angryTexture; + private final MappedEntitySet biomes; + + public StaticWolfVariant( + ResourceLocation wildTexture, + ResourceLocation tameTexture, + ResourceLocation angryTexture, + MappedEntitySet biomes + ) { + this(null, wildTexture, tameTexture, angryTexture, biomes); + } + + public StaticWolfVariant( + @Nullable TypesBuilderData data, + ResourceLocation wildTexture, + ResourceLocation tameTexture, + ResourceLocation angryTexture, + MappedEntitySet biomes + ) { + super(data); + this.wildTexture = wildTexture; + this.tameTexture = tameTexture; + this.angryTexture = angryTexture; + this.biomes = biomes; + } + + @Override + public WolfVariant copy(@Nullable TypesBuilderData newData) { + return new StaticWolfVariant(newData, this.wildTexture, this.tameTexture, this.angryTexture, this.biomes); + } + + @Override + public ResourceLocation getWildTexture() { + return this.wildTexture; + } + + @Override + public ResourceLocation getTameTexture() { + return this.tameTexture; + } + + @Override + public ResourceLocation getAngryTexture() { + return this.angryTexture; + } + + @Override + public MappedEntitySet getBiomes() { + return this.biomes; + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariant.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariant.java index 26e3387745..2d1690201e 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariant.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariant.java @@ -1,14 +1,62 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.github.retrooper.packetevents.protocol.entity.wolfvariant; +import com.github.retrooper.packetevents.protocol.mapper.CopyableEntity; +import com.github.retrooper.packetevents.protocol.mapper.MappedEntity; +import com.github.retrooper.packetevents.protocol.mapper.MappedEntitySet; +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; +import com.github.retrooper.packetevents.protocol.nbt.NBTString; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; +import com.github.retrooper.packetevents.protocol.world.biome.Biome; +import com.github.retrooper.packetevents.protocol.world.biome.Biomes; import com.github.retrooper.packetevents.resources.ResourceLocation; +import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; +import org.jetbrains.annotations.Nullable; + +public interface WolfVariant extends MappedEntity, CopyableEntity { + + ResourceLocation getWildTexture(); -import java.util.Set; + ResourceLocation getTameTexture(); -//TODO Finish Wolf-Variant class -public class WolfVariant { - private ResourceLocation wildId, tameId, angryId; + ResourceLocation getAngryTexture(); - public WolfVariant(ResourceLocation wildId, ResourceLocation tameId, ResourceLocation angryId) { + MappedEntitySet getBiomes(); + + static WolfVariant decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { + NBTCompound compound = (NBTCompound) nbt; + ResourceLocation wildTexture = new ResourceLocation(compound.getStringTagValueOrThrow("wild_texture")); + ResourceLocation tameTexture = new ResourceLocation(compound.getStringTagValueOrThrow("tame_texture")); + ResourceLocation angryTexture = new ResourceLocation(compound.getStringTagValueOrThrow("angry_texture")); + MappedEntitySet biomes = MappedEntitySet.decode( + compound.getTagOrThrow("biomes"), version, Biomes.getRegistry()); + return new StaticWolfVariant(data, wildTexture, tameTexture, angryTexture, biomes); + } + static NBT encode(WolfVariant variant, ClientVersion version) { + NBTCompound compound = new NBTCompound(); + compound.setTag("wild_texture", new NBTString(variant.getWildTexture().toString())); + compound.setTag("tame_texture", new NBTString(variant.getTameTexture().toString())); + compound.setTag("angry_texture", new NBTString(variant.getAngryTexture().toString())); + compound.setTag("biomes", MappedEntitySet.encode(variant.getBiomes(), version)); + return compound; } } diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariants.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariants.java new file mode 100644 index 0000000000..875898eafa --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/entity/wolfvariant/WolfVariants.java @@ -0,0 +1,88 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.entity.wolfvariant; + +import com.github.retrooper.packetevents.protocol.mapper.MappedEntitySet; +import com.github.retrooper.packetevents.protocol.world.biome.Biome; +import com.github.retrooper.packetevents.protocol.world.biome.Biomes; +import com.github.retrooper.packetevents.resources.ResourceLocation; +import com.github.retrooper.packetevents.util.mappings.VersionedRegistry; +import org.jetbrains.annotations.ApiStatus; + +import java.util.Arrays; + +public final class WolfVariants { + + private static final VersionedRegistry REGISTRY = new VersionedRegistry<>( + "wolf_variant", "entity/wolf_variant_mappings"); + + private WolfVariants() { + } + + @ApiStatus.Internal + public static WolfVariant define(String key, MappedEntitySet biomes) { + return define(key, "wolf_" + key, biomes); + } + + @ApiStatus.Internal + public static WolfVariant define(String key, String assetId, MappedEntitySet biomes) { + return define(key, ResourceLocation.minecraft("entity/wolf/" + assetId), + ResourceLocation.minecraft("entity/wolf/" + assetId + "_tame"), + ResourceLocation.minecraft("entity/wolf/" + assetId + "_angry"), biomes); + } + + @ApiStatus.Internal + public static WolfVariant define( + String key, + ResourceLocation wildTexture, + ResourceLocation tameTexture, + ResourceLocation angryTexture, + MappedEntitySet biomes + ) { + return REGISTRY.define(key, data -> new StaticWolfVariant( + data, wildTexture, tameTexture, angryTexture, biomes)); + } + + public static VersionedRegistry getRegistry() { + return REGISTRY; + } + + public static final WolfVariant PALE = define("pale", "wolf", + new MappedEntitySet<>(Arrays.asList(Biomes.TAIGA))); + public static final WolfVariant SPOTTED = define("spotted", + new MappedEntitySet<>(ResourceLocation.minecraft("is_savanna"))); + public static final WolfVariant SNOWY = define("snowy", + new MappedEntitySet<>(Arrays.asList(Biomes.GROVE))); + public static final WolfVariant BLACK = define("black", + new MappedEntitySet<>(Arrays.asList(Biomes.OLD_GROWTH_PINE_TAIGA))); + public static final WolfVariant ASHEN = define("ashen", + new MappedEntitySet<>(Arrays.asList(Biomes.SNOWY_TAIGA))); + public static final WolfVariant RUSTY = define("rusty", + new MappedEntitySet<>(ResourceLocation.minecraft("is_jungle"))); + public static final WolfVariant WOODS = define("woods", + new MappedEntitySet<>(Arrays.asList(Biomes.FOREST))); + public static final WolfVariant CHESTNUT = define("chestnut", + new MappedEntitySet<>(Arrays.asList(Biomes.OLD_GROWTH_SPRUCE_TAIGA))); + public static final WolfVariant STRIPED = define("striped", + new MappedEntitySet<>(ResourceLocation.minecraft("is_badlands"))); + + static { + REGISTRY.unloadMappings(); + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentCost.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentCost.java index 912f7a7b08..375533ef80 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentCost.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentCost.java @@ -22,8 +22,6 @@ import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; import com.github.retrooper.packetevents.protocol.nbt.NBTInt; import com.github.retrooper.packetevents.protocol.player.ClientVersion; -import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; -import org.jetbrains.annotations.Nullable; import java.util.Objects; @@ -37,7 +35,7 @@ public EnchantmentCost(int base, int perLevelAboveFirst) { this.perLevelAboveFirst = perLevelAboveFirst; } - public static EnchantmentCost decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { + public static EnchantmentCost decode(NBT nbt, ClientVersion version) { NBTCompound compound = (NBTCompound) nbt; int base = compound.getNumberTagOrThrow("base").getAsInt(); int perLevelAboveFirst = compound.getNumberTagOrThrow("per_level_above_first").getAsInt(); diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentDefinition.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentDefinition.java index 3214253255..f589ae259a 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentDefinition.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/EnchantmentDefinition.java @@ -28,8 +28,6 @@ import com.github.retrooper.packetevents.protocol.nbt.NBTList; import com.github.retrooper.packetevents.protocol.nbt.NBTString; import com.github.retrooper.packetevents.protocol.player.ClientVersion; -import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; @@ -64,7 +62,7 @@ public EnchantmentDefinition( this.slots = slots; } - public static EnchantmentDefinition decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { + public static EnchantmentDefinition decode(NBT nbt, ClientVersion version) { NBTCompound compound = (NBTCompound) nbt; MappedEntitySet supportedItems = MappedEntitySet.decode( compound.getTagOrThrow("supported_items"), version, ItemTypes.getRegistry()); @@ -72,8 +70,8 @@ public static EnchantmentDefinition decode(NBT nbt, ClientVersion version, @Null .map(items -> MappedEntitySet.decode(items, version, ItemTypes.getRegistry())); int weight = compound.getNumberTagOrThrow("weight").getAsInt(); int maxLevel = compound.getNumberTagOrThrow("max_level").getAsInt(); - EnchantmentCost minCost = EnchantmentCost.decode(compound.getTagOrThrow("min_cost"), version, data); - EnchantmentCost maxCost = EnchantmentCost.decode(compound.getTagOrThrow("max_cost"), version, data); + EnchantmentCost minCost = EnchantmentCost.decode(compound.getTagOrThrow("min_cost"), version); + EnchantmentCost maxCost = EnchantmentCost.decode(compound.getTagOrThrow("max_cost"), version); int anvilCost = compound.getNumberTagOrThrow("anvil_cost").getAsInt(); NBTList slotsTag = compound.getStringListTagOrThrow("slots"); List slots = new ArrayList<>(slotsTag.size()); diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/type/EnchantmentType.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/type/EnchantmentType.java index c26e564faa..20bd78d2fa 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/type/EnchantmentType.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/item/enchantment/type/EnchantmentType.java @@ -48,7 +48,7 @@ public interface EnchantmentType extends MappedEntity, CopyableEntity exclusiveSet = Optional.ofNullable(compound.getTagOrNull("exclusive_set")) .map(tag -> MappedEntitySet.decode(tag, version, EnchantmentTypes.getRegistry())) // TODO use user registry .orElseGet(MappedEntitySet::createEmpty); diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/Particle.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/Particle.java index 6c2eb5a9ba..11b381757d 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/Particle.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/Particle.java @@ -18,9 +18,13 @@ package com.github.retrooper.packetevents.protocol.particle; +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; +import com.github.retrooper.packetevents.protocol.nbt.NBTString; import com.github.retrooper.packetevents.protocol.particle.data.ParticleData; import com.github.retrooper.packetevents.protocol.particle.type.ParticleType; import com.github.retrooper.packetevents.protocol.particle.type.ParticleTypes; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.PacketWrapper; public class Particle { @@ -48,6 +52,20 @@ public static void write(PacketWrapper wrapper, Part particle.getType().writeData(wrapper, particle.data); } + @SuppressWarnings("unchecked") + public static Particle decode(NBT nbt, ClientVersion version) { + NBTCompound compound = (NBTCompound) nbt; + ParticleType type = ParticleTypes.getByName(compound.getStringTagValueOrThrow("type")); + ParticleData data = type.decodeData(nbt, version); + return new Particle<>((ParticleType) type, data); + } + + public static NBT encode(Particle particle, ClientVersion version) { + NBTCompound compound = (NBTCompound) particle.type.encodeData(particle.getData(), version); + compound.setTag("type", new NBTString(particle.type.getName().toString())); + return compound; + } + public ParticleType getType() { return this.type; } diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/type/ParticleType.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/type/ParticleType.java index 2ef55e944e..4729a92a72 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/type/ParticleType.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/particle/type/ParticleType.java @@ -19,7 +19,9 @@ package com.github.retrooper.packetevents.protocol.particle.type; import com.github.retrooper.packetevents.protocol.mapper.MappedEntity; +import com.github.retrooper.packetevents.protocol.nbt.NBT; import com.github.retrooper.packetevents.protocol.particle.data.ParticleData; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import java.util.function.BiConsumer; @@ -31,6 +33,10 @@ public interface ParticleType extends MappedEntity { void writeData(PacketWrapper wrapper, T data); + T decodeData(NBT nbt, ClientVersion version); + + NBT encodeData(T data, ClientVersion version); + @Deprecated default Function, ParticleData> readDataFunction() { return this::readData; diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/sound/Sound.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/sound/Sound.java index 90e34c5d9f..7d8c05f281 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/sound/Sound.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/sound/Sound.java @@ -19,6 +19,9 @@ package com.github.retrooper.packetevents.protocol.sound; import com.github.retrooper.packetevents.protocol.mapper.MappedEntity; +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTString; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.resources.ResourceLocation; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import org.jetbrains.annotations.Nullable; @@ -48,4 +51,18 @@ static void writeDirect(PacketWrapper wrapper, Sound sound) { wrapper.writeIdentifier(sound.getSoundId()); wrapper.writeOptional(sound.getRange(), PacketWrapper::writeFloat); } + + static Sound decode(NBT nbt, ClientVersion version) { + if (nbt instanceof NBTString) { + return Sounds.getByName(((NBTString) nbt).getValue()); + } + // FIXME + } + + static NBT encode(Sound sound, ClientVersion version) { + if (sound.isRegistered()) { + return new NBTString(sound.getName().toString()); + } + // FIXME + } } diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biome.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biome.java new file mode 100644 index 0000000000..30686f173f --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biome.java @@ -0,0 +1,90 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.world.biome; + +import com.github.retrooper.packetevents.protocol.mapper.CopyableEntity; +import com.github.retrooper.packetevents.protocol.mapper.MappedEntity; +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTByte; +import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; +import com.github.retrooper.packetevents.protocol.nbt.NBTFloat; +import com.github.retrooper.packetevents.protocol.nbt.NBTString; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; +import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; +import net.kyori.adventure.util.Index; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public interface Biome extends MappedEntity, CopyableEntity { + + boolean hasPrecipitation(); + + float getTemperature(); + + TemperatureModifier getTemperatureModifier(); + + float getDownfall(); + + BiomeEffects getEffects(); + + static Biome decode(NBT nbt, ClientVersion version, @Nullable TypesBuilderData data) { + NBTCompound compound = (NBTCompound) nbt; + boolean precipitation = compound.getBoolean("has_precipitation"); + float temperature = compound.getNumberTagOrThrow("temperature").getAsFloat(); + TemperatureModifier temperatureModifier = + Optional.ofNullable(compound.getStringTagValueOrNull("temperature_modifier")) + .map(TemperatureModifier.ID_INDEX::valueOrThrow) + .orElse(TemperatureModifier.NONE); + float downfall = compound.getNumberTagOrThrow("downfall").getAsFloat(); + BiomeEffects effects = BiomeEffects.decode(compound.getTagOrThrow("effects"), version); + return new StaticBiome(data, precipitation, temperature, temperatureModifier, downfall, effects); + } + + static NBT encode(Biome biome, ClientVersion version) { + NBTCompound compound = new NBTCompound(); + compound.setTag("has_precipitation", new NBTByte(biome.hasPrecipitation())); + compound.setTag("temperature", new NBTFloat(biome.getTemperature())); + if (biome.getTemperatureModifier() != TemperatureModifier.NONE) { + compound.setTag("temperature_modifier", new NBTString(biome.getTemperatureModifier().getId())); + } + compound.setTag("downfall", new NBTFloat(biome.getDownfall())); + compound.setTag("effects", BiomeEffects.encode(biome.getEffects(), version)); + return compound; + } + + enum TemperatureModifier { + + NONE("none"), + FROZEN("frozen"); + + public static final Index ID_INDEX = Index.create( + TemperatureModifier.class, TemperatureModifier::getId); + + private final String id; + + TemperatureModifier(String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/BiomeEffects.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/BiomeEffects.java new file mode 100644 index 0000000000..ea602e0f4a --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/BiomeEffects.java @@ -0,0 +1,214 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.world.biome; + +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; +import com.github.retrooper.packetevents.protocol.nbt.NBTFloat; +import com.github.retrooper.packetevents.protocol.nbt.NBTInt; +import com.github.retrooper.packetevents.protocol.nbt.NBTNumber; +import com.github.retrooper.packetevents.protocol.nbt.NBTString; +import com.github.retrooper.packetevents.protocol.particle.Particle; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; +import com.github.retrooper.packetevents.protocol.sound.Sound; +import net.kyori.adventure.util.Index; + +import java.util.Optional; +import java.util.OptionalInt; + +public class BiomeEffects { + + private final int fogColor; + private final int waterColor; + private final int waterFogColor; + private final int skyColor; + private final OptionalInt foliageColor; + private final OptionalInt grassColor; + private final GrassColorModifier grassColorModifier; + private final Optional particle; + private final Optional ambientSound; + private final Optional moodSound; + private final Optional additionsSound; + private final Optional music; + + public BiomeEffects( + int fogColor, int waterColor, int waterFogColor, int skyColor, + OptionalInt foliageColor, OptionalInt grassColor, + GrassColorModifier grassColorModifier, + Optional particle, + Optional ambientSound, + Optional moodSound, + Optional additionsSound, + Optional music + ) { + this.fogColor = fogColor; + this.waterColor = waterColor; + this.waterFogColor = waterFogColor; + this.skyColor = skyColor; + this.foliageColor = foliageColor; + this.grassColor = grassColor; + this.grassColorModifier = grassColorModifier; + this.particle = particle; + this.ambientSound = ambientSound; + this.moodSound = moodSound; + this.additionsSound = additionsSound; + this.music = music; + } + + public static BiomeEffects decode(NBT nbt, ClientVersion version) { + NBTCompound compound = (NBTCompound) nbt; + int fogColor = compound.getNumberTagOrThrow("fog_color").getAsInt(); + int waterColor = compound.getNumberTagOrThrow("water_color").getAsInt(); + int waterFogColor = compound.getNumberTagOrThrow("water_fog_color").getAsInt(); + int skyColor = compound.getNumberTagOrThrow("sky_color").getAsInt(); + OptionalInt foliageColor = Optional.ofNullable(compound.getNumberTagOrNull("foliage_color")) + .map(NBTNumber::getAsInt).map(OptionalInt::of).orElseGet(OptionalInt::empty); + OptionalInt grassColor = Optional.ofNullable(compound.getNumberTagOrNull("grass_color")) + .map(NBTNumber::getAsInt).map(OptionalInt::of).orElseGet(OptionalInt::empty); + GrassColorModifier grassColorModifier = Optional.ofNullable(compound.getStringTagValueOrNull("grass_color_modifier")) + .map(GrassColorModifier.ID_INDEX::valueOrThrow).orElse(GrassColorModifier.NONE); + Optional particle = Optional.ofNullable(compound.getTagOrNull("particle")) + .map(tag -> ParticleSettings.decode(tag, version)); + Optional ambientSound = Optional.ofNullable(compound.getTagOrNull("ambient_sound")) + .map(tag -> Sound.decode(tag, version)); + Optional moodSound = Optional.ofNullable(compound.getTagOrNull("mood_sound")) + .map(tag -> AmbientMoodSettings.decode(tag, version)); + Optional additionsSound = Optional.ofNullable(compound.getTagOrNull("additions_sound")) + .map(tag -> AmbientMoodSettings.decode(tag, version)); + Optional music = Optional.ofNullable(compound.getTagOrNull("music")) + .map(tag -> MusicSettings.decode(tag, version)); + return new BiomeEffects(fogColor, waterColor, waterFogColor, skyColor, foliageColor, grassColor, + grassColorModifier, particle, ambientSound, moodSound, additionsSound, music); + } + + public static NBT encode(BiomeEffects effects, ClientVersion version) { + NBTCompound compound = new NBTCompound(); + compound.setTag("fog_color", new NBTInt(effects.fogColor)); + compound.setTag("water_color", new NBTInt(effects.waterColor)); + compound.setTag("water_fog_color", new NBTInt(effects.waterFogColor)); + compound.setTag("sky_color", new NBTInt(effects.skyColor)); + effects.foliageColor.ifPresent(color -> + compound.setTag("foliage_color", new NBTInt(color))); + effects.grassColor.ifPresent(color -> + compound.setTag("grass_color", new NBTInt(color))); + if (effects.grassColorModifier != GrassColorModifier.NONE) { + compound.setTag("grass_color_modifier", new NBTString(effects.grassColorModifier.getId())); + } + effects.particle.ifPresent(settings -> compound.setTag( + "particle", ParticleSettings.encode(settings, version))); + effects.ambientSound.ifPresent(sound -> compound.setTag( + "ambient_sound", Sound.encode(sound, version))); + effects.moodSound.ifPresent(sound -> compound.setTag( + "mood_sound", MoodSettings.encode(sound, version))); + effects.additionsSound.ifPresent(sound -> compound.setTag( + "additions_sound", AdditionsSettings.encode(sound, version))); + effects.music.ifPresent(music -> compound.setTag( + "music", MusicSettings.encode(music, version))); + return compound; + } + + public int getFogColor() { + return this.fogColor; + } + + public int getWaterColor() { + return this.waterColor; + } + + public int getWaterFogColor() { + return this.waterFogColor; + } + + public int getSkyColor() { + return this.skyColor; + } + + public OptionalInt getFoliageColor() { + return this.foliageColor; + } + + public OptionalInt getGrassColor() { + return this.grassColor; + } + + public GrassColorModifier getGrassColorModifier() { + return this.grassColorModifier; + } + + public Optional getParticle() { + return this.particle; + } + + public Optional getAmbientSound() { + return this.ambientSound; + } + + public enum GrassColorModifier { + + NONE("none"), + DARK_FOREST("dark_forest"), + SWAMP("swamp"); + + public static final Index ID_INDEX = Index.create( + GrassColorModifier.class, GrassColorModifier::getId); + + private final String id; + + GrassColorModifier(String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + } + + public static final class ParticleSettings { + + private final Particle particle; + private final float probability; + + public ParticleSettings(Particle particle, float probability) { + this.particle = particle; + this.probability = probability; + } + + public static ParticleSettings decode(NBT nbt, ClientVersion version) { + NBTCompound compound = (NBTCompound) nbt; + Particle particle = Particle.decode(compound.getTagOrNull("options"), version); + float probability = compound.getNumberTagOrThrow("probability").getAsFloat(); + return new ParticleSettings(particle, probability); + } + + public static NBT encode(ParticleSettings settings, ClientVersion version) { + NBTCompound compound = new NBTCompound(); + compound.setTag("options", Particle.encode(settings.particle, version)); + compound.setTag("probability", new NBTFloat(settings.probability)); + return compound; + } + + public Particle getParticle() { + return this.particle; + } + + public float getProbability() { + return this.probability; + } + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biomes.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biomes.java new file mode 100644 index 0000000000..5a3d4aa534 --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/Biomes.java @@ -0,0 +1,141 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.world.biome; + +import com.github.retrooper.packetevents.PacketEvents; +import com.github.retrooper.packetevents.protocol.nbt.NBT; +import com.github.retrooper.packetevents.protocol.nbt.NBTCompound; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; +import com.github.retrooper.packetevents.resources.ResourceLocation; +import com.github.retrooper.packetevents.util.mappings.MappingHelper; +import com.github.retrooper.packetevents.util.mappings.VersionedRegistry; +import org.jetbrains.annotations.ApiStatus; + +import java.util.HashMap; +import java.util.Map; + +public final class Biomes { + + private static final VersionedRegistry REGISTRY = new VersionedRegistry<>( + "worldgen/biome", "world/biome_mappings"); + + // load data from file, biomes are too complex to define in code here + private static final Map BIOME_DATA; + + static { + BIOME_DATA = new HashMap<>(); + NBTCompound dataTag = MappingHelper.decompress("mappings/world/biome_data"); + for (Map.Entry entry : dataTag.getTags().entrySet()) { + if (entry.getKey().equals("version")) { + continue; // skip version field + } + ResourceLocation enchantKey = new ResourceLocation(entry.getKey()); + BIOME_DATA.put(enchantKey, (NBTCompound) entry.getValue()); + } + } + + private Biomes() { + } + + @ApiStatus.Internal + public static Biome define(String key) { + return REGISTRY.define(key, data -> { + NBTCompound dataTag = BIOME_DATA.get(data.getName()); + if (dataTag == null) { + throw new IllegalArgumentException("Can't define biome " + data.getName() + ", no data found"); + } + ClientVersion version = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(); + return Biome.decode(dataTag, version, data); + }); + } + + public static VersionedRegistry getRegistry() { + return REGISTRY; + } + + public static final Biome BADLANDS = define("badlands"); + public static final Biome BAMBOO_JUNGLE = define("bamboo_jungle"); + public static final Biome BASALT_DELTAS = define("basalt_deltas"); + public static final Biome BEACH = define("beach"); + public static final Biome BIRCH_FOREST = define("birch_forest"); + public static final Biome CHERRY_GROVE = define("cherry_grove"); + public static final Biome COLD_OCEAN = define("cold_ocean"); + public static final Biome CRIMSON_FOREST = define("crimson_forest"); + public static final Biome DARK_FOREST = define("dark_forest"); + public static final Biome DEEP_COLD_OCEAN = define("deep_cold_ocean"); + public static final Biome DEEP_DARK = define("deep_dark"); + public static final Biome DEEP_FROZEN_OCEAN = define("deep_frozen_ocean"); + public static final Biome DEEP_LUKEWARM_OCEAN = define("deep_lukewarm_ocean"); + public static final Biome DEEP_OCEAN = define("deep_ocean"); + public static final Biome DESERT = define("desert"); + public static final Biome DRIPSTONE_CAVES = define("dripstone_caves"); + public static final Biome END_BARRENS = define("end_barrens"); + public static final Biome END_HIGHLANDS = define("end_highlands"); + public static final Biome END_MIDLANDS = define("end_midlands"); + public static final Biome ERODED_BADLANDS = define("eroded_badlands"); + public static final Biome FLOWER_FOREST = define("flower_forest"); + public static final Biome FOREST = define("forest"); + public static final Biome FROZEN_OCEAN = define("frozen_ocean"); + public static final Biome FROZEN_PEAKS = define("frozen_peaks"); + public static final Biome FROZEN_RIVER = define("frozen_river"); + public static final Biome GROVE = define("grove"); + public static final Biome ICE_SPIKES = define("ice_spikes"); + public static final Biome JAGGED_PEAKS = define("jagged_peaks"); + public static final Biome JUNGLE = define("jungle"); + public static final Biome LUKEWARM_OCEAN = define("lukewarm_ocean"); + public static final Biome LUSH_CAVES = define("lush_caves"); + public static final Biome MANGROVE_SWAMP = define("mangrove_swamp"); + public static final Biome MEADOW = define("meadow"); + public static final Biome MUSHROOM_FIELDS = define("mushroom_fields"); + public static final Biome NETHER_WASTES = define("nether_wastes"); + public static final Biome OCEAN = define("ocean"); + public static final Biome OLD_GROWTH_BIRCH_FOREST = define("old_growth_birch_forest"); + public static final Biome OLD_GROWTH_PINE_TAIGA = define("old_growth_pine_taiga"); + public static final Biome OLD_GROWTH_SPRUCE_TAIGA = define("old_growth_spruce_taiga"); + public static final Biome PLAINS = define("plains"); + public static final Biome RIVER = define("river"); + public static final Biome SAVANNA = define("savanna"); + public static final Biome SAVANNA_PLATEAU = define("savanna_plateau"); + public static final Biome SMALL_END_ISLANDS = define("small_end_islands"); + public static final Biome SNOWY_BEACH = define("snowy_beach"); + public static final Biome SNOWY_PLAINS = define("snowy_plains"); + public static final Biome SNOWY_SLOPES = define("snowy_slopes"); + public static final Biome SNOWY_TAIGA = define("snowy_taiga"); + public static final Biome SOUL_SAND_VALLEY = define("soul_sand_valley"); + public static final Biome SPARSE_JUNGLE = define("sparse_jungle"); + public static final Biome STONY_PEAKS = define("stony_peaks"); + public static final Biome STONY_SHORE = define("stony_shore"); + public static final Biome SUNFLOWER_PLAINS = define("sunflower_plains"); + public static final Biome SWAMP = define("swamp"); + public static final Biome TAIGA = define("taiga"); + public static final Biome THE_END = define("the_end"); + public static final Biome THE_VOID = define("the_void"); + public static final Biome WARM_OCEAN = define("warm_ocean"); + public static final Biome WARPED_FOREST = define("warped_forest"); + public static final Biome WINDSWEPT_FOREST = define("windswept_forest"); + public static final Biome WINDSWEPT_GRAVELLY_HILLS = define("windswept_gravelly_hills"); + public static final Biome WINDSWEPT_HILLS = define("windswept_hills"); + public static final Biome WINDSWEPT_SAVANNA = define("windswept_savanna"); + public static final Biome WOODED_BADLANDS = define("wooded_badlands"); + + static { + BIOME_DATA.clear(); + REGISTRY.unloadMappings(); + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/StaticBiome.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/StaticBiome.java new file mode 100644 index 0000000000..c0f4f21109 --- /dev/null +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/biome/StaticBiome.java @@ -0,0 +1,76 @@ +/* + * This file is part of packetevents - https://github.com/retrooper/packetevents + * Copyright (C) 2024 retrooper and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.retrooper.packetevents.protocol.world.biome; + +import com.github.retrooper.packetevents.protocol.mapper.AbstractMappedEntity; +import com.github.retrooper.packetevents.util.mappings.TypesBuilderData; +import org.jetbrains.annotations.Nullable; + +public class StaticBiome extends AbstractMappedEntity implements Biome { + + private final boolean precipitation; + private final float temperature; + private final TemperatureModifier temperatureModifier; + private final float downfall; + private final BiomeEffects effects; + + public StaticBiome( + @Nullable TypesBuilderData data, boolean precipitation, + float temperature, TemperatureModifier temperatureModifier, + float downfall, BiomeEffects effects + ) { + super(data); + this.precipitation = precipitation; + this.temperature = temperature; + this.temperatureModifier = temperatureModifier; + this.downfall = downfall; + this.effects = effects; + } + + @Override + public Biome copy(@Nullable TypesBuilderData newData) { + return new StaticBiome(newData, this.precipitation, this.temperature, + this.temperatureModifier, this.downfall, this.effects); + } + + @Override + public boolean hasPrecipitation() { + return this.precipitation; + } + + @Override + public float getTemperature() { + return this.temperature; + } + + @Override + public TemperatureModifier getTemperatureModifier() { + return this.temperatureModifier; + } + + @Override + public float getDownfall() { + return this.downfall; + } + + @Override + public BiomeEffects getEffects() { + return this.effects; + } +} diff --git a/api/src/main/java/com/github/retrooper/packetevents/util/mappings/SynchronizedRegistriesHandler.java b/api/src/main/java/com/github/retrooper/packetevents/util/mappings/SynchronizedRegistriesHandler.java index b5db5609fc..f193e5ffde 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/util/mappings/SynchronizedRegistriesHandler.java +++ b/api/src/main/java/com/github/retrooper/packetevents/util/mappings/SynchronizedRegistriesHandler.java @@ -21,8 +21,12 @@ import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.protocol.chat.ChatType; import com.github.retrooper.packetevents.protocol.chat.ChatTypes; +import com.github.retrooper.packetevents.protocol.entity.wolfvariant.WolfVariant; +import com.github.retrooper.packetevents.protocol.entity.wolfvariant.WolfVariants; import com.github.retrooper.packetevents.protocol.item.banner.BannerPattern; import com.github.retrooper.packetevents.protocol.item.banner.BannerPatterns; +import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentType; +import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentTypes; import com.github.retrooper.packetevents.protocol.item.trimmaterial.TrimMaterial; import com.github.retrooper.packetevents.protocol.item.trimmaterial.TrimMaterials; import com.github.retrooper.packetevents.protocol.item.trimpattern.TrimPattern; @@ -53,12 +57,12 @@ public final class SynchronizedRegistriesHandler { new RegistryEntry<>(ChatTypes.getRegistry(), ChatType::decode), new RegistryEntry<>(TrimPatterns.getRegistry(), TrimPattern::decode), new RegistryEntry<>(TrimMaterials.getRegistry(), TrimMaterial::decode), - // TODO: wolf_variant + new RegistryEntry<>(WolfVariants.getRegistry(), WolfVariant::decode), // TODO: painting_variant new RegistryEntry<>(DimensionTypes.getRegistry(), DimensionType::decode), // TODO: damage_type - new RegistryEntry<>(BannerPatterns.getRegistry(), BannerPattern::decode) - // TODO: enchantment + new RegistryEntry<>(BannerPatterns.getRegistry(), BannerPattern::decode), + new RegistryEntry<>(EnchantmentTypes.getRegistry(), EnchantmentType::decode) // TODO: jukebox_song ).collect(Collectors.toMap(RegistryEntry::getRegistryKey, Function.identity())); diff --git a/mappings/entity/wolf_variant_mappings.json b/mappings/entity/wolf_variant_mappings.json new file mode 100644 index 0000000000..f7d78664b9 --- /dev/null +++ b/mappings/entity/wolf_variant_mappings.json @@ -0,0 +1,13 @@ +{ + "V_1_20_5": [ + "pale", + "spotted", + "snowy", + "black", + "ashen", + "rusty", + "woods", + "chestnut", + "striped" + ] +} diff --git a/mappings/world/biome_data.json b/mappings/world/biome_data.json new file mode 100644 index 0000000000..29b1e706b1 --- /dev/null +++ b/mappings/world/biome_data.json @@ -0,0 +1,1340 @@ +{ + "minecraft:badlands": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.badlands", + "min_delay": 12000 + }, + "sky_color": 7254527, + "grass_color": 9470285, + "foliage_color": 10387789, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:bamboo_jungle": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.bamboo_jungle", + "min_delay": 12000 + }, + "sky_color": 7842047, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.95, + "downfall": 0.9 + }, + "minecraft:basalt_deltas": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.nether.basalt_deltas", + "min_delay": 12000 + }, + "sky_color": 7254527, + "ambient_sound": "minecraft:ambient.basalt_deltas.loop", + "additions_sound": { + "sound": "minecraft:ambient.basalt_deltas.additions", + "tick_chance": 0.0111 + }, + "particle": { + "probability": 0.118093334, + "options": { + "type": "minecraft:white_ash" + } + }, + "water_fog_color": 329011, + "fog_color": 6840176, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.basalt_deltas.mood", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:beach": { + "effects": { + "sky_color": 7907327, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.4 + }, + "minecraft:birch_forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.forest", + "min_delay": 12000 + }, + "sky_color": 8037887, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.6, + "downfall": 0.6 + }, + "minecraft:cherry_grove": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.cherry_grove", + "min_delay": 12000 + }, + "sky_color": 8103167, + "grass_color": 11983713, + "foliage_color": 11983713, + "water_fog_color": 6141935, + "fog_color": 12638463, + "water_color": 6141935, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.8 + }, + "minecraft:cold_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4020182, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:crimson_forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.nether.crimson_forest", + "min_delay": 12000 + }, + "sky_color": 7254527, + "ambient_sound": "minecraft:ambient.crimson_forest.loop", + "additions_sound": { + "sound": "minecraft:ambient.crimson_forest.additions", + "tick_chance": 0.0111 + }, + "particle": { + "probability": 0.025, + "options": { + "type": "minecraft:crimson_spore" + } + }, + "water_fog_color": 329011, + "fog_color": 3343107, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.crimson_forest.mood", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:dark_forest": { + "effects": { + "grass_color_modifier": "dark_forest", + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.forest", + "min_delay": 12000 + }, + "sky_color": 7972607, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.7, + "downfall": 0.8 + }, + "minecraft:deep_cold_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4020182, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:deep_dark": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.deep_dark", + "min_delay": 12000 + }, + "sky_color": 7907327, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.4 + }, + "minecraft:deep_frozen_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 3750089, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5, + "temperature_modifier": "frozen" + }, + "minecraft:deep_lukewarm_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 267827, + "fog_color": 12638463, + "water_color": 4566514, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:deep_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:desert": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.desert", + "min_delay": 12000 + }, + "sky_color": 7254527, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:dripstone_caves": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.dripstone_caves", + "min_delay": 12000 + }, + "sky_color": 7907327, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.4 + }, + "minecraft:end_barrens": { + "effects": { + "sky_color": 0, + "water_fog_color": 329011, + "fog_color": 10518688, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:end_highlands": { + "effects": { + "sky_color": 0, + "water_fog_color": 329011, + "fog_color": 10518688, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:end_midlands": { + "effects": { + "sky_color": 0, + "water_fog_color": 329011, + "fog_color": 10518688, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:eroded_badlands": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.badlands", + "min_delay": 12000 + }, + "sky_color": 7254527, + "grass_color": 9470285, + "foliage_color": 10387789, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:flower_forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.flower_forest", + "min_delay": 12000 + }, + "sky_color": 7972607, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.7, + "downfall": 0.8 + }, + "minecraft:forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.forest", + "min_delay": 12000 + }, + "sky_color": 7972607, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.7, + "downfall": 0.8 + }, + "minecraft:frozen_ocean": { + "effects": { + "sky_color": 8364543, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 3750089, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0, + "downfall": 0.5, + "temperature_modifier": "frozen" + }, + "minecraft:frozen_peaks": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.frozen_peaks", + "min_delay": 12000 + }, + "sky_color": 8756735, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": -0.7, + "downfall": 0.9 + }, + "minecraft:frozen_river": { + "effects": { + "sky_color": 8364543, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 3750089, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0, + "downfall": 0.5 + }, + "minecraft:grove": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.grove", + "min_delay": 12000 + }, + "sky_color": 8495359, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": -0.2, + "downfall": 0.8 + }, + "minecraft:ice_spikes": { + "effects": { + "sky_color": 8364543, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0, + "downfall": 0.5 + }, + "minecraft:jagged_peaks": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.jagged_peaks", + "min_delay": 12000 + }, + "sky_color": 8756735, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": -0.7, + "downfall": 0.9 + }, + "minecraft:jungle": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.jungle", + "min_delay": 12000 + }, + "sky_color": 7842047, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.95, + "downfall": 0.9 + }, + "minecraft:lukewarm_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 267827, + "fog_color": 12638463, + "water_color": 4566514, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:lush_caves": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.lush_caves", + "min_delay": 12000 + }, + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:mangrove_swamp": { + "effects": { + "grass_color_modifier": "swamp", + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.swamp", + "min_delay": 12000 + }, + "sky_color": 7907327, + "foliage_color": 9285927, + "water_fog_color": 5077600, + "fog_color": 12638463, + "water_color": 3832426, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.9 + }, + "minecraft:meadow": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.meadow", + "min_delay": 12000 + }, + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 937679, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.8 + }, + "minecraft:mushroom_fields": { + "effects": { + "sky_color": 7842047, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.9, + "downfall": 1 + }, + "minecraft:nether_wastes": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.nether.nether_wastes", + "min_delay": 12000 + }, + "sky_color": 7254527, + "ambient_sound": "minecraft:ambient.nether_wastes.loop", + "additions_sound": { + "sound": "minecraft:ambient.nether_wastes.additions", + "tick_chance": 0.0111 + }, + "water_fog_color": 329011, + "fog_color": 3344392, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.nether_wastes.mood", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:old_growth_birch_forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.forest", + "min_delay": 12000 + }, + "sky_color": 8037887, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.6, + "downfall": 0.6 + }, + "minecraft:old_growth_pine_taiga": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.old_growth_taiga", + "min_delay": 12000 + }, + "sky_color": 8168447, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.3, + "downfall": 0.8 + }, + "minecraft:old_growth_spruce_taiga": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.old_growth_taiga", + "min_delay": 12000 + }, + "sky_color": 8233983, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.25, + "downfall": 0.8 + }, + "minecraft:plains": { + "effects": { + "sky_color": 7907327, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.4 + }, + "minecraft:river": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:savanna": { + "effects": { + "sky_color": 7254527, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:savanna_plateau": { + "effects": { + "sky_color": 7254527, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:small_end_islands": { + "effects": { + "sky_color": 0, + "water_fog_color": 329011, + "fog_color": 10518688, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:snowy_beach": { + "effects": { + "sky_color": 8364543, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4020182, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.05, + "downfall": 0.3 + }, + "minecraft:snowy_plains": { + "effects": { + "sky_color": 8364543, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0, + "downfall": 0.5 + }, + "minecraft:snowy_slopes": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.snowy_slopes", + "min_delay": 12000 + }, + "sky_color": 8560639, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": -0.3, + "downfall": 0.9 + }, + "minecraft:snowy_taiga": { + "effects": { + "sky_color": 8625919, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4020182, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": -0.5, + "downfall": 0.4 + }, + "minecraft:soul_sand_valley": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.nether.soul_sand_valley", + "min_delay": 12000 + }, + "sky_color": 7254527, + "ambient_sound": "minecraft:ambient.soul_sand_valley.loop", + "additions_sound": { + "sound": "minecraft:ambient.soul_sand_valley.additions", + "tick_chance": 0.0111 + }, + "particle": { + "probability": 0.00625, + "options": { + "type": "minecraft:ash" + } + }, + "water_fog_color": 329011, + "fog_color": 1787717, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.soul_sand_valley.mood", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:sparse_jungle": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.sparse_jungle", + "min_delay": 12000 + }, + "sky_color": 7842047, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.95, + "downfall": 0.8 + }, + "minecraft:stony_peaks": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.stony_peaks", + "min_delay": 12000 + }, + "sky_color": 7776511, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 1, + "downfall": 0.3 + }, + "minecraft:stony_shore": { + "effects": { + "sky_color": 8233727, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.2, + "downfall": 0.3 + }, + "minecraft:sunflower_plains": { + "effects": { + "sky_color": 7907327, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.4 + }, + "minecraft:swamp": { + "effects": { + "grass_color_modifier": "swamp", + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.swamp", + "min_delay": 12000 + }, + "sky_color": 7907327, + "foliage_color": 6975545, + "water_fog_color": 2302743, + "fog_color": 12638463, + "water_color": 6388580, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.8, + "downfall": 0.9 + }, + "minecraft:taiga": { + "effects": { + "sky_color": 8233983, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.25, + "downfall": 0.8 + }, + "minecraft:the_end": { + "effects": { + "sky_color": 0, + "water_fog_color": 329011, + "fog_color": 10518688, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:the_void": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:warm_ocean": { + "effects": { + "sky_color": 8103167, + "water_fog_color": 270131, + "fog_color": 12638463, + "water_color": 4445678, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.5, + "downfall": 0.5 + }, + "minecraft:warped_forest": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.nether.warped_forest", + "min_delay": 12000 + }, + "sky_color": 7254527, + "ambient_sound": "minecraft:ambient.warped_forest.loop", + "additions_sound": { + "sound": "minecraft:ambient.warped_forest.additions", + "tick_chance": 0.0111 + }, + "particle": { + "probability": 0.01428, + "options": { + "type": "minecraft:warped_spore" + } + }, + "water_fog_color": 329011, + "fog_color": 1705242, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.warped_forest.mood", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:windswept_forest": { + "effects": { + "sky_color": 8233727, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.2, + "downfall": 0.3 + }, + "minecraft:windswept_gravelly_hills": { + "effects": { + "sky_color": 8233727, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.2, + "downfall": 0.3 + }, + "minecraft:windswept_hills": { + "effects": { + "sky_color": 8233727, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 1, + "temperature": 0.2, + "downfall": 0.3 + }, + "minecraft:windswept_savanna": { + "effects": { + "sky_color": 7254527, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + }, + "minecraft:wooded_badlands": { + "effects": { + "music": { + "replace_current_music": 0, + "max_delay": 24000, + "sound": "minecraft:music.overworld.badlands", + "min_delay": 12000 + }, + "sky_color": 7254527, + "grass_color": 9470285, + "foliage_color": 10387789, + "water_fog_color": 329011, + "fog_color": 12638463, + "water_color": 4159204, + "mood_sound": { + "tick_delay": 6000, + "offset": 2, + "sound": "minecraft:ambient.cave", + "block_search_extent": 8 + } + }, + "has_precipitation": 0, + "temperature": 2, + "downfall": 0 + } +} diff --git a/mappings/world/biome_mappings.json b/mappings/world/biome_mappings.json new file mode 100644 index 0000000000..0487507d3d --- /dev/null +++ b/mappings/world/biome_mappings.json @@ -0,0 +1,68 @@ +{ + "V_1_21": [ + "snowy_slopes", + "small_end_islands", + "desert", + "cold_ocean", + "birch_forest", + "dark_forest", + "cherry_grove", + "lush_caves", + "nether_wastes", + "snowy_plains", + "flower_forest", + "windswept_hills", + "beach", + "deep_cold_ocean", + "swamp", + "ice_spikes", + "mangrove_swamp", + "savanna", + "the_end", + "savanna_plateau", + "plains", + "stony_shore", + "sparse_jungle", + "end_midlands", + "old_growth_pine_taiga", + "frozen_peaks", + "windswept_forest", + "jagged_peaks", + "warm_ocean", + "frozen_ocean", + "deep_lukewarm_ocean", + "deep_frozen_ocean", + "stony_peaks", + "sunflower_plains", + "soul_sand_valley", + "end_barrens", + "jungle", + "mushroom_fields", + "ocean", + "the_void", + "eroded_badlands", + "old_growth_birch_forest", + "badlands", + "snowy_taiga", + "old_growth_spruce_taiga", + "bamboo_jungle", + "meadow", + "windswept_gravelly_hills", + "deep_dark", + "snowy_beach", + "basalt_deltas", + "crimson_forest", + "river", + "lukewarm_ocean", + "taiga", + "wooded_badlands", + "dripstone_caves", + "frozen_river", + "deep_ocean", + "warped_forest", + "forest", + "end_highlands", + "windswept_savanna", + "grove" + ] +}