mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Added full tile entity data support for all block types that use it, including chests, dispensers, furnaces, mob spawners, and note blocks.
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
ed4548f6e5
commit
b880bd518f
7 changed files with 162 additions and 1 deletions
9
paper-api/src/main/java/org/bukkit/block/Chest.java
Normal file
9
paper-api/src/main/java/org/bukkit/block/Chest.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a chest.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface Chest extends BlockState, ContainerBlock {
|
||||
}
|
17
paper-api/src/main/java/org/bukkit/block/ContainerBlock.java
Normal file
17
paper-api/src/main/java/org/bukkit/block/ContainerBlock.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Indicates a block type that has inventory.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface ContainerBlock {
|
||||
/**
|
||||
* Get the block's inventory.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Inventory getInventory();
|
||||
}
|
9
paper-api/src/main/java/org/bukkit/block/Dispenser.java
Normal file
9
paper-api/src/main/java/org/bukkit/block/Dispenser.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a dispenser.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface Dispenser extends BlockState, ContainerBlock {
|
||||
}
|
36
paper-api/src/main/java/org/bukkit/block/Furnace.java
Normal file
36
paper-api/src/main/java/org/bukkit/block/Furnace.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a furnace.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface Furnace extends BlockState, ContainerBlock {
|
||||
/**
|
||||
* Get burn time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public short getBurnTime();
|
||||
|
||||
/**
|
||||
* Set burn time.
|
||||
*
|
||||
* @param burnTime
|
||||
*/
|
||||
public void setBurnTime(short burnTime);
|
||||
|
||||
/**
|
||||
* Get cook time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public short getCookTime();
|
||||
|
||||
/**
|
||||
* Set cook time.
|
||||
*
|
||||
* @param cookTime
|
||||
*/
|
||||
public void setCookTime(short cookTime);
|
||||
}
|
52
paper-api/src/main/java/org/bukkit/block/MobSpawner.java
Normal file
52
paper-api/src/main/java/org/bukkit/block/MobSpawner.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
import org.bukkit.entity.MobType;
|
||||
|
||||
/**
|
||||
* Represents a mob spawner.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface MobSpawner extends BlockState {
|
||||
/**
|
||||
* Get the spawner's mob type.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MobType getMobType();
|
||||
|
||||
/**
|
||||
* Set the spawner mob type.
|
||||
*
|
||||
* @param mobType
|
||||
*/
|
||||
public void setMobType(MobType mobType);
|
||||
|
||||
/**
|
||||
* Get the spawner's mob type.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getMobTypeId();
|
||||
|
||||
/**
|
||||
* Set the spawner mob type.
|
||||
*
|
||||
* @param mobType
|
||||
*/
|
||||
public void setMobTypeId(String mobType);
|
||||
|
||||
/**
|
||||
* Get the spawner's delay.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getDelay();
|
||||
|
||||
/**
|
||||
* Set the spawner's delay.
|
||||
*
|
||||
* @param delay
|
||||
*/
|
||||
public void setDelay(int delay);
|
||||
}
|
22
paper-api/src/main/java/org/bukkit/block/NoteBlock.java
Normal file
22
paper-api/src/main/java/org/bukkit/block/NoteBlock.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a note.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface NoteBlock extends BlockState {
|
||||
/**
|
||||
* Gets the note.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public byte getNote();
|
||||
|
||||
/**
|
||||
* Set the note.
|
||||
*
|
||||
* @param note
|
||||
*/
|
||||
public void setNote(byte note);
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
package org.bukkit.entity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum MobType {
|
||||
CHICKEN("Chicken"),
|
||||
COW("Cow"),
|
||||
|
@ -13,6 +17,15 @@ public enum MobType {
|
|||
ZOMBIE("Zombie");
|
||||
|
||||
private String name;
|
||||
|
||||
private static final Map<String, MobType> mapping
|
||||
= new HashMap<String, MobType>();
|
||||
|
||||
static {
|
||||
for (MobType type : EnumSet.allOf(MobType.class)) {
|
||||
mapping.put(type.name, type);
|
||||
}
|
||||
}
|
||||
|
||||
private MobType(String name) {
|
||||
this.name = name;
|
||||
|
@ -21,5 +34,8 @@ public enum MobType {
|
|||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public static MobType fromName(String name) {
|
||||
return mapping.get(name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue