Skip to content

Commit

Permalink
Fixes an issue where items can be a block but not an item #332
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Sep 18, 2024
1 parent 58bcf9e commit b66ecb2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/world/bentobox/level/panels/ValuePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;

Expand Down Expand Up @@ -58,6 +60,7 @@ private ValuePanel(Level addon,
this.activeFilter = Filter.NAME_ASC;
this.materialRecordList = Arrays.stream(Material.values()).
filter(Material::isBlock).
filter(Material::isItem). // Remove things like PITCHER_CROP
filter(m -> !m.name().startsWith("LEGACY_")).
filter(this.addon.getBlockConfig()::isNotHiddenBlock).
map(material ->
Expand Down Expand Up @@ -584,6 +587,7 @@ private PanelItem createMaterialButton(ItemTemplateRecord template, TemplatedPan
return null;
}

@SuppressWarnings("deprecation")
int index = this.pageIndex * slot.amountMap().getOrDefault(BLOCK, 1) + slot.slot();

if (index >= this.elementList.size())
Expand Down

0 comments on commit b66ecb2

Please sign in to comment.