Skip to content

Commit

Permalink
fix: withType has different behavior in 1.21.3+ and refuses to replac…
Browse files Browse the repository at this point in the history
…e air. GG minecraft.
  • Loading branch information
oddlama committed Dec 19, 2024
1 parent cf6bc18 commit b9eb637
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion vane-core/src/main/java/org/oddlama/vane/util/ItemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ public static ItemStack set_lore(final ItemStack item, final List<Component> lor
}

public static ItemStack name_item(final ItemStack item, Component name, final List<Component> lore) {
final var meta = item.getItemMeta();
var meta = item.getItemMeta();
if (meta == null) {
// Cannot name item without meta (probably air)
return item;
}

name = name.decoration(TextDecoration.ITALIC, false);
meta.displayName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ private MenuWidget menu_item_block_selector(
public void item(final ItemStack item) {
var stack = item_for_type(style_container, active, type);
if (stack.getType() == Material.AIR) {
stack = stack.withType(Material.BARRIER);
stack = new ItemStack(Material.BARRIER);
}
super.item(t_item.alternative(stack, "§6" + building_material.getKey()));
}
Expand Down

0 comments on commit b9eb637

Please sign in to comment.