예제 #1
0
 /**
  * Adds the glow.
  *
  * @param item the item
  * @return the item stack
  */
 public static ItemStack addGlow(ItemStack item) {
   net.minecraft.server.v1_4_5.ItemStack nmsStack = null;
   CraftItemStack craftStack = null;
   if (item instanceof CraftItemStack) {
     craftStack = (CraftItemStack) item;
     nmsStack = craftStack.getHandle();
   } else {
     craftStack = new CraftItemStack(item);
     nmsStack = craftStack.getHandle();
   }
   NBTTagCompound tag = null;
   if (!nmsStack.hasTag()) {
     tag = new NBTTagCompound();
     nmsStack.setTag(tag);
   }
   if (tag == null) tag = nmsStack.getTag();
   NBTTagList ench = new NBTTagList();
   tag.set("ench", ench);
   nmsStack.setTag(tag);
   return craftStack;
 }
예제 #2
0
 /**
  * Removes the glow.
  *
  * @param item the item
  * @return the item stack
  */
 public static ItemStack removeGlow(ItemStack item) {
   net.minecraft.server.v1_4_5.ItemStack nmsStack = null;
   CraftItemStack craftStack = null;
   if (item instanceof CraftItemStack) {
     craftStack = (CraftItemStack) item;
     nmsStack = craftStack.getHandle();
   } else {
     craftStack = new CraftItemStack(item);
     nmsStack = craftStack.getHandle();
   }
   NBTTagCompound tag = null;
   if (!nmsStack.hasTag()) return item;
   tag = nmsStack.getTag();
   tag.remove("ench");
   nmsStack.setTag(tag);
   return craftStack;
 }