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, Entity entity) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
HashMap<UUID, NemezTracker> nemezDrives = worldCap.getEntityNemezDrives();
if (nemezDrives.containsKey(entity.getUniqueID()))
return nemezDrives.get(entity.getUniqueID());
return worldCap.addNemezDrive(entity.getUniqueID(), 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, UUID uuid) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
if (worldCap.getEntityNemezDrives().containsKey(uuid)) {
NemezTracker tracker = worldCap.getEntityNemezDrives().get(uuid);
worldCap.removeNemezDrive(uuid);
return tracker;
}
return null;
}
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, BlockPos pos) {
WizardryWorld worldCap = WizardryWorldCapability.get(world);
if (worldCap.getBlockNemezDrives().containsKey(pos)) {
NemezTracker tracker = worldCap.getBlockNemezDrives().get(pos);
worldCap.removeNemezDrive(pos);
return tracker;
}
return null;
}
use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld in project Wizardry by TeamWizardry.
the class SpellTicker method tick.
@SubscribeEvent
public static void tick(TickEvent.WorldTickEvent event) {
if (event.world.isRemote)
return;
if (event.phase != TickEvent.Phase.END)
return;
World world = event.world;
WizardryWorld worldCap = WizardryWorldCapability.get(world);
if (worldCap == null)
return;
// PacketHandler.NETWORK.sendToDimension(new PacketSyncWizardryWorld(worldCap.serializeNBT()), world.provider.getDimension())
worldCap.getSpellObjectManager().tick(onChange -> {
});
}
use of com.teamwizardry.wizardry.api.capability.world.WizardryWorld in project Wizardry by TeamWizardry.
the class ModuleEffectBackup method run.
@Override
public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
if (world.isRemote)
return true;
Vec3d targetPos = spell.getTarget(world);
EnumFacing facing = spell.getData(FACE_HIT);
Entity caster = spell.getCaster(world);
double duration = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 20;
if (!spellRing.taxCaster(world, spell, true))
return false;
if (targetPos == null)
return true;
if (!(caster instanceof EntityLivingBase))
return true;
if (facing != null && !world.isAirBlock(new BlockPos(targetPos))) {
targetPos = new Vec3d(new BlockPos(targetPos).offset(facing)).add(0.5, 0.5, 0.5);
}
UUID player = caster.getUniqueID();
WizardryWorld world1 = WizardryWorldCapability.get(world);
if (world1 == null)
return true;
if (world1.getBackupCount(player) < ConfigValues.maxZombies) {
EntityBackupZombie zombie = new EntityBackupZombie(world, (EntityLivingBase) caster, (int) duration);
zombie.setPosition(targetPos.x, targetPos.y, targetPos.z);
zombie.forceSpawn = true;
world.spawnEntity(zombie);
world1.incBackupCount(player);
}
return true;
}
Aggregations