crwdns141493:0crwdne141493:0
Warning
crwdns141495:0crwdne141495:0
crwdns141497:0:javadoc:crwdnd141497:0:javadoc:crwdne141497:0
crwdns141499:0crwdne141499:0
crwdns141501:0:javadoc:crwdne141501: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.getType();
return type.equals(ItemTypes.STICK);
}
crwdns141503:0crwdne141503:0
crwdns141505:0:javadoc:crwdne141505: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
crwdns141519:0:javadoc:crwdne141519:0
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.data.property.item.HarvestingProperty;
import java.util.Optional;
public boolean canMineObsidian(ItemStack stack) {
Optional<HarvestingProperty> optional =
stack.getProperty(HarvestingProperty.class);
if (optional.isPresent()) {
HarvestingProperty property = optional.get();
return property.getValue().contains(BlockTypes.OBSIDIAN);
}
return false;
}
crwdns141521:0crwdne141521:0
crwdns141523:0crwdne141523:0
crwdns141525:0:javadoc:crwdnd141525:0:javadoc:crwdne141525:0
public boolean isEqual(ItemStack stack1, ItemStack stack2) {
return stack1.equalTo(stack2);
}