mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 19:55:52 -07:00
@@ -6,10 +6,11 @@ import org.bukkit.block.BlockFace;
|
||||
* Indicates that a block can be attached to another block
|
||||
*/
|
||||
public interface Attachable extends Directional {
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace();
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace();
|
||||
}
|
||||
|
@@ -5,18 +5,18 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* Represents a bed.
|
||||
*
|
||||
*
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Bed extends MaterialData implements Directional {
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor for a bed.
|
||||
*/
|
||||
public Bed() {
|
||||
super(Material.BED_BLOCK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a bed facing in a particular direction.
|
||||
* @param direction the direction the bed's head is facing
|
||||
@@ -25,7 +25,7 @@ public class Bed extends MaterialData implements Directional {
|
||||
this();
|
||||
setFacingDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
public Bed(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class Bed extends MaterialData implements Directional {
|
||||
|
||||
/**
|
||||
* Determine if this block represents the head of the bed
|
||||
*
|
||||
*
|
||||
* @return true if this is the head of the bed, false if it is the foot
|
||||
*/
|
||||
public boolean isHeadOfBed() {
|
||||
@@ -57,16 +57,20 @@ public class Bed extends MaterialData implements Directional {
|
||||
*/
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case WEST:
|
||||
data = 0x0;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
default:
|
||||
data = 0x3;
|
||||
@@ -81,24 +85,28 @@ public class Bed extends MaterialData implements Directional {
|
||||
|
||||
/**
|
||||
* Get the direction that this bed's head is facing toward
|
||||
*
|
||||
*
|
||||
* @return the direction the head of the bed is facing
|
||||
*/
|
||||
public BlockFace getFacing() {
|
||||
byte data = (byte) (getData() & 0x7);
|
||||
|
||||
switch (data) {
|
||||
case 0x0:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x1:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x3:
|
||||
default:
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (isHeadOfBed() ? "HEAD" : "FOOT") + " of " + super.toString() + " facing " + getFacing();
|
||||
|
@@ -10,7 +10,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
public Button() {
|
||||
super(Material.STONE_BUTTON);
|
||||
}
|
||||
|
||||
|
||||
public Button(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
/**
|
||||
* Gets the current state of this Material, indicating if it's powered or
|
||||
* unpowered
|
||||
*
|
||||
*
|
||||
* @return true if powered, otherwise false
|
||||
*/
|
||||
public boolean isPowered() {
|
||||
@@ -39,7 +39,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
|
||||
/**
|
||||
* Sets the current state of this button
|
||||
*
|
||||
*
|
||||
* @param bool
|
||||
* whether or not the button is powered
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace() {
|
||||
@@ -58,10 +58,13 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
switch (data) {
|
||||
case 0x1:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.WEST;
|
||||
}
|
||||
@@ -79,12 +82,15 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
case SOUTH:
|
||||
data |= 0x1;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data |= 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data |= 0x3;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data |= 0x4;
|
||||
break;
|
||||
@@ -92,10 +98,9 @@ public class Button extends SimpleAttachableMaterialData implements Redstone {
|
||||
|
||||
setData(data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ public class Cake extends MaterialData {
|
||||
|
||||
/**
|
||||
* Gets the number of slices eaten from this cake
|
||||
*
|
||||
*
|
||||
* @return The number of slices eaten
|
||||
*/
|
||||
public int getSlicesEaten() {
|
||||
@@ -34,7 +34,7 @@ public class Cake extends MaterialData {
|
||||
|
||||
/**
|
||||
* Gets the number of slices remaining on this cake
|
||||
*
|
||||
*
|
||||
* @return The number of slices remaining
|
||||
*/
|
||||
public int getSlicesRemaining() {
|
||||
@@ -43,7 +43,7 @@ public class Cake extends MaterialData {
|
||||
|
||||
/**
|
||||
* Sets the number of slices eaten from this cake
|
||||
*
|
||||
*
|
||||
* @param n The number of slices eaten
|
||||
*/
|
||||
public void setSlicesEaten(int n) {
|
||||
@@ -54,17 +54,18 @@ public class Cake extends MaterialData {
|
||||
|
||||
/**
|
||||
* Sets the number of slices remaining on this cake
|
||||
*
|
||||
*
|
||||
* @param n The number of slices remaining
|
||||
*/
|
||||
public void setSlicesRemaining(int n) {
|
||||
if (n > 6) n = 6;
|
||||
if (n > 6) {
|
||||
n = 6;
|
||||
}
|
||||
setData((byte) (6 - n));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + getSlicesEaten() + "/" + getSlicesRemaining() + " slices eaten/remaining";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,63 +8,62 @@ import org.bukkit.Material;
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Coal extends MaterialData {
|
||||
public Coal() {
|
||||
super(Material.COAL);
|
||||
}
|
||||
|
||||
public Coal(CoalType type) {
|
||||
this();
|
||||
setType(type);
|
||||
}
|
||||
|
||||
public Coal(final int type) {
|
||||
super(type);
|
||||
}
|
||||
public Coal() {
|
||||
super(Material.COAL);
|
||||
}
|
||||
|
||||
public Coal(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
public Coal(CoalType type) {
|
||||
this();
|
||||
setType(type);
|
||||
}
|
||||
|
||||
public Coal(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
public Coal(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Coal(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
public Coal(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current type of this coal
|
||||
*
|
||||
* @return CoalType of this coal
|
||||
*/
|
||||
public CoalType getType() {
|
||||
return CoalType.getByData(getData());
|
||||
}
|
||||
public Coal(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this coal
|
||||
*
|
||||
* @param type New type of this coal
|
||||
* @deprecated use {@link #setType(CoalType)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSpecies(CoalType type) {
|
||||
setType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this coal
|
||||
*
|
||||
* @param type New type of this coal
|
||||
*/
|
||||
public void setType(CoalType type) {
|
||||
setData(type.getData());
|
||||
}
|
||||
public Coal(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getType() + " " + super.toString();
|
||||
}
|
||||
/**
|
||||
* Gets the current type of this coal
|
||||
*
|
||||
* @return CoalType of this coal
|
||||
*/
|
||||
public CoalType getType() {
|
||||
return CoalType.getByData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this coal
|
||||
*
|
||||
* @param type New type of this coal
|
||||
* @deprecated use {@link #setType(CoalType)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSpecies(CoalType type) {
|
||||
setType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this coal
|
||||
*
|
||||
* @param type New type of this coal
|
||||
*/
|
||||
public void setType(CoalType type) {
|
||||
setData(type.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getType() + " " + super.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import org.bukkit.DyeColor;
|
||||
|
||||
/**
|
||||
* An object that can be colored.
|
||||
*
|
||||
*
|
||||
* @author Cogito
|
||||
*
|
||||
*/
|
||||
@@ -12,14 +12,14 @@ public interface Colorable {
|
||||
|
||||
/**
|
||||
* Gets the color of this object.
|
||||
*
|
||||
*
|
||||
* @return The DyeColor of this object.
|
||||
*/
|
||||
public DyeColor getColor();
|
||||
|
||||
/**
|
||||
* Sets the color of this object to the specified DyeColor.
|
||||
*
|
||||
*
|
||||
* @param color The color of the object, as a DyeColor.
|
||||
*/
|
||||
public void setColor(DyeColor color);
|
||||
|
@@ -11,12 +11,12 @@ public class Crops extends MaterialData {
|
||||
public Crops() {
|
||||
super(Material.CROPS);
|
||||
}
|
||||
|
||||
|
||||
public Crops(CropState state) {
|
||||
this();
|
||||
setState(state);
|
||||
}
|
||||
|
||||
|
||||
public Crops(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class Crops extends MaterialData {
|
||||
public CropState getSpecies() {
|
||||
return getState();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current growth state of this crop
|
||||
*
|
||||
@@ -63,7 +63,7 @@ public class Crops extends MaterialData {
|
||||
public void setSpecies(CropState state) {
|
||||
setState(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the growth state of this crop
|
||||
*
|
||||
@@ -72,10 +72,9 @@ public class Crops extends MaterialData {
|
||||
public void setState(CropState state) {
|
||||
setData(state.getData());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getState() + " " + super.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,20 +26,25 @@ public class Diode extends MaterialData implements Directional {
|
||||
|
||||
/**
|
||||
* Sets the delay of the repeater
|
||||
*
|
||||
*
|
||||
* @param delay
|
||||
* The new delay (1-4)
|
||||
*/
|
||||
public void setDelay(int delay) {
|
||||
if (delay > 4) delay = 4;
|
||||
if (delay < 1) delay = 1;
|
||||
if (delay > 4) {
|
||||
delay = 4;
|
||||
}
|
||||
if (delay < 1) {
|
||||
delay = 1;
|
||||
}
|
||||
byte newData = (byte) (getData() & 0x3);
|
||||
|
||||
setData((byte) (newData | ((delay - 1) << 2)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the delay of the repeater in ticks
|
||||
*
|
||||
*
|
||||
* @return The delay (1-4)
|
||||
*/
|
||||
public int getDelay() {
|
||||
@@ -49,16 +54,20 @@ public class Diode extends MaterialData implements Directional {
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
int delay = getDelay();
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case SOUTH:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
default:
|
||||
data = 0x0;
|
||||
@@ -70,19 +79,23 @@ public class Diode extends MaterialData implements Directional {
|
||||
|
||||
public BlockFace getFacing() {
|
||||
byte data = (byte) (getData() & 0x3);
|
||||
|
||||
switch (data) {
|
||||
case 0x0:
|
||||
default:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x1:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing() + " with " + getDelay() + " ticks delay";
|
||||
|
@@ -11,7 +11,7 @@ public interface Directional {
|
||||
|
||||
/**
|
||||
* Gets the direction this block is facing
|
||||
*
|
||||
*
|
||||
* @return the direction this block is facing
|
||||
*/
|
||||
public BlockFace getFacing();
|
||||
|
@@ -5,20 +5,20 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* Represents a dispenser.
|
||||
*
|
||||
*
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Dispenser extends FurnaceAndDispenser {
|
||||
|
||||
|
||||
public Dispenser() {
|
||||
super(Material.DISPENSER);
|
||||
}
|
||||
|
||||
|
||||
public Dispenser(BlockFace direction) {
|
||||
this();
|
||||
setFacingDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
public Dispenser(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
@@ -8,60 +8,60 @@ import org.bukkit.block.BlockFace;
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Door extends MaterialData {
|
||||
public Door() {
|
||||
super(Material.WOODEN_DOOR);
|
||||
}
|
||||
|
||||
public Door(final int type) {
|
||||
super(type);
|
||||
public Door() {
|
||||
super(Material.WOODEN_DOOR);
|
||||
}
|
||||
|
||||
public Door(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Door(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Door(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Door(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the door is open.
|
||||
* @return true if the door has swung counterclockwise around its hinge.
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return ((getData() & 0x4) == 0x4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether this is the top half of the door
|
||||
*/
|
||||
public boolean isTopHalf() {
|
||||
return ((getData() & 0x8) == 0x8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location of the hinges
|
||||
*/
|
||||
public BlockFace getHingeCorner() {
|
||||
byte d = getData();
|
||||
|
||||
if ((d & 0x3) == 0x3) {
|
||||
return BlockFace.NORTH_WEST;
|
||||
} else if ((d & 0x1) == 0x1) {
|
||||
return BlockFace.SOUTH_EAST;
|
||||
} else if ((d & 0x2) == 0x2) {
|
||||
return BlockFace.SOUTH_WEST;
|
||||
}
|
||||
|
||||
public Door(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Door(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Door(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the door is open.
|
||||
* @return true if the door has swung counterclockwise around its hinge.
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return ((getData() & 0x4) == 0x4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether this is the top half of the door
|
||||
*/
|
||||
public boolean isTopHalf() {
|
||||
return ((getData() & 0x8) == 0x8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location of the hinges
|
||||
*/
|
||||
public BlockFace getHingeCorner() {
|
||||
byte d = getData();
|
||||
if ((d & 0x3) == 0x3) {
|
||||
return BlockFace.NORTH_WEST;
|
||||
} else if ((d & 0x1) == 0x1) {
|
||||
return BlockFace.SOUTH_EAST;
|
||||
} else if ((d & 0x2) == 0x2) {
|
||||
return BlockFace.SOUTH_WEST;
|
||||
}
|
||||
|
||||
return BlockFace.NORTH_EAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (isTopHalf() ? "TOP" : "BOTTOM") + " half of " + (isOpen() ? "an OPEN " : "a CLOSED ") + super.toString() + " with hinges " + getHingeCorner();
|
||||
}
|
||||
return BlockFace.NORTH_EAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (isTopHalf() ? "TOP" : "BOTTOM") + " half of " + (isOpen() ? "an OPEN " : "a CLOSED ") + super.toString() + " with hinges " + getHingeCorner();
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -11,7 +10,7 @@ public class Dye extends MaterialData implements Colorable {
|
||||
public Dye() {
|
||||
super(Material.INK_SACK);
|
||||
}
|
||||
|
||||
|
||||
public Dye(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -45,7 +44,7 @@ public class Dye extends MaterialData implements Colorable {
|
||||
public void setColor(DyeColor color) {
|
||||
setData((byte) (15 - color.getData()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getColor() + " DYE(" + getData() + ")";
|
||||
|
@@ -5,15 +5,15 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* Represents a furnace.
|
||||
*
|
||||
*
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Furnace extends FurnaceAndDispenser {
|
||||
|
||||
|
||||
public Furnace() {
|
||||
super(Material.FURNACE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a furnace facing in a particular direction.
|
||||
* @param direction the direction the furnace's "opening" is facing
|
||||
@@ -22,7 +22,7 @@ public class Furnace extends FurnaceAndDispenser {
|
||||
this();
|
||||
setFacingDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
public Furnace(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
@@ -26,16 +26,20 @@ public class FurnaceAndDispenser extends MaterialData implements Directional {
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case EAST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x4;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
default:
|
||||
data = 0x5;
|
||||
@@ -46,19 +50,23 @@ public class FurnaceAndDispenser extends MaterialData implements Directional {
|
||||
|
||||
public BlockFace getFacing() {
|
||||
byte data = getData();
|
||||
|
||||
switch (data) {
|
||||
case 0x2:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x5:
|
||||
default:
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing();
|
||||
|
@@ -10,7 +10,7 @@ public class Jukebox extends MaterialData {
|
||||
recordTypes.add(Material.GOLD_RECORD);
|
||||
recordTypes.add(Material.GREEN_RECORD);
|
||||
}
|
||||
|
||||
|
||||
public Jukebox() {
|
||||
super(Material.JUKEBOX);
|
||||
}
|
||||
@@ -21,8 +21,9 @@ public class Jukebox extends MaterialData {
|
||||
|
||||
public Jukebox(Material type) {
|
||||
super((recordTypes.contains(type)) ? Material.JUKEBOX : type);
|
||||
if(recordTypes.contains(type))
|
||||
if (recordTypes.contains(type)) {
|
||||
setPlaying(type);
|
||||
}
|
||||
}
|
||||
|
||||
public Jukebox(int type, byte data) {
|
||||
@@ -35,7 +36,7 @@ public class Jukebox extends MaterialData {
|
||||
|
||||
/**
|
||||
* Gets the type of record currently playing
|
||||
*
|
||||
*
|
||||
* @return The type of record (Material.GOLD_RECORD or Material.GREEN_RECORD), or null for none.
|
||||
*/
|
||||
public Material getPlaying() {
|
||||
@@ -43,8 +44,10 @@ public class Jukebox extends MaterialData {
|
||||
default:
|
||||
case 0x0:
|
||||
return null;
|
||||
|
||||
case 0x1:
|
||||
return Material.GOLD_RECORD;
|
||||
|
||||
case 0x2:
|
||||
return Material.GREEN_RECORD;
|
||||
}
|
||||
@@ -52,26 +55,30 @@ public class Jukebox extends MaterialData {
|
||||
|
||||
/**
|
||||
* Sets the type of record currently playing
|
||||
*
|
||||
*
|
||||
* @param rec The type of record (Material.GOLD_RECORD or Material.GREEN_RECORD), or null for none.
|
||||
*/
|
||||
public void setPlaying(Material rec) {
|
||||
if (rec == null) setData((byte) 0x0);
|
||||
else switch (rec) {
|
||||
case GOLD_RECORD:
|
||||
setData((byte) 0x1);
|
||||
break;
|
||||
case GREEN_RECORD:
|
||||
setData((byte) 0x2);
|
||||
break;
|
||||
default:
|
||||
if (rec == null) {
|
||||
setData((byte) 0x0);
|
||||
} else {
|
||||
switch (rec) {
|
||||
case GOLD_RECORD:
|
||||
setData((byte) 0x1);
|
||||
break;
|
||||
|
||||
case GREEN_RECORD:
|
||||
setData((byte) 0x2);
|
||||
break;
|
||||
|
||||
default:
|
||||
setData((byte) 0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " playing " + getPlaying();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ public class Ladder extends SimpleAttachableMaterialData {
|
||||
public Ladder() {
|
||||
super(Material.LADDER);
|
||||
}
|
||||
|
||||
|
||||
public Ladder(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class Ladder extends SimpleAttachableMaterialData {
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace() {
|
||||
@@ -38,10 +38,13 @@ public class Ladder extends SimpleAttachableMaterialData {
|
||||
switch (data) {
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x5:
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
@@ -59,12 +62,15 @@ public class Ladder extends SimpleAttachableMaterialData {
|
||||
case WEST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
data = 0x4;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x5;
|
||||
break;
|
||||
@@ -73,4 +79,4 @@ public class Ladder extends SimpleAttachableMaterialData {
|
||||
setData(data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,12 +11,12 @@ public class Leaves extends MaterialData {
|
||||
public Leaves() {
|
||||
super(Material.LEAVES);
|
||||
}
|
||||
|
||||
|
||||
public Leaves(TreeSpecies species) {
|
||||
this();
|
||||
setSpecies(species);
|
||||
}
|
||||
|
||||
|
||||
public Leaves(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class Leaves extends MaterialData {
|
||||
public void setSpecies(TreeSpecies species) {
|
||||
setData(species.getData());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getSpecies() + " " + super.toString();
|
||||
|
@@ -10,7 +10,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
public Lever() {
|
||||
super(Material.LEVER);
|
||||
}
|
||||
|
||||
|
||||
public Lever(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
/**
|
||||
* Gets the current state of this Material, indicating if it's powered or
|
||||
* unpowered
|
||||
*
|
||||
*
|
||||
* @return true if powered, otherwise false
|
||||
*/
|
||||
public boolean isPowered() {
|
||||
@@ -39,7 +39,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace() {
|
||||
@@ -48,12 +48,16 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
switch (data) {
|
||||
case 0x1:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
return BlockFace.DOWN;
|
||||
@@ -74,6 +78,7 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
case EAST:
|
||||
data |= 0x5;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
data |= 0x6;
|
||||
@@ -84,12 +89,15 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
case SOUTH:
|
||||
data |= 0x1;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data |= 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data |= 0x3;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data |= 0x4;
|
||||
break;
|
||||
@@ -97,10 +105,9 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
|
||||
}
|
||||
setData(data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -12,11 +11,11 @@ public class MaterialData {
|
||||
private byte data = 0;
|
||||
|
||||
public MaterialData(final int type) {
|
||||
this(type, (byte)0);
|
||||
this(type, (byte) 0);
|
||||
}
|
||||
|
||||
public MaterialData(final Material type) {
|
||||
this(type, (byte)0);
|
||||
this(type, (byte) 0);
|
||||
}
|
||||
|
||||
public MaterialData(final int type, final byte data) {
|
||||
@@ -81,7 +80,7 @@ public class MaterialData {
|
||||
public ItemStack toItemStack(int amount) {
|
||||
return new ItemStack(type, amount, data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getItemType() + "(" + getData() + ")";
|
||||
|
@@ -34,4 +34,4 @@ public class PressurePlate extends MaterialData implements PressureSensor {
|
||||
public String toString() {
|
||||
return super.toString() + (isPressed() ? " PRESSED" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,15 +5,15 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* Represents a pumpkin.
|
||||
*
|
||||
*
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Pumpkin extends MaterialData implements Directional {
|
||||
|
||||
|
||||
public Pumpkin() {
|
||||
super(Material.PUMPKIN);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a pumpkin facing in a particular direction.
|
||||
* @param direction the direction the pumkin's face is facing
|
||||
@@ -22,7 +22,7 @@ public class Pumpkin extends MaterialData implements Directional {
|
||||
this();
|
||||
setFacingDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
public Pumpkin(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -45,16 +45,20 @@ public class Pumpkin extends MaterialData implements Directional {
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case EAST:
|
||||
data = 0x0;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
default:
|
||||
data = 0x3;
|
||||
@@ -65,19 +69,23 @@ public class Pumpkin extends MaterialData implements Directional {
|
||||
|
||||
public BlockFace getFacing() {
|
||||
byte data = getData();
|
||||
|
||||
switch (data) {
|
||||
case 0x0:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x1:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x3:
|
||||
default:
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing() + " " + (isLit() ? "" : "NOT ") + "LIT";
|
||||
|
@@ -33,6 +33,7 @@ public class Rails extends MaterialData {
|
||||
*/
|
||||
public boolean isOnSlope() {
|
||||
byte d = getConvertedData();
|
||||
|
||||
return (d == 0x2 || d == 0x3 || d == 0x4 || d == 0x5);
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ public class Rails extends MaterialData {
|
||||
*/
|
||||
public boolean isCurve() {
|
||||
byte d = getConvertedData();
|
||||
|
||||
return (d == 0x6 || d == 0x7 || d == 0x8 || d == 0x9);
|
||||
}
|
||||
|
||||
@@ -53,26 +55,36 @@ public class Rails extends MaterialData {
|
||||
*/
|
||||
public BlockFace getDirection() {
|
||||
byte d = getConvertedData();
|
||||
|
||||
switch (d) {
|
||||
case 0x0:
|
||||
default:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x1:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x5:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x6:
|
||||
return BlockFace.NORTH_EAST;
|
||||
|
||||
case 0x7:
|
||||
return BlockFace.SOUTH_EAST;
|
||||
|
||||
case 0x8:
|
||||
return BlockFace.SOUTH_WEST;
|
||||
|
||||
case 0x9:
|
||||
return BlockFace.NORTH_WEST;
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
/**
|
||||
* Indicated a Material that may carry or create a Redstone current
|
||||
*/
|
||||
public interface Redstone {
|
||||
|
||||
/**
|
||||
* Gets the current state of this Material, indicating if it's powered or
|
||||
* unpowered
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@@ -10,7 +9,7 @@ public class RedstoneTorch extends Torch implements Redstone {
|
||||
public RedstoneTorch() {
|
||||
super(Material.REDSTONE_TORCH_ON);
|
||||
}
|
||||
|
||||
|
||||
public RedstoneTorch(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -36,7 +35,7 @@ public class RedstoneTorch extends Torch implements Redstone {
|
||||
public boolean isPowered() {
|
||||
return getItemType() == Material.REDSTONE_TORCH_ON;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@@ -10,7 +9,7 @@ public class RedstoneWire extends MaterialData implements Redstone {
|
||||
public RedstoneWire() {
|
||||
super(Material.REDSTONE_WIRE);
|
||||
}
|
||||
|
||||
|
||||
public RedstoneWire(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -36,7 +35,7 @@ public class RedstoneWire extends MaterialData implements Redstone {
|
||||
public boolean isPowered() {
|
||||
return getData() > 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
|
||||
|
@@ -10,7 +10,7 @@ public class Sign extends MaterialData implements Attachable {
|
||||
public Sign() {
|
||||
super(Material.SIGN_POST);
|
||||
}
|
||||
|
||||
|
||||
public Sign(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class Sign extends MaterialData implements Attachable {
|
||||
|
||||
/**
|
||||
* Check if this sign is attached to a wall
|
||||
*
|
||||
*
|
||||
* @return true if this sign is attached to a wall, false if set on top of a
|
||||
* block
|
||||
*/
|
||||
@@ -39,7 +39,7 @@ public class Sign extends MaterialData implements Attachable {
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace() {
|
||||
@@ -49,10 +49,13 @@ public class Sign extends MaterialData implements Attachable {
|
||||
switch (data) {
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x5:
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
@@ -65,7 +68,7 @@ public class Sign extends MaterialData implements Attachable {
|
||||
|
||||
/**
|
||||
* Gets the direction that this sign is currently facing
|
||||
*
|
||||
*
|
||||
* @return BlockFace indicating where this sign is facing
|
||||
*/
|
||||
public BlockFace getFacing() {
|
||||
@@ -76,24 +79,31 @@ public class Sign extends MaterialData implements Attachable {
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
return BlockFace.NORTH_WEST;
|
||||
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
return BlockFace.NORTH_EAST;
|
||||
|
||||
case 0x8:
|
||||
case 0x9:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0xA:
|
||||
case 0xB:
|
||||
return BlockFace.SOUTH_EAST;
|
||||
|
||||
case 0xC:
|
||||
case 0xD:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0xE:
|
||||
case 0xF:
|
||||
return BlockFace.SOUTH_WEST;
|
||||
@@ -107,17 +117,21 @@ public class Sign extends MaterialData implements Attachable {
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
if (isWallSign()) {
|
||||
switch (face) {
|
||||
case EAST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x4;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
default:
|
||||
data = 0x5;
|
||||
@@ -127,24 +141,31 @@ public class Sign extends MaterialData implements Attachable {
|
||||
case WEST:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case NORTH_WEST:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x5;
|
||||
break;
|
||||
|
||||
case NORTH_EAST:
|
||||
data = 0x7;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data = 0x9;
|
||||
break;
|
||||
|
||||
case SOUTH_EAST:
|
||||
data = 0xB;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
data = 0xD;
|
||||
break;
|
||||
|
||||
case SOUTH_WEST:
|
||||
default:
|
||||
data = 0xF;
|
||||
@@ -153,7 +174,7 @@ public class Sign extends MaterialData implements Attachable {
|
||||
|
||||
setData(data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing();
|
||||
|
@@ -13,7 +13,7 @@ public abstract class SimpleAttachableMaterialData extends MaterialData implemen
|
||||
public SimpleAttachableMaterialData(int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
|
||||
public SimpleAttachableMaterialData(int type, BlockFace direction) {
|
||||
this(type);
|
||||
setFacingDirection(direction);
|
||||
@@ -44,5 +44,4 @@ public abstract class SimpleAttachableMaterialData extends MaterialData implemen
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* Represents stairs.
|
||||
*
|
||||
*
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Stairs extends MaterialData implements Directional {
|
||||
@@ -31,14 +31,18 @@ public class Stairs extends MaterialData implements Directional {
|
||||
*/
|
||||
public BlockFace getAscendingDirection() {
|
||||
byte data = getData();
|
||||
|
||||
switch (data) {
|
||||
case 0x0:
|
||||
default:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x1:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
}
|
||||
@@ -56,22 +60,26 @@ public class Stairs extends MaterialData implements Directional {
|
||||
*/
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
default:
|
||||
data = 0x0;
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x3;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
setData(data);
|
||||
}
|
||||
|
||||
@@ -81,10 +89,9 @@ public class Stairs extends MaterialData implements Directional {
|
||||
public BlockFace getFacing() {
|
||||
return getDescendingDirection();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " facing " + getFacing();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,19 +16,20 @@ public class Step extends MaterialData {
|
||||
stepTypes.add(Material.COBBLESTONE);
|
||||
stepTypes.add(Material.STONE);
|
||||
}
|
||||
|
||||
|
||||
public Step() {
|
||||
super(Material.STEP);
|
||||
}
|
||||
|
||||
|
||||
public Step(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Step(final Material type) {
|
||||
super((stepTypes.contains(type)) ? Material.STEP : type);
|
||||
if(stepTypes.contains(type))
|
||||
if (stepTypes.contains(type)) {
|
||||
setMaterial(type);
|
||||
}
|
||||
}
|
||||
|
||||
public Step(final int type, final byte data) {
|
||||
@@ -48,10 +49,13 @@ public class Step extends MaterialData {
|
||||
switch ((int) getData()) {
|
||||
case 1:
|
||||
return Material.SANDSTONE;
|
||||
|
||||
case 2:
|
||||
return Material.WOOD;
|
||||
|
||||
case 3:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return Material.STONE;
|
||||
@@ -68,18 +72,21 @@ public class Step extends MaterialData {
|
||||
case SANDSTONE:
|
||||
setData((byte) 0x1);
|
||||
break;
|
||||
|
||||
case WOOD:
|
||||
setData((byte) 0x2);
|
||||
break;
|
||||
|
||||
case COBBLESTONE:
|
||||
setData((byte) 0x3);
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
default:
|
||||
setData((byte) 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getMaterial() + " " + super.toString();
|
||||
|
@@ -10,7 +10,7 @@ public class Torch extends SimpleAttachableMaterialData {
|
||||
public Torch() {
|
||||
super(Material.TORCH);
|
||||
}
|
||||
|
||||
|
||||
public Torch(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class Torch extends SimpleAttachableMaterialData {
|
||||
|
||||
/**
|
||||
* Gets the face that this block is attached on
|
||||
*
|
||||
*
|
||||
* @return BlockFace attached to
|
||||
*/
|
||||
public BlockFace getAttachedFace() {
|
||||
@@ -38,12 +38,16 @@ public class Torch extends SimpleAttachableMaterialData {
|
||||
switch (data) {
|
||||
case 0x1:
|
||||
return BlockFace.NORTH;
|
||||
|
||||
case 0x2:
|
||||
return BlockFace.SOUTH;
|
||||
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
|
||||
case 0x4:
|
||||
return BlockFace.WEST;
|
||||
|
||||
case 0x5:
|
||||
return BlockFace.DOWN;
|
||||
}
|
||||
@@ -53,19 +57,24 @@ public class Torch extends SimpleAttachableMaterialData {
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data;
|
||||
|
||||
switch (face) {
|
||||
case SOUTH:
|
||||
data = 0x1;
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
data = 0x2;
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
data = 0x3;
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
data = 0x4;
|
||||
break;
|
||||
|
||||
case UP:
|
||||
default:
|
||||
data = 0x5;
|
||||
|
@@ -11,12 +11,12 @@ public class Tree extends MaterialData {
|
||||
public Tree() {
|
||||
super(Material.LOG);
|
||||
}
|
||||
|
||||
|
||||
public Tree(TreeSpecies species) {
|
||||
this();
|
||||
setSpecies(species);
|
||||
}
|
||||
|
||||
|
||||
public Tree(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class Tree extends MaterialData {
|
||||
public void setSpecies(TreeSpecies species) {
|
||||
setData(species.getData());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getSpecies() + " " + super.toString();
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -11,12 +10,12 @@ public class Wool extends MaterialData implements Colorable {
|
||||
public Wool() {
|
||||
super(Material.WOOL);
|
||||
}
|
||||
|
||||
|
||||
public Wool(DyeColor color) {
|
||||
this();
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
|
||||
public Wool(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -50,9 +49,9 @@ public class Wool extends MaterialData implements Colorable {
|
||||
public void setColor(DyeColor color) {
|
||||
setData(color.getData());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getColor() + " " + super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user