summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/api/Curse.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-08-13 21:12:11 +0100
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-08-13 21:12:11 +0100
commit0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 (patch)
tree03966c83cd16d1912ec1596d83f89f251cc35f83 /src/main/java/darkknight/jewelrycraft/api/Curse.java
parent921f1ba6f30e66c80c803618ebff496778e78970 (diff)
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...
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/api/Curse.java')
-rw-r--r--src/main/java/darkknight/jewelrycraft/api/Curse.java39
1 files changed, 31 insertions, 8 deletions
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<Curse> curses = new ArrayList<Curse>();
public static ArrayList<Curse> availableCurses = new ArrayList<Curse>();
@@ -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,10 +140,21 @@ 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
* @param target The entity that drops the item