use of com.teamwizardry.wizardry.api.spell.SpellRing in project Wizardry by TeamWizardry.
the class PacketWorktableUpdate method manualSaveSetter.
@SaveMethodGetter(saveName = "manual_saver")
private NBTTagCompound manualSaveSetter() {
NBTTagCompound compound = new NBTTagCompound();
if (components == null || links == null)
return compound;
NBTTagList list = new NBTTagList();
for (Map.Entry<SpellRing, UUID> entrySet : components.entrySet()) {
NBTTagCompound compound1 = new NBTTagCompound();
compound1.setTag("ring", entrySet.getKey().serializeNBT());
compound1.setString("uuid", entrySet.getValue().toString());
list.appendTag(compound1);
}
compound.setTag("components", list);
list = new NBTTagList();
for (Map.Entry<UUID, UUID> entrySet : links.entrySet()) {
NBTTagCompound compound1 = new NBTTagCompound();
compound1.setString("uuid1", entrySet.getKey().toString());
compound1.setString("uuid2", entrySet.getValue().toString());
list.appendTag(compound1);
}
compound.setTag("links", list);
return compound;
}
use of com.teamwizardry.wizardry.api.spell.SpellRing in project Wizardry by TeamWizardry.
the class WorktableGui method sync.
public void sync() {
if (!Minecraft.getMinecraft().world.isBlockLoaded(worktablePos))
return;
IBlockState state = Minecraft.getMinecraft().world.getBlockState(worktablePos);
if (state.getBlock() != ModBlocks.MAGICIANS_WORKTABLE)
return;
TileEntity table = Minecraft.getMinecraft().world.getTileEntity(worktablePos);
if (!(table instanceof TileMagiciansWorktable))
return;
HashMap<SpellRing, UUID> convertComponents = new HashMap<>();
for (Map.Entry<GuiComponent, UUID> entrySet : paperComponents.entrySet()) {
Module module1 = getModule(entrySet.getKey());
if (module1 == null)
continue;
SpellRing ring = new SpellRing(module1);
ring.getInformationTag().setDouble("worktable_x", entrySet.getKey().getPos().getX());
ring.getInformationTag().setDouble("worktable_y", entrySet.getKey().getPos().getY());
convertComponents.put(ring, entrySet.getValue());
}
((TileMagiciansWorktable) table).componentLinks = componentLinks;
((TileMagiciansWorktable) table).paperComponents = convertComponents;
PacketHandler.NETWORK.sendToServer(new PacketWorktableUpdate(Minecraft.getMinecraft().world.provider.getDimension(), worktablePos, convertComponents, componentLinks));
}
use of com.teamwizardry.wizardry.api.spell.SpellRing in project Wizardry by TeamWizardry.
the class EventHandler method fairyAmbush.
@SubscribeEvent
public void fairyAmbush(SpellCastEvent event) {
Entity caster = event.getSpellData().getData(SpellData.DefaultKeys.CASTER);
int chance = 5;
for (SpellRing spellRing : SpellUtils.getAllSpellRings(event.getSpellRing())) if (spellRing instanceof IContinuousModule) {
chance = 1000;
break;
}
if (RandUtil.nextInt(chance) == 0 && caster != null) {
List<EntityFairy> fairyList = event.getSpellData().world.getEntitiesWithinAABB(EntityFairy.class, new AxisAlignedBB(caster.getPosition()).grow(64, 64, 64));
if (fairyList.isEmpty())
return;
EntityFairy fairy = fairyList.get(RandUtil.nextInt(fairyList.size() - 1));
if (fairy == null)
return;
fairy.ambush = true;
}
}
use of com.teamwizardry.wizardry.api.spell.SpellRing in project Wizardry by TeamWizardry.
the class RenderSpellProjectile method doRender.
@Override
public void doRender(@Nonnull EntitySpellProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
if (entity.spellRing != null)
for (SpellRing ring : SpellUtils.getAllSpellRings(entity.spellRing)) {
if (ring.overrideParentRenders()) {
return;
}
}
Color color = new Color(entity.getDataManager().get(DATA_COLOR), true);
Color color2 = new Color(entity.getDataManager().get(DATA_COLOR2), true);
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setAlphaFunction(new InterpFadeInOut(0f, 0.3f));
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.enableMotionCalculation();
glitter.setCollision(true);
glitter.setCanBounce(true);
glitter.setColorFunction(new InterpColorHSV(color, color2));
glitter.setAcceleration(new Vec3d(0, -0.015, 0));
ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector().add(new Vec3d(entity.motionX, entity.motionY, entity.motionZ))), 5, 0, (aFloat, particleBuilder) -> {
particleBuilder.setScaleFunction(new InterpScale((float) RandUtil.nextDouble(0.3, 0.8), 0));
particleBuilder.setLifetime(RandUtil.nextInt(40, 60));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.03, 0.03), RandUtil.nextDouble(-0.01, 0.05), RandUtil.nextDouble(-0.03, 0.03)));
});
glitter.disableMotionCalculation();
glitter.setMotion(Vec3d.ZERO);
glitter.setLifetime(20);
glitter.setScaleFunction(new InterpFadeInOut(0f, 1f));
glitter.setAlphaFunction(new InterpFadeInOut(0f, 1f));
ParticleSpawner.spawn(glitter, entity.world, new StaticInterp<>(entity.getPositionVector()), 5, 0, (aFloat, particleBuilder) -> {
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 2));
particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
// particleBuilder.addMotion()
});
}
use of com.teamwizardry.wizardry.api.spell.SpellRing in project Wizardry by TeamWizardry.
the class ItemNacrePearl method getItemStackDisplayName.
@Nonnull
@Override
public String getItemStackDisplayName(@Nonnull ItemStack stack) {
if (!stack.hasTagCompound())
return super.getItemStackDisplayName(stack);
StringBuilder finalName = null;
List<SpellRing> spellChains = SpellUtils.getSpellChains(stack);
for (SpellRing spellRing : spellChains) {
if (finalName == null) {
finalName = new StringBuilder();
} else
finalName.append(" / ");
finalName.append(spellRing.toString());
}
if (finalName == null)
return super.getItemStackDisplayName(stack);
else
return finalName.toString();
}
Aggregations