crwdns121919:0crwdne121919:0
crwdns121921:0:javadoc:crwdnd121921:0:javadoc:crwdne121921:0
crwdns121923:0crwdne121923:0
crwdns121925:0:javadoc:crwdne121925: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);
}
crwdns121927:0crwdne121927:0
crwdns121929:0:javadoc:crwdne121929:0
crwdns121931:0crwdne121931:0
crwdns121933:0crwdne121933:0
import org.spongepowered.api.data.key.Keys;
public void setUnbreakable(ItemStack stack) {
stack.offer(Keys.UNBREAKABLE, true);
}
crwdns121935:0:javadoc:crwdne121935:0
crwdns121937:0:javadoc:crwdne121937:0
import org.spongepowered.api.text.Text;
import java.util.List;
public void setLore(ItemStack stack, List<Text> itemLore) {
if (stack.get(Keys.ITEM_LORE).isPresent()) {
stack.offer(Keys.ITEM_LORE, itemLore);
}
}
Note
crwdns121939:0crwdne121939:0
crwdns121941:0crwdne121941:0
crwdns121943:0:javadoc:crwdne121943: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;
}
crwdns121945:0crwdne121945:0
crwdns121947:0crwdne121947:0
crwdns121949:0:javadoc:crwdnd121949:0:javadoc:crwdne121949:0
public boolean isEqual(ItemStack stack1, ItemStack stack2) {
return stack1.equalTo(stack2);
}