initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
42
java/src/game/tileentity/LockCode.java
Executable file
42
java/src/game/tileentity/LockCode.java
Executable file
|
@ -0,0 +1,42 @@
|
|||
package game.tileentity;
|
||||
|
||||
import game.nbt.NBTTagCompound;
|
||||
|
||||
public class LockCode
|
||||
{
|
||||
public static final LockCode EMPTY_CODE = new LockCode("");
|
||||
private final String lock;
|
||||
|
||||
public LockCode(String code)
|
||||
{
|
||||
this.lock = code;
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return this.lock == null || this.lock.isEmpty();
|
||||
}
|
||||
|
||||
public String getLock()
|
||||
{
|
||||
return this.lock;
|
||||
}
|
||||
|
||||
public void toNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setString("Lock", this.lock);
|
||||
}
|
||||
|
||||
public static LockCode fromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (nbt.hasKey("Lock", 8))
|
||||
{
|
||||
String s = nbt.getString("Lock");
|
||||
return new LockCode(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EMPTY_CODE;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue