NyaaCat / NyaaCat/NyaaCore

1.18 no getTag()

Open
#40 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
24
Forks
16
PR merge metrics
No merged PRs in 30d

Description

getTag() only exists on 1.17 version.

    public static Optional<Integer> getInt(ItemStack item, String key) {
        Optional<net.minecraft.world.item.ItemStack> item1;
        try {
            item1 = getItem(item);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            return Optional.empty();
        }
        if (item1.isEmpty()) return Optional.empty();
        NBTTagCompound tag = item1.get().getTag(); // exception
        if (tag == null) return Optional.empty();
        return !tag.contains(key) ? Optional.empty() : Optional.of(tag.getInt(key));
    }

from https://github.com/NyaaCat/NyaaCore/blob/1.18/src/main/java/cat/nyaa/nyaacore/utils/ItemTagUtils.java

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in 1.18/src/main/java/cat/nyaa/nyaacore/utils/ItemTagUtils.java and compare the shown getInt implementation with the 1.17 version. Inspect the 1.18 ItemStack API to identify the supported tag access used by this path; done means getInt can read the requested integer without the reported getTag() exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.