001 package org.bukkit.material; 002 003 import org.bukkit.Material; 004 import org.bukkit.block.BlockFace; 005 006 /** 007 * Simple utility class for attachable MaterialData subclasses 008 */ 009 public abstract class SimpleAttachableMaterialData extends MaterialData implements Attachable { 010 011 /** 012 * 013 * @deprecated Magic value 014 */ 015 @Deprecated 016 public SimpleAttachableMaterialData(int type) { 017 super(type); 018 } 019 020 public SimpleAttachableMaterialData(int type, BlockFace direction) { 021 this(type); 022 setFacingDirection(direction); 023 } 024 025 public SimpleAttachableMaterialData(Material type, BlockFace direction) { 026 this(type); 027 setFacingDirection(direction); 028 } 029 030 public SimpleAttachableMaterialData(Material type) { 031 super(type); 032 } 033 034 /** 035 * 036 * @deprecated Magic value 037 */ 038 @Deprecated 039 public SimpleAttachableMaterialData(int type, byte data) { 040 super(type, data); 041 } 042 043 /** 044 * 045 * @deprecated Magic value 046 */ 047 @Deprecated 048 public SimpleAttachableMaterialData(Material type, byte data) { 049 super(type, data); 050 } 051 052 public BlockFace getFacing() { 053 BlockFace attachedFace = getAttachedFace(); 054 return attachedFace == null ? null : attachedFace.getOppositeFace(); 055 } 056 057 @Override 058 public String toString() { 059 return super.toString() + " facing " + getFacing(); 060 } 061 062 @Override 063 public SimpleAttachableMaterialData clone() { 064 return (SimpleAttachableMaterialData) super.clone(); 065 } 066 }