001 package org.bukkit.material; 002 003 import org.bukkit.Material; 004 import org.bukkit.NetherWartsState; 005 006 /** 007 * Represents nether wart 008 */ 009 public class NetherWarts extends MaterialData { 010 public NetherWarts() { 011 super(Material.NETHER_WARTS); 012 } 013 014 public NetherWarts(NetherWartsState state) { 015 this(); 016 setState(state); 017 } 018 019 /** 020 * 021 * @deprecated Magic value 022 */ 023 @Deprecated 024 public NetherWarts(final int type) { 025 super(type); 026 } 027 028 public NetherWarts(final Material type) { 029 super (type); 030 } 031 032 /** 033 * 034 * @deprecated Magic value 035 */ 036 @Deprecated 037 public NetherWarts(final int type, final byte data) { 038 super(type, data); 039 } 040 041 /** 042 * 043 * @deprecated Magic value 044 */ 045 @Deprecated 046 public NetherWarts(final Material type, final byte data) { 047 super(type, data); 048 } 049 050 /** 051 * Gets the current growth state of this nether wart 052 * 053 * @return NetherWartsState of this nether wart 054 */ 055 public NetherWartsState getState() { 056 switch (getData()) { 057 case 0: 058 return NetherWartsState.SEEDED; 059 case 1: 060 return NetherWartsState.STAGE_ONE; 061 case 2: 062 return NetherWartsState.STAGE_TWO; 063 default: 064 return NetherWartsState.RIPE; 065 } 066 } 067 068 /** 069 * Sets the growth state of this nether wart 070 * 071 * @param state New growth state of this nether wart 072 */ 073 public void setState(NetherWartsState state) { 074 switch (state) { 075 case SEEDED: 076 setData((byte) 0x0); 077 return; 078 case STAGE_ONE: 079 setData((byte) 0x1); 080 return; 081 case STAGE_TWO: 082 setData((byte) 0x2); 083 return; 084 case RIPE: 085 setData((byte) 0x3); 086 return; 087 } 088 } 089 090 @Override 091 public String toString() { 092 return getState() + " " + super.toString(); 093 } 094 095 @Override 096 public NetherWarts clone() { 097 return (NetherWarts) super.clone(); 098 } 099 }