Skip to content

Commit

Permalink
Swapped out spell effects. Resolved #408
Browse files Browse the repository at this point in the history
  • Loading branch information
matejdro committed Apr 17, 2015
1 parent 3839a3f commit e416b2a
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.server.v1_8_R2.EntityExperienceOrb;
import net.minecraft.server.v1_8_R2.EntityHuman;
import net.minecraft.server.v1_8_R2.EntityItem;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.World;
import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand All @@ -23,6 +24,7 @@
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import us.corenetwork.mantle.MantlePlugin;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.EntityIterator;
import us.corenetwork.mantle.spellbooks.Spellbook;
Expand Down Expand Up @@ -76,6 +78,8 @@ else if (entity instanceof Item)

Bukkit.getScheduler().runTask(MantlePlugin.instance, new PlayerShower(showerContents));

ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT, player.getEyeLocation(), 2);

return BookFinishAction.BROADCAST_AND_CONSUME;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.ClaimsMode;
import net.minecraft.server.v1_8_R2.EnumParticle;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.DyeColor;
Expand All @@ -22,6 +23,7 @@
import us.corenetwork.core.claims.BlockWorker;
import us.corenetwork.core.claims.ClaimsModule;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.Spellbook;
import us.corenetwork.mantle.spellbooks.SpellbookItem;
Expand Down Expand Up @@ -88,11 +90,9 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event
player.updateInventory();
}

FireworkEffect effect = FireworkEffect.builder().withColor(Color.OLIVE).withFade(Color.OLIVE).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);
effectLoc.getWorld().playSound(effectLoc, Sound.SKELETON_DEATH, 1f, 1f);

Location effectLoc = player.getEyeLocation();
ParticleLibrary.broadcastParticleRing(EnumParticle.SPELL_WITCH, effectLoc, 2);
effectLoc.getWorld().playSound(effectLoc, Sound.SKELETON_DEATH, 1f, 1f);
return BookFinishAction.BROADCAST_AND_CONSUME;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Map.Entry;
import me.ryanhamshire.GriefPrevention.Claim;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.RecipesFurnace;
import org.bukkit.CoalType;
import org.bukkit.Color;
Expand All @@ -24,6 +25,7 @@
import org.bukkit.inventory.ItemStack;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.MLog;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.Spellbook;
import us.corenetwork.mantle.spellbooks.SpellbookItem;
Expand Down Expand Up @@ -87,7 +89,9 @@ protected boolean usesContainers() {
@Override
public BookFinishAction onActivate(SpellbookItem spellbookItem, PlayerInteractEvent event) {
Player player = event.getPlayer();


Location effectLoc;

Inventory inventory;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId()))
{
Expand All @@ -101,10 +105,12 @@ public BookFinishAction onActivate(SpellbookItem spellbookItem, PlayerInteractEv

InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState();
inventory = container.getInventory();
effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock());
}
else
{
inventory = player.getInventory();
effectLoc = player.getEyeLocation();
}

int freeInventorySlots = InventoryUtil.getFreeInventorySlots(inventory);
Expand Down Expand Up @@ -259,10 +265,8 @@ public int compare(ItemStack arg0, ItemStack arg1) {
}

player.updateInventory();

FireworkEffect effect = FireworkEffect.builder().withColor(Color.ORANGE).withFade(Color.ORANGE).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);

ParticleLibrary.broadcastParticleRing(EnumParticle.FLAME, effectLoc, 2);
effectLoc.getWorld().playSound(effectLoc, Sound.FIRE, 1f, 1f);

if (anythingSmelted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import me.ryanhamshire.GriefPrevention.Claim;
import net.minecraft.server.v1_8_R2.EnumParticle;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
Expand All @@ -20,6 +21,7 @@
import org.bukkit.inventory.ItemStack;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.MLog;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.Spellbook;
import us.corenetwork.mantle.spellbooks.SpellbookItem;
Expand Down Expand Up @@ -64,6 +66,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event
Player player = event.getPlayer();

Inventory inventory;
Location effectLoc;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId()))
{
//Check for claim if clicking on chest
Expand All @@ -77,10 +80,12 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event

InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState();
inventory = container.getInventory();
effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock());
}
else
{
inventory = player.getInventory();
effectLoc = player.getEyeLocation();
}

