crwdns141493:0crwdne141493:0
crwdns141497:0:javadoc:crwdnd141497:0:javadoc:crwdne141497:0
crwdns141499:0crwdne141499:0
crwdns156959:0:javadoc:crwdne156959:0
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.inventory.ItemStack;
public boolean isStick(ItemStack stack) {
ItemType type = stack.type();
return type.equals(ItemTypes.STICK.get());
}
crwdns141503:0crwdne141503:0
crwdns156961:0:javadoc:crwdne156961:0
crwdns141507:0crwdne141507:0
crwdns141509:0crwdne141509:0
import org.spongepowered.api.data.key.Keys;
public void setUnbreakable(ItemStack stack) {
stack.offer(Keys.UNBREAKABLE, true);
}
crwdns141511:0:javadoc:crwdne141511:0
crwdns141513:0:javadoc:crwdne141513:0
import net.kyori.adventure.text.Component;
import java.util.List;
public void setLore(ItemStack stack, List<Component> itemLore) {
if (stack.get(Keys.ITEM_LORE).isPresent()) {
stack.offer(Keys.ITEM_LORE, itemLore);
}
}
Note
crwdns141515:0crwdne141515:0
crwdns141517:0crwdne141517:0
crwdns156963:0:javadoc:crwdne156963:0
import org.spongepowered.api.block.BlockTypes;
public boolean canMineObsidian(ItemStack stack) {
List<BlockType> canHarvest =
stack.get(Keys.CAN_HARVEST).orElse(Collections.emptyList());
return canHarvest.contains(BlockTypes.OBSIDIAN.get());
}
crwdns156965:0crwdne156965:0
crwdns141523:0crwdne141523:0
crwdns141525:0:javadoc:crwdnd141525:0:javadoc:crwdne141525:0
public boolean isEqual(ItemStack stack1, ItemStack stack2) {
return stack1.equalTo(stack2);
}