From 05f43b228ae0de5bd33ccd303ebbadfaaa464bc7 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 23 Apr 2015 18:08:44 +0100 Subject: Added new curses! --- .../jewelrycraft/curses/CurseRabbitsPaw.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java (limited to 'src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java') diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java new file mode 100644 index 0000000..0e831c2 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java @@ -0,0 +1,62 @@ +/** + * + */ +package darkknight.jewelrycraft.curses; + +import java.util.ArrayList; +import darkknight.jewelrycraft.entities.EntityHalfHeart; +import darkknight.jewelrycraft.entities.EntityHeart; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class CurseRabbitsPaw extends Curse +{ + public CurseRabbitsPaw(int id, String name, int text) + { + super(id, name, text); + } + + @Override + public void entityDropItems(EntityPlayer player, Entity target, ArrayList drops) + { + for(EntityItem item: drops){ + ItemStack drop = item.getEntityItem().copy(); + drop.stackSize = this.rand.nextInt(4); + if (drop.stackSize > 0) target.entityDropItem(drop, 0.5F); + } + } + + public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player) + { + String[] types = {"Red", "Blue", "White", "Black"}; + String type = types[rand.nextInt(4)]; + if (rand.nextInt(3) == 0){ + if (type == "White"){ + EntityHeart h = new EntityHalfHeart(world); + h.setType(type); + h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); + world.spawnEntityInWorld(h); + }else{ + for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(target.getMaxHealth() / 20)); i++){ + EntityHeart[] hearts = {new EntityHeart(world), new EntityHalfHeart(world)}; + EntityHeart h = hearts[rand.nextInt(2)]; + h.setType(type); + h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F); + world.spawnEntityInWorld(h); + } + } + } + if (rand.nextInt(3) == 0) world.spawnEntityInWorld(new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40))); + } + + public String getDescription() + { + return "The Dark One is giving you a gift. Don't lose it."; + } +} -- cgit v1.2.3