int freeInventorySlots = InventoryUtil.getFreeInventorySlots(inventory);
Expand Down Expand Up @@ -142,10 +147,8 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event

if (inventory.getType() == InventoryType.PLAYER)
player.updateInventory();

FireworkEffect effect = FireworkEffect.builder().withColor(Color.SILVER).withFade(Color.SILVER).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);

ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT, effectLoc, 2);
effectLoc.getWorld().playSound(effectLoc, Sound.ANVIL_USE, 1f, 2f);

if (fusedSomething)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event
Player player = event.getPlayer();

Location effectLoc = player.getEyeLocation();
// effectLoc.setY(effectLoc.getY() + 1);
//;SpellbookUtil.getPointInFrontOfPlayer(event.getPlayer().getEyeLocation(), 2);
//
// Vector direction = event.getPlayer().getLocation().getDirection();

ParticleLibrary.broadcastParticleRing(EnumParticle.VILLAGER_HAPPY, effectLoc, 2);
//ParticleLibrary.broadcastParticle(EnumParticle.VILLAGER_HAPPY, effectLoc, (float) (1.0 - direction.getX()), 0.5f, (float) (1.0 - direction.getZ()), 0, 10, null);
event.getPlayer().playSound(effectLoc, Sound.LEVEL_UP, 1.0f, 1.0f);

Block baseBlock = event.getPlayer().getLocation().getBlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import me.ryanhamshire.GriefPrevention.Claim;
import net.minecraft.server.v1_8_R2.EntityVillager;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.Items;
import net.minecraft.server.v1_8_R2.MerchantRecipe;
import net.minecraft.server.v1_8_R2.MerchantRecipeList;
Expand All @@ -22,6 +23,7 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.nanobot.NanobotUtil;
import us.corenetwork.mantle.spellbooks.Spellbook;
Expand Down Expand Up @@ -149,11 +151,10 @@ protected BookFinishAction onActivateEntity(SpellbookItem spellbookItem, PlayerI
targetAmount -= stackAmount;
}

Color effectColor = Color.fromRGB(0xcd5cab);
FireworkEffect effect = FireworkEffect.builder().withColor(effectColor).withFade(effectColor).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);
event.getPlayer().playSound(effectLoc, Sound.VILLAGER_YES, 1.0f, 1.0f);
Location effectLoc = entity.getLocation();
effectLoc.setY(effectLoc.getY() + 1);
ParticleLibrary.broadcastParticleRing(EnumParticle.CRIT_MAGIC, effectLoc, 2);
event.getPlayer().playSound(effectLoc, Sound.VILLAGER_YES, 1.0f, 1.0f);

return BookFinishAction.BROADCAST_AND_CONSUME;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.List;
import java.util.Map.Entry;
import me.ryanhamshire.GriefPrevention.Claim;
import net.minecraft.server.v1_8_R2.EnumParticle;
import org.bukkit.CoalType;
import org.bukkit.Color;
import org.bukkit.DyeColor;
Expand All @@ -26,6 +27,7 @@
import org.bukkit.inventory.PlayerInventory;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.MLog;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.Spellbook;
import us.corenetwork.mantle.spellbooks.SpellbookItem;
Expand Down Expand Up @@ -81,6 +83,7 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event

Inventory inventory;
Inventory fuelInventory = player.getInventory();
Location effectLoc;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && Util.isInventoryContainer(event.getClickedBlock().getTypeId()))
{
//Check for claim if clicking on chest
Expand All @@ -94,13 +97,15 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event

InventoryHolder container = (InventoryHolder) event.getClickedBlock().getState();
inventory = container.getInventory();
effectLoc = Util.getLocationInBlockCenter(event.getClickedBlock());
}
else
{
inventory = player.getInventory();
effectLoc = player.getEyeLocation();
}

Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
ParticleLibrary.broadcastParticleRing(EnumParticle.FLAME, effectLoc, 2);
effectLoc.getWorld().playSound(effectLoc, Sound.BLAZE_HIT, 0.5f, 0.3f);

boolean anythingSmelted = smith(inventory, fuelInventory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.server.v1_8_R2.EnumParticle;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
Expand All @@ -13,6 +14,7 @@
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.nanobot.NanobotUtil;
import us.corenetwork.mantle.spellbooks.Spellbook;
Expand All @@ -35,10 +37,7 @@ public TimeBook() {
public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event) {
curPlayer = event.getPlayer();

Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(curPlayer.getEyeLocation(), 2);

FireworkEffect effect = FireworkEffect.builder().withColor(Color.BLUE).withFade(Color.BLUE).build();
Util.showFirework(effectLoc, effect);
ParticleLibrary.broadcastParticleRing(EnumParticle.ENCHANTMENT_TABLE, curPlayer.getEyeLocation(), 2);

for (int i = 0; i < curPlayer.getInventory().getSize() + 4; i++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package us.corenetwork.mantle.spellbooks.books;

import me.ryanhamshire.GriefPrevention.Claim;
import net.minecraft.server.v1_8_R2.EnumParticle;
import org.bukkit.Chunk;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
Expand All @@ -12,6 +13,7 @@
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import us.corenetwork.mantle.GriefPreventionHandler;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.netherspawning.NetherSpawner;
import us.corenetwork.mantle.slimespawning.IgnoredSlimeChunks;
Expand Down Expand Up @@ -70,11 +72,10 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event
{
Util.Message(settings.getString(SETTING_MESSAGE_NOT_SLIME_CHUNK), player);
}

Color slimeColor = Color.fromRGB(0x8bbb79);
FireworkEffect effect = FireworkEffect.builder().withColor(slimeColor).withFade(slimeColor).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);


Location effectLoc = player.getEyeLocation();
ParticleLibrary.broadcastParticleRing(EnumParticle.SLIME, effectLoc, 2);
effectLoc.getWorld().playSound(effectLoc, Sound.SLIME_WALK2, 2f, 1f);

if (slimeChunk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.HashSet;
import java.util.UUID;
import net.minecraft.server.v1_8_R2.EnumParticle;
import net.minecraft.server.v1_8_R2.GenericAttributes;
import net.minecraft.server.v1_8_R2.MinecraftServer;
import org.bukkit.Bukkit;
Expand All @@ -27,6 +28,7 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import us.corenetwork.mantle.MantlePlugin;
import us.corenetwork.mantle.ParticleLibrary;
import us.corenetwork.mantle.Util;
import us.corenetwork.mantle.spellbooks.Spellbook;
import us.corenetwork.mantle.spellbooks.SpellbookItem;
Expand Down Expand Up @@ -56,8 +58,6 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event

player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, EFFECT_DURATION, 49));



LivingEntity mount = (LivingEntity) player.getVehicle();
if (mount != null && mount instanceof Horse)
{
Expand All @@ -71,10 +71,8 @@ public BookFinishAction onActivate(SpellbookItem item, PlayerInteractEvent event
}

Bukkit.getScheduler().runTaskLater(MantlePlugin.instance, new SprintingTimer(uuid), EFFECT_DURATION);

FireworkEffect effect = FireworkEffect.builder().withColor(Color.WHITE).withFade(Color.WHITE).build();
Location effectLoc = SpellbookUtil.getPointInFrontOfPlayer(player.getEyeLocation(), 2);
Util.showFirework(effectLoc, effect);

ParticleLibrary.broadcastParticleRing(EnumParticle.EXPLOSION_NORMAL, player.getEyeLocation(), 2);

return BookFinishAction.BROADCAST_AND_CONSUME;
}
Expand Down

0 comments on commit e416b2a

Please sign in to comment.