mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
added MaterialData classes and associated Enums for COAL, CROPS, LOG, LEAVES, STEP, and DOUBLE_STEP
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
44
paper-api/src/main/java/org/bukkit/material/Coal.java
Normal file
44
paper-api/src/main/java/org/bukkit/material/Coal.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.CoalType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents the different types of coals.
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Coal extends MaterialData {
|
||||
public Coal(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Coal(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Coal(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Coal(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public void setSpecies(CoalType type) {
|
||||
setData(type.getData());
|
||||
}
|
||||
}
|
44
paper-api/src/main/java/org/bukkit/material/Crops.java
Normal file
44
paper-api/src/main/java/org/bukkit/material/Crops.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents the different types of crops.
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Crops extends MaterialData {
|
||||
public Crops(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Crops(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Crops(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Crops(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current growth state of this crop
|
||||
*
|
||||
* @return CropState of this leave
|
||||
*/
|
||||
public CropState getSpecies() {
|
||||
return CropState.getByData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the growth state of this crop
|
||||
*
|
||||
* @param state New growth state of this crop
|
||||
*/
|
||||
public void setSpecies(CropState state) {
|
||||
setData(state.getData());
|
||||
}
|
||||
}
|
44
paper-api/src/main/java/org/bukkit/material/Leaves.java
Normal file
44
paper-api/src/main/java/org/bukkit/material/Leaves.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
|
||||
/**
|
||||
* Represents the different types of leaves.
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Leaves extends MaterialData {
|
||||
public Leaves(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Leaves(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Leaves(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Leaves(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current species of this leave
|
||||
*
|
||||
* @return TreeSpecies of this leave
|
||||
*/
|
||||
public TreeSpecies getSpecies() {
|
||||
return TreeSpecies.getByData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the species of this leave
|
||||
*
|
||||
* @param species New species of this leave
|
||||
*/
|
||||
public void setSpecies(TreeSpecies species) {
|
||||
setData(species.getData());
|
||||
}
|
||||
}
|
63
paper-api/src/main/java/org/bukkit/material/Step.java
Normal file
63
paper-api/src/main/java/org/bukkit/material/Step.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents the different types of steps.
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Step extends MaterialData {
|
||||
public Step(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Step(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Step(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Step(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current Material this step is made of
|
||||
*
|
||||
* @return Material of this step
|
||||
*/
|
||||
public Material getMaterial() {
|
||||
switch ((int) getData()) {
|
||||
case 1:
|
||||
return Material.SANDSTONE;
|
||||
case 2:
|
||||
return Material.WOOD;
|
||||
case 3:
|
||||
return Material.COBBLESTONE;
|
||||
case 0:
|
||||
default:
|
||||
return Material.STONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the material this step is made of
|
||||
*
|
||||
* @param material New material of this step
|
||||
*/
|
||||
public void setMaterial(Material material) {
|
||||
switch (material) {
|
||||
case SANDSTONE:
|
||||
setData((byte) 0x1);
|
||||
case WOOD:
|
||||
setData((byte) 0x2);
|
||||
case COBBLESTONE:
|
||||
setData((byte) 0x3);
|
||||
case STONE:
|
||||
default:
|
||||
setData((byte) 0x0);
|
||||
}
|
||||
}
|
||||
}
|
44
paper-api/src/main/java/org/bukkit/material/Tree.java
Normal file
44
paper-api/src/main/java/org/bukkit/material/Tree.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
|
||||
/**
|
||||
* Represents the different types of Trees.
|
||||
* @author sunkid
|
||||
*/
|
||||
public class Tree extends MaterialData {
|
||||
public Tree(final int type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Tree(final Material type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public Tree(final int type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
public Tree(final Material type, final byte data) {
|
||||
super(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current species of this tree
|
||||
*
|
||||
* @return TreeSpecies of this tree
|
||||
*/
|
||||
public TreeSpecies getSpecies() {
|
||||
return TreeSpecies.getByData(getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the species of this tree
|
||||
*
|
||||
* @param species New species of this tree
|
||||
*/
|
||||
public void setSpecies(TreeSpecies species) {
|
||||
setData(species.getData());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user