initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
50
java/src/game/tileentity/TileEntityLockable.java
Executable file
50
java/src/game/tileentity/TileEntityLockable.java
Executable file
|
@ -0,0 +1,50 @@
|
|||
package game.tileentity;
|
||||
|
||||
import game.nbt.NBTTagCompound;
|
||||
|
||||
public abstract class TileEntityLockable extends TileEntity implements IInteractionObject, ILockableContainer
|
||||
{
|
||||
private LockCode code = LockCode.EMPTY_CODE;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.readFromNBT(compound);
|
||||
this.code = LockCode.fromNBT(compound);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound)
|
||||
{
|
||||
super.writeToNBT(compound);
|
||||
|
||||
if (this.code != null)
|
||||
{
|
||||
this.code.toNBT(compound);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
public LockCode getLockCode()
|
||||
{
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setLockCode(LockCode code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
public abstract boolean hasCustomName();
|
||||
|
||||
/**
|
||||
* Get the formatted ChatComponent that will be used for the sender's username in chat
|
||||
*/
|
||||
public String getCommandName()
|
||||
{
|
||||
return this.getName(); // (TextComponent)(this.hasCustomName() ? new TextComponent(this.getName()) : new TextComponent(this.getName()));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue