Remove unused parameter in NBT translation

This commit is contained in:
Camotoy 2023-04-08 12:57:07 -04:00
parent 707cbce6cf
commit f83235cf96
17 changed files with 33 additions and 38 deletions

View file

@ -28,7 +28,6 @@ package org.geysermc.geyser.item.type;
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.MinecraftLocale;
import org.jetbrains.annotations.NotNull;
@ -39,8 +38,8 @@ public class AxolotlBucketItem extends Item {
}
@Override
public void translateNbtToBedrock(@NotNull GeyserSession session, @NotNull CompoundTag tag, @NotNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NotNull GeyserSession session, @NotNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
// Bedrock Edition displays the properties of the axolotl. Java does not.
// To work around this, set the custom name to the Axolotl translation and it's displayed correctly

View file

@ -121,8 +121,8 @@ public class BannerItem extends BlockItem {
}
@Override
public void translateNbtToBedrock(@NotNull GeyserSession session, @NotNull CompoundTag tag, @NotNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NotNull GeyserSession session, @NotNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
CompoundTag blockEntityTag = tag.remove("BlockEntityTag");
if (blockEntityTag != null && blockEntityTag.get("Patterns") instanceof ListTag patterns) {

View file

@ -57,8 +57,8 @@ public class CompassItem extends Item {
}
@Override
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag, ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
Tag lodestoneTag = tag.get("LodestoneTracked");
if (lodestoneTag instanceof ByteTag) {

View file

@ -39,8 +39,8 @@ public class CrossbowItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
ListTag chargedProjectiles = tag.get("ChargedProjectiles");
if (chargedProjectiles != null) {
@ -50,7 +50,7 @@ public class CrossbowItem extends Item {
ItemMapping projectileMapping = session.getItemMappings().getMapping((String) projectile.get("id").getValue());
if (projectileMapping == null) return;
CompoundTag projectileTag = projectile.get("tag");
ItemStack itemStack = new ItemStack(mapping.getJavaItem().javaId(), (byte) projectile.get("Count").getValue(), projectileTag);
ItemStack itemStack = new ItemStack(projectileMapping.getJavaItem().javaId(), (byte) projectile.get("Count").getValue(), projectileTag);
ItemData itemData = ItemTranslator.translateToBedrock(session, itemStack);
CompoundTag newProjectile = new CompoundTag("chargedItem");

View file

@ -38,8 +38,8 @@ public class DyeableArmorItem extends ArmorItem implements DyeableLeatherItem {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
DyeableLeatherItem.translateNbtToBedrock(tag);
}

View file

@ -37,8 +37,8 @@ public class DyeableHorseArmorItem extends Item implements DyeableLeatherItem {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
DyeableLeatherItem.translateNbtToBedrock(tag);
}

View file

@ -28,7 +28,6 @@ package org.geysermc.geyser.item.type;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
import java.util.ArrayList;
@ -40,8 +39,8 @@ public class EnchantedBookItem extends Item {
}
@Override
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag, ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
List<Tag> newTags = new ArrayList<>();
Tag enchantmentTag = tag.remove("StoredEnchantments");

View file

@ -38,8 +38,8 @@ public class FireworkRocketItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
CompoundTag fireworks = tag.get("Fireworks");
if (fireworks == null) {

View file

@ -39,8 +39,8 @@ public class FireworkStarItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
Tag explosion = tag.remove("Explosion");
if (explosion instanceof CompoundTag) {

View file

@ -28,7 +28,6 @@ package org.geysermc.geyser.item.type;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
public class FishingRodItem extends Item {
@ -37,8 +36,8 @@ public class FishingRodItem extends Item {
}
@Override
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag, ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
// Fix damage inconsistency
Tag damage = tag.get("Damage");

View file

@ -114,7 +114,7 @@ public class Item {
/**
* Takes NBT from Java Edition and converts any value that Bedrock parses differently.
*/
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
if (tag.get("display") instanceof CompoundTag displayTag) {
if (displayTag.get("Lore") instanceof ListTag listTag) {
List<Tag> lore = new ArrayList<>();

View file

@ -35,8 +35,8 @@ public class MapItem extends Item {
}
@Override
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag, ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(GeyserSession session, CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
Tag mapId = tag.remove("map");
if (mapId == null || !(mapId.getValue() instanceof Number number)) return;

View file

@ -29,7 +29,6 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.MinecraftLocale;
@ -40,8 +39,8 @@ public class PlayerHeadItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
Tag display = tag.get("display");
if (!(display instanceof CompoundTag) || !((CompoundTag) display).contains("Name")) {

View file

@ -46,8 +46,8 @@ public class ReadableBookItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
ListTag pagesTag = tag.remove("pages");
if (pagesTag == null) {

View file

@ -39,8 +39,8 @@ public class ShulkerBoxItem extends BlockItem {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
if (blockEntityTag == null) {

View file

@ -32,7 +32,6 @@ import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextDecoration;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.entity.type.living.animal.TropicalFishEntity;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.MinecraftLocale;
import org.geysermc.geyser.translator.text.MessageTranslator;
@ -48,8 +47,8 @@ public class TropicalFishBucketItem extends Item {
}
@Override
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag, @NonNull ItemMapping mapping) {
super.translateNbtToBedrock(session, tag, mapping);
public void translateNbtToBedrock(@NonNull GeyserSession session, @NonNull CompoundTag tag) {
super.translateNbtToBedrock(session, tag);
// Prevent name from appearing as "Bucket of"
tag.put(new ByteTag("AppendCustomName", (byte) 1));

View file

@ -112,7 +112,7 @@ public final class ItemTranslator {
CompoundTag nbt = tag != null ? tag.clone() : null;
if (nbt != null) {
javaItem.translateNbtToBedrock(session, nbt, bedrockItem);
javaItem.translateNbtToBedrock(session, nbt);
}
nbt = translateDisplayProperties(session, nbt, bedrockItem);