use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld in project Wizardry by TeamWizardry.
the class PacketSyncWizardryWorld method handle.
@Override
public void handle(@NotNull MessageContext ctx) {
if (ctx.side.isServer())
return;
World world = LibrarianLib.PROXY.getClientPlayer().world;
if (world == null)
return;
WizardryWorld cap = WizardryWorldCapability.get(world);
if (cap != null) {
cap.deserializeNBT(compound);
}
}
use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld in project Wizardry by TeamWizardry.
the class ModuleInstance method castSpell.
/**
* Use this to run the module properly.
*
* @param data The spellData associated with it.
* @param ring The SpellRing made with this.
* @return If the spellData has succeeded.
*/
public final boolean castSpell(@Nonnull World world, @Nonnull SpellData data, @Nonnull SpellRing ring) {
if (world.isRemote)
return true;
boolean success;
boolean ranOnce = false;
NBTTagList list = data.getDataWithFallback(SpellData.DefaultKeys.TAG_LIST, new NBTTagList());
for (NBTBase base : list) {
if (base instanceof NBTTagString) {
if (((NBTTagString) base).getString().equals(ring.getUniqueID().toString())) {
ranOnce = true;
break;
}
}
}
if (moduleClass instanceof ILingeringModule && !ranOnce) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
list.appendTag(new NBTTagString(ring.getUniqueID().toString()));
data.addData(SpellData.DefaultKeys.TAG_LIST, list);
success = internalCastSpell(world, data, ring) && ((ILingeringModule) moduleClass).runOnStart(world, data, ring);
if (success) {
worldCap.getSpellObjectManager().addLingering(new SpellObjectManager.LingeringObject(world, data, ring), ((ILingeringModule) moduleClass).getLingeringTime(world, data, ring));
}
} else {
success = internalCastSpell(world, data, ring);
}
if (success || ignoreResultsForRendering()) {
sendRenderPacket(world, data, ring);
}
return success;
}
use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld in project Wizardry by TeamWizardry.
the class IDelayedModule method addDelayedSpell.
default void addDelayedSpell(@Nonnull World world, SpellRing spellRing, SpellData data, int expiry) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
worldCap.getSpellObjectManager().addDelayed(new SpellObjectManager.DelayedObject(world, data, spellRing), expiry);
}
use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld 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.api.capability.world.WizardryWorld 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;
}
Aggregations