001 package org.bukkit.material; 002 003 import org.bukkit.Material; 004 import org.bukkit.block.BlockFace; 005 006 /** 007 * This is the superclass for the {@link DetectorRail} and {@link PoweredRail} 008 * classes 009 */ 010 public class ExtendedRails extends Rails { 011 /** 012 * 013 * @deprecated Magic value 014 */ 015 @Deprecated 016 public ExtendedRails(final int type) { 017 super(type); 018 } 019 020 public ExtendedRails(final Material type) { 021 super(type); 022 } 023 024 /** 025 * 026 * @deprecated Magic value 027 */ 028 @Deprecated 029 public ExtendedRails(final int type, final byte data) { 030 super(type, data); 031 } 032 033 /** 034 * 035 * @deprecated Magic value 036 */ 037 @Deprecated 038 public ExtendedRails(final Material type, final byte data) { 039 super(type, data); 040 } 041 042 @Override 043 public boolean isCurve() { 044 return false; 045 } 046 047 /** 048 * 049 * @deprecated Magic value 050 */ 051 @Deprecated 052 @Override 053 protected byte getConvertedData() { 054 return (byte) (getData() & 0x7); 055 } 056 057 @Override 058 public void setDirection(BlockFace face, boolean isOnSlope) { 059 boolean extraBitSet = (getData() & 0x8) == 0x8; 060 061 if (face != BlockFace.WEST && face != BlockFace.EAST && face != BlockFace.NORTH && face != BlockFace.SOUTH) { 062 throw new IllegalArgumentException("Detector rails and powered rails cannot be set on a curve!"); 063 } 064 065 super.setDirection(face, isOnSlope); 066 setData((byte) (extraBitSet ? (getData() | 0x8) : (getData() & ~0x8))); 067 } 068 069 @Override 070 public ExtendedRails clone() { 071 return (ExtendedRails) super.clone(); 072 } 073 }