CustomStack stack =CustomStack.getInstance("your_item")if(stack !=null){ItemStack itemStack =stack.getItemStack();}else{//no custom item found with that id}
检查自定义物品是否存在
CustomStack.isInRegistry("your_item")
从 Bukkit ItemStack 获取 CustomStack
CustomStack stack =CustomStack.byItemStack(myItemStack);if(stack !=null) // It's a custom item!{stack.setUsages(5) // For example set usages// ...}else// It's not a custom item!{// ...}
CustomBlock customBlock =CustomBlock.byAlreadyPlaced(block);if(customBlock !=null){// Custom block, do your own stuff here}else{// Not a custom block}
放置自定义方块
CustomBlock customBlock =CustomBlock.getInstance("ruby_ore");if(customBlock !=null) //not needed if you're sure the blocks exists.{customBlock.place(location);}else{// Custom block not found in ItemsAdder configurations!}
CustomEntity customEntity =CustomEntity.spawn("your_item", location)if(customEntity !=null){// Custom entity spawned// Example: print the namespaced id in consoleSystem.out.println(customEntity.getNamespacedID());}else{// Custom entity not found in ItemsAdder configurations!}
通过已生成的 Bukkit 实体获取自定义实体
CustomEntity customEntity =CustomEntity.byAlreadySpawned(entity)if(customEntity !=null){// It's a custom entity// Example: print the namespaced id in consoleSystem.out.println(customEntity.getNamespacedID());}else{// This Bukkit entity is not a custom entity!}
CustomMob customMob =CustomMob.spawn("your_item", location)if(customMob !=null){//spawned the custom mob//example, print the display name in consoleSystem.out.println(customMob.getName());}else{//no custom mob found with that id}
通过已生成的生物获取自定义生物
CustomMob customMob =CustomMob.byAlreadySpawned(entity)if(customMob !=null){//it's a custom mob//example, print the display name in consoleSystem.out.println(customMob.getName());}else{//this mob is not a custom mob}