Skip to content

Commit

Permalink
Add chance of blood spider treasure turning into a cave spider entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Blitheness committed Oct 26, 2022
1 parent fadbf70 commit 2ce5fea
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/us/shirecraft/easteregghunt/EggListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import us.shirecraft.easteregghunt.halloween.BloodSpider;

import java.util.Random;

Expand Down Expand Up @@ -55,6 +56,27 @@ public void onPlayerPickUpEgg(EntityPickupItemEvent ev) {
chicken.remove();
}, 60);
}
if(getRandom(1,100) < 10 && huntType.equals("halloween") && treasureType.equals("Blood Spider")) {
player.sendMessage("§a ** It's... §a§lALIVE§a!");

world.spawnParticle(Particle.EXPLOSION_LARGE, eggLocation, 2);
ev.getItem().remove();

CaveSpider spider = (CaveSpider) world.spawnEntity(eggLocation, EntityType.CAVE_SPIDER);
spider.setTicksLived(1);
world.spawnParticle(Particle.FLASH, spider.getLocation(), 2);
world.playSound(spider.getLocation(), Sound.ITEM_TRIDENT_THUNDER, 1, 1);

Bukkit.getScheduler().runTaskLater(plugin, () -> {
//noinspection ConstantConditions
if(null == spider || null == world || null == player) {
return;
}
world.spawnParticle(Particle.FLASH, spider.getLocation(), 2);
world.playSound(spider.getLocation(), Sound.ENTITY_SPIDER_HURT, 1, 1);
spider.remove();
}, 80);
}
if(getRandom(1,100) <= 10 && huntType.equals("christmas") && treasureType.equals("Snowman")) {
player.sendMessage("§a ** The snowman sprung to life before you could collect it!");

Expand Down

0 comments on commit 2ce5fea

Please sign in to comment.