001/* 002 * Trident - A Multithreaded Server Alternative 003 * Copyright 2014 The TridentSDK Team 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package net.tridentsdk.meta.item; 018 019import java.util.Set; 020 021import net.tridentsdk.meta.nbt.NBTSerializable; 022 023/** 024 * This type represents additional metadata attached to an Item. 025 */ 026public interface ItemMeta extends NBTSerializable { 027 028 public static enum HiddenModifierFlag { 029 030 /** 031 * Flag representing enchantments being hidden. 032 */ 033 ENCHANTMENTS, 034 /** 035 * Flag representing attributes being hidden. 036 */ 037 ATTRIBUTES, 038 /** 039 * Flag representing the 'Unbreakable' NBT Tag on items with Durability. 040 */ 041 UNBREAKABLE, 042 /** 043 * Flag representing the 'CanDestroy' NBT Tag on tools. 044 */ 045 CAN_DESTROY, 046 /** 047 * Flag representing the 'CanPlaceOn' NBT Tag on blocks. 048 */ 049 CAN_PLACE_ON, 050 /** 051 * Flag representing any other NBT values (future Minecraft versions). 052 */ 053 OTHER; 054 055 public int modifier() { 056 return (int) Math.pow(2, this.ordinal()); 057 } 058 059 } 060 061 /** 062 * Gets the display flags of this item. If one is in the set, it is hidden 063 * from view in the client. 064 * 065 * @return A Set containing flags. 066 */ 067 Set<HiddenModifierFlag> flags(); 068 069 /** 070 * Sets the display value of a specified flag. 071 * 072 * @param flag 073 * The flag to be set. 074 * @param shown 075 * If true, the client can see the flag's value, otherwise it is 076 * hidden. 077 */ 078 void setFlag(HiddenModifierFlag flag, boolean shown); 079 080 /** 081 * Gets the display properties of this item 082 * 083 * @return Display properties of this item 084 */ 085 ItemDisplayProperties displayProperties(); 086 087 /** 088 * Sets the display properties of this item 089 * 090 * @param properties 091 * the new display properties 092 */ 093 void setDisplayProperties(ItemDisplayProperties properties); 094}