Java Code Examples for org.bukkit.Material#getNewData()
The following examples show how to use
org.bukkit.Material#getNewData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaterialEncoder.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
static MaterialData decodeMaterial(int encoded) { if (encoded == ENCODED_NULL_MATERIAL) return null; Material material = decodeType(encoded); if (material.getData() == MaterialData.class) { return new MaterialData(material, decodeMetadata(encoded)); } else { return material.getNewData(decodeMetadata(encoded)); } }
Example 2
Source File: ItemStack.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * Gets the MaterialData for this stack of items * * @return MaterialData for this item */ public MaterialData getData() { Material mat = getType(); if (data == null && mat != null && mat.getData() != null) { data = mat.getNewData((byte) this.getDurability()); } return data; }
Example 3
Source File: ItemStack.java From Kettle with GNU General Public License v3.0 | 5 votes |
private void createData(final byte data) { Material mat = Material.getMaterial(type); if (mat == null) { this.data = new MaterialData(type, data); } else { this.data = mat.getNewData(data); } }
Example 4
Source File: CraftBlockState.java From Kettle with GNU General Public License v3.0 | 5 votes |
private void createData(final byte data) { Material mat = getType(); if (mat == null || mat.getData() == null) { this.data = new MaterialData(type, data); } else { this.data = mat.getNewData(data); } }
Example 5
Source File: XMLUtils.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
public static MaterialData parseMaterialData(Node node, String text) throws InvalidXMLException { String[] pieces = text.split(":"); Material material = parseMaterial(node, pieces[0]); byte data; if(pieces.length > 1) { data = parseNumber(node, pieces[1], Byte.class); } else { data = 0; } return material.getNewData(data); }
Example 6
Source File: MaterialDataParser.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@Override protected MaterialData parseInternal(Node node, String text) throws FormatException, InvalidXMLException { final String[] pieces = text.split(":"); final Material material = materialParser.parse(node, pieces[0]); final byte data; if(pieces.length > 1) { data = byteParser.parse(node, pieces[1]); } else { data = 0; } return material.getNewData(data); }
Example 7
Source File: MaterialUtils.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
public static MaterialData decodeMaterial(int encoded) { if(encoded == ENCODED_NULL_MATERIAL) return null; Material material = decodeType(encoded); if(material.getData() == MaterialData.class) { return new MaterialData(material, decodeMetadata(encoded)); } else { return material.getNewData(decodeMetadata(encoded)); } }
Example 8
Source File: ItemStackImpl.java From Civs with GNU General Public License v3.0 | 5 votes |
public MaterialData getData() { Material mat = Bukkit.getUnsafe().toLegacy(this.getType()); if (this.data == null && mat != null && mat.getData() != null) { this.data = mat.getNewData((byte)this.getDurability()); } return this.data; }
Example 9
Source File: CraftBlockState.java From Thermos with GNU General Public License v3.0 | 5 votes |
private void createData(final byte data) { Material mat = getType(); if (mat == null || mat.getData() == null) { this.data = new MaterialData(type, data); } else { this.data = mat.getNewData(data); } }