emilyploszaj / trinkets

A data-driven accessory mod and API for Minecraft using Fabric.
https://www.curseforge.com/minecraft/mc-mods/trinkets
MIT License
165 stars 72 forks source link

Resolve Deprecation, Unused Import, and Resource Leak Warnings #317

Closed Lakuna closed 3 months ago

Lakuna commented 3 months ago

This pull request resolves several of the warnings that appear when opening this project in my editor (Visual Studio Code). It does not make any functionality changes to the mod.

In general, these warnings can be split into three categories:

  1. Deprecated fields have been replaced with equivalent un-deprecated fields. Specifically, NbtType has been superseded by NbtElement.
  2. Unused imports have been removed.
  3. In order to resolve warnings that appear as Resource leak: '<unassigned Closeable value>' is never closed, several changes have been made with the following general form:

    if (!entity.getWorld().isClient) {
        // ...
    }

    ...has been replaced with:

    World world = entity.getWorld();
    if (!world.isClient) {
        // ...
    }

CC: @emilyploszaj