From 0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 13 Aug 2015 21:12:11 +0100 Subject: Added a new structure, a new curse, achievements, challenges, curses entry in the guide; reworked liquids to be tile entities, cleaned the structures code, potion code and... you know what? I improved and changed so much stuff that I literally forgot what I did... --- .../java/darkknight/jewelrycraft/api/Curse.java | 39 +++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/api/Curse.java') diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index c8c4d60..84e425f 100644 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -2,8 +2,8 @@ package darkknight.jewelrycraft.api; import java.util.ArrayList; import java.util.Random; - -import net.minecraft.client.Minecraft; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -11,14 +11,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.world.BlockEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public abstract class Curse { - protected int textureID; - protected String name, description, texturePackName; + protected int textureID, ticksActive; + protected String name, description, texturePackName; protected Random rand = new Random(); private static ArrayList curses = new ArrayList(); public static ArrayList availableCurses = new ArrayList(); @@ -33,6 +32,7 @@ public abstract class Curse this.name = name; this.texturePackName = texturepack; this.textureID = txtID; + this.ticksActive = 0; curses.add(this); availableCurses.add(this); } @@ -87,7 +87,19 @@ public abstract class Curse * @param player The cursed player */ public void action(World world, EntityPlayer player) - {} + { + ticksActive++; + } + + public int getTicksActive() + { + return ticksActive; + } + + public void setTicksActive(int ticksActive) + { + this.ticksActive = ticksActive; + } /** * This runs when the player dies @@ -128,9 +140,20 @@ public abstract class Curse * @param player The player that caused the damage * @param target The entity damaged */ - public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) + public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target) {} + /** + * This runs when an entity is attacked by a player (this includes other players). This can cancel the damaging event. + * @param world The world the player is in + * @param player The player that caused the damage + * @param target The entity damaged + */ + public boolean attackedByPlayerActionCancelable(LivingAttackEvent event, World world, EntityPlayer player, Entity target) + { + return false; + } + /** * This runs when an item is dropped by an entity * @param player The cursed player -- cgit v1.2.3