Skip to content

Commit

Permalink
fix hand skins not activating without meta
Browse files Browse the repository at this point in the history
  • Loading branch information
CJCrafter committed Dec 3, 2024
1 parent 8d9f779 commit 9619086
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void apply(@NotNull ItemStack weapon, @Nullable String skin, @Nullable Sk

// Ideally this will never be true, but sometimes we try to apply skins
// to AIR which causes errors.
if (!weapon.hasItemMeta())
ItemMeta meta = weapon.getItemMeta();
if (meta == null)
return;

// We set these to null because we must skip them. base is always
Expand Down Expand Up @@ -106,7 +107,12 @@ public void apply(@NotNull ItemStack weapon, @Nullable String skin, @Nullable Sk
if (base.hasType() && weapon.getType() != base.getType())
weapon.setType(base.getType());

ItemMeta meta = weapon.getItemMeta();
meta = weapon.getItemMeta();
if (meta == null) {
WeaponMechanics.debug.error("Item w/ skin suddenly lost metadata... Did you redefine item type to AIR?");
return;
}

meta.setCustomModelData(customModelData);
weapon.setItemMeta(meta);
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Versions of the 2 plugins stored in this repo.
mechanicsCoreVersion=3.5.2
weaponMechanicsVersion=3.5.3
weaponMechanicsVersion=3.5.4

# Version of the resource pack
resourcePackVersion=2.1.2
Expand Down

0 comments on commit 9619086

Please sign in to comment.