mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Store Quantum Entangleporter frequency (name and public/private only) in the itemstack when dismantled. Displayed in the sneak key info tooltip.
This commit is contained in:
1 parent
7b3f4e8e2a
commit
81e56b207c
3 files changed
+65
-3
No files matched your search
@@ -13,6 +13,8 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Frequency
|
||||
{
|
||||
public static final String TELEPORTER = "Teleporter";
|
||||
@@ -147,4 +149,36 @@ public class Frequency
|
||||
return obj instanceof Frequency && ((Frequency)obj).name.equals(name)
|
||||
&& ((Frequency)obj).ownerUUID.equals(ownerUUID) && ((Frequency)obj).publicFreq == publicFreq;
|
||||
}
|
||||
|
||||
public Identity getIdentity(){
|
||||
return new Identity(this.name, this.publicFreq);
|
||||
}
|
||||
|
||||
public static class Identity {
|
||||
public String name;
|
||||
public boolean publicFreq;
|
||||
|
||||
private Identity(String name, boolean publicFreq)
|
||||
{
|
||||
this.name = name;
|
||||
this.publicFreq = publicFreq;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Identity load(NBTTagCompound data)
|
||||
{
|
||||
if (!data.getString("name").isEmpty()){
|
||||
return new Identity(data.getString("name"), data.getBoolean("publicFreq"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NBTTagCompound serialise()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("name", this.name);
|
||||
tag.setBoolean("publicFreq", this.publicFreq);
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user