use of com.teamwizardry.wizardry.common.core.nemez.NemezTracker in project Wizardry by TeamWizardry.
the class StandardWizardryWorld method deserializeNBT.
@Override
public void deserializeNBT(NBTTagCompound compound) {
if (compound.hasKey("spell_object_manager")) {
spellObjectManager = new SpellObjectManager();
spellObjectManager.manager.fromNbt(compound.getCompoundTag("spell_object_manager"));
}
if (compound.hasKey("drives")) {
NBTTagList driveNBT = compound.getTagList("drives", Constants.NBT.TAG_COMPOUND);
for (NBTBase base : driveNBT) {
if (base instanceof NBTTagCompound) {
if (((NBTTagCompound) base).hasKey("pos") && ((NBTTagCompound) base).hasKey("drive")) {
BlockPos pos = BlockPos.fromLong(((NBTTagCompound) base).getLong("pos"));
NemezTracker tracker = new NemezTracker();
tracker.deserializeNBT(((NBTTagCompound) base).getTagList("drive", Constants.NBT.TAG_COMPOUND));
blockNemezDrives.put(pos, tracker);
}
}
}
}
}
use of com.teamwizardry.wizardry.common.core.nemez.NemezTracker in project Wizardry by TeamWizardry.
the class StandardWizardryWorld method serializeNBT.
@Override
public NBTTagCompound serializeNBT() {
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("spell_object_manager", spellObjectManager.manager.toNbt());
NBTTagList driveNBT = new NBTTagList();
for (Map.Entry<BlockPos, NemezTracker> entry : blockNemezDrives.entrySet()) {
if (entry == null)
continue;
NBTTagCompound compound1 = new NBTTagCompound();
compound1.setLong("pos", entry.getKey().toLong());
compound1.setTag("drive", entry.getValue().serializeNBT());
driveNBT.appendTag(compound1);
}
compound.setTag("drives", driveNBT);
return compound;
}
use of com.teamwizardry.wizardry.common.core.nemez.NemezTracker in project Wizardry by TeamWizardry.
the class WizardryNemezManager method getOrCreateNemezDrive.
public static NemezTracker getOrCreateNemezDrive(World world, BlockPos pos) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
HashMap<BlockPos, NemezTracker> nemezDrives = worldCap.getBlockNemezDrives();
if (nemezDrives.containsKey(pos))
return nemezDrives.get(pos);
return worldCap.addNemezDrive(pos, new NemezTracker());
}
use of com.teamwizardry.wizardry.common.core.nemez.NemezTracker in project Wizardry by TeamWizardry.
the class WizardryNemezManager method getAndRemoveNemezDrive.
@Nullable
public static NemezTracker getAndRemoveNemezDrive(World world, Entity entity) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
if (worldCap.getEntityNemezDrives().containsKey(entity.getUniqueID())) {
NemezTracker tracker = worldCap.getEntityNemezDrives().get(entity.getUniqueID());
worldCap.removeNemezDrive(entity.getUniqueID());
return tracker;
}
return null;
}
use of com.teamwizardry.wizardry.common.core.nemez.NemezTracker in project Wizardry by TeamWizardry.
the class WizardryNemezManager method getOrCreateNemezDrive.
public static NemezTracker getOrCreateNemezDrive(World world, UUID uuid) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
HashMap<UUID, NemezTracker> nemezDrives = worldCap.getEntityNemezDrives();
if (nemezDrives.containsKey(uuid))
return nemezDrives.get(uuid);
return worldCap.addNemezDrive(uuid, new NemezTracker());
}
Aggregations