Added setters to applicable MaterialData classes.
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* This is the superclass for the {@link DetectorRail} and {@link PoweredRail} classes
|
||||
@ -31,4 +32,16 @@ public class ExtendedRails extends Rails {
|
||||
protected byte getConvertedData() {
|
||||
return (byte) (getData() & 0x7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(BlockFace face, boolean isOnSlope) {
|
||||
boolean extraBitSet = (getData() & 0x8) == 0x8;
|
||||
|
||||
if (face != BlockFace.NORTH && face != BlockFace.SOUTH && face != BlockFace.EAST && face != BlockFace.WEST) {
|
||||
throw new IllegalArgumentException("Detector rails and powered rails cannot be set on a curve!");
|
||||
}
|
||||
|
||||
super.setDirection(face, isOnSlope);
|
||||
setData((byte) (extraBitSet ? (getData() | 0x8) : (getData() & ~0x8)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user