MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / getNewData

Method getNewData

src/main/java/org/bukkit/Material.java:319–343  ·  view source on GitHub ↗

Constructs a new MaterialData relevant for this Material, with the given initial data @param raw Initial data to construct the MaterialData with @return New MaterialData with the given data

(final byte raw)

Source from the content-addressed store, hash-verified

317 * @return New MaterialData with the given data
318 */
319 public MaterialData getNewData(final byte raw) {
320 if (data == null) {
321 return new MaterialData(id, raw);
322 }
323
324 try {
325 Constructor<? extends MaterialData> ctor = data.getConstructor(int.class, byte.class);
326
327 return ctor.newInstance(id, raw);
328 } catch (InstantiationException ex) {
329 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
330 } catch (IllegalAccessException ex) {
331 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
332 } catch (IllegalArgumentException ex) {
333 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
334 } catch (InvocationTargetException ex) {
335 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
336 } catch (NoSuchMethodException ex) {
337 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
338 } catch (SecurityException ex) {
339 Logger.getLogger(Material.class.getName()).log(Level.SEVERE, null, ex);
340 }
341
342 return null;
343 }
344
345 /**
346 * Checks if this Material is a placable block

Callers 6

createDataMethod · 0.95
addIngredientMethod · 0.80
setIngredientMethod · 0.80
FurnaceRecipeMethod · 0.80
setInputMethod · 0.80
getDataMethod · 0.80

Calls 3

getConstructorMethod · 0.80
getLoggerMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected