summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/api
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2018-05-24 15:50:07 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2018-05-24 15:50:07 -0400
commit4f7ad220df0438b6f3382110577b53f29da46453 (patch)
tree07d5e7c812721753cdbe3df7226dad5dc3802c29 /src/main/java/darkknight/jewelrycraft/api
parent01c8701b68986ccfa83e902515716838d6829311 (diff)
Update of all changes
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/api')
-rwxr-xr-x[-rw-r--r--]src/main/java/darkknight/jewelrycraft/api/Curse.java581
-rwxr-xr-x[-rw-r--r--]src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java152
-rwxr-xr-x[-rw-r--r--]src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java334
3 files changed, 644 insertions, 423 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java
index 9d08582..1cd0288 100644..100755
--- a/src/main/java/darkknight/jewelrycraft/api/Curse.java
+++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java
@@ -2,6 +2,7 @@ package darkknight.jewelrycraft.api;
import java.util.ArrayList;
import java.util.Random;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
@@ -12,245 +13,359 @@ 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.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.living.LivingHealEvent;
+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.world.BlockEvent;
-public abstract class Curse
-{
- 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>();
-
- /**
- * @param name The name of the curse
- * @param txtID The texture ID of it
- * @param texturepack The texturepack location
- */
- protected Curse(String name, int txtID, String texturepack)
- {
- this.name = name;
- this.texturePackName = texturepack;
- this.textureID = txtID;
- this.ticksActive = 0;
- curses.add(this);
- availableCurses.add(this);
- }
-
- /**
- * @return The name of the curse
- */
- public String getName()
- {
- return name;
- }
-
- public abstract String getDisplayName();
-
- /**
- * @return The description of the curse
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * @param The description of the curse
- * @return The class
- */
- public Curse setDescription(String desc)
- {
- description = desc;
- return this;
- }
-
- /**
- * @return the texture pack ID
- */
- public String getTexturePack()
- {
- return texturePackName;
- }
-
- /**
- * @return The texture ID
- */
- public int getTextureID()
- {
- return textureID;
- }
-
- /**
- * This runs every tick
- * @param world The worldthe player is in
- * @param player The cursed player
- */
- public void action(World world, EntityPlayer player)
- {
- ticksActive++;
- }
-
- public int getTicksActive()
- {
+public abstract class Curse {
+ protected int textureID, ticksActive;
+ protected String name, description, texturePackName;
+ protected Random rand = new Random();
+ private static ArrayList<Curse> curses = new ArrayList<>();
+ public static ArrayList<Curse> availableCurses = new ArrayList<>();
+
+ /**
+ * @param name
+ * The name of the curse
+ * @param txtID
+ * The texture ID of it
+ * @param texturepack
+ * The texturepack location
+ */
+ protected Curse(String name, int txtID, String texturepack) {
+ this.name = name;
+ this.texturePackName = texturepack;
+ this.textureID = txtID;
+ this.ticksActive = 0;
+ curses.add(this);
+ availableCurses.add(this);
+ }
+
+ /**
+ * @return The name of the curse
+ */
+ public String getName() {
+ return name;
+ }
+
+ public abstract String getDisplayName();
+
+ /**
+ * @return The description of the curse
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param desc
+ * description of the curse
+ * @return The class
+ */
+ public Curse setDescription(String desc) {
+ description = desc;
+ return this;
+ }
+
+ /**
+ * @return the texture pack ID
+ */
+ public String getTexturePack() {
+ return texturePackName;
+ }
+
+ /**
+ * @return The texture ID
+ */
+ public int getTextureID() {
+ return textureID;
+ }
+
+ /**
+ * This runs every tick
+ *
+ * @param world
+ * The worldthe player is in
+ * @param player
+ * The cursed player
+ */
+ public void action(World world, EntityPlayer player) {
+ ticksActive++;
+ }
+
+ public int getTicksActive() {
return ticksActive;
}
- public void setTicksActive(int ticksActive)
- {
+ public void setTicksActive(int ticksActive) {
this.ticksActive = ticksActive;
}
- /**
- * This runs when the player dies
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void playerDeathAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when an entity is killed (whether by a player or other causes)
- * @param world The world the player is in
- * @param target The entity that died
- * @param player The cursed player
- */
- public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player)
- {}
-
- /**
- * This runs when the player respawns
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void respawnAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when a player gets attacked by anything but another player
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void attackedAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when an entity is attacked by a player (this includes other players)
- * @param world The world the player is in
- * @param player The player that caused the damage
- * @param target The entity damaged
- */
- 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
- * @param drops An array list containing the dropped items
- */
- public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
- {}
-
- /**
- * This is for rendering special things on the player in 3rd person (meaning you won't see this render);
- * This will also render in the inventory.
- * @param player The cursed player
- * @param event The event used for this
- */
- @SideOnly(Side.CLIENT)
- public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
- {}
-
- /**
- * This is for rendering special things on the player in 1st and 3rd person, but not in the player inventory.
- * @param player The cursed player
- * @param event The event used for this
- */
- @SideOnly(Side.CLIENT)
- public void playerHandRender(EntityPlayer player, RenderHandEvent event)
- {}
-
- /**
- * This runs when a block drops an item (such as breaking a block and dropping itself, or breaking like a Diamond ore and dropping diamonds)
- * @param player The cursed player
- * @param event The BlockEvent that triggers this
- */
- public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event)
- {}
-
- /**
- * This runs when a block is destroyed
- * @param player The cursed player
- * @param event The BlockEvent that runs this
- */
- public void onBlockDestroyed(EntityPlayer player, BlockEvent.BreakEvent event)
- {}
-
- /**
- * This determines if the player can toss an item or not (with Q)
- * @return True if the player can no longer toss items; False if he can. (by default false)
- */
- public boolean itemToss()
- {
- return false;
- }
-
- /**
- * This controls whether a curse can be activated or not (makes it easy to do things like disable certain curses if in hardcore)
- * @param world The world the player is in
- * @return True for curses to be used; False otherwise (by default true)
- */
- public boolean canCurseBeActivated(World world)
- {
- return canCurseBeActivated();
- }
- /**
- * This controls whether a curse can be activated or not (makes it easy to do things like disable certain curses if in hardcore)
- * @return True for curses to be used; False otherwise (by default true)
- */
- public boolean canCurseBeActivated()
- {
- return true;
- }
-
- /**
- * This is the list of all curses
- * @return The list of registered curses
- */
- public static ArrayList<Curse> getCurseList()
- {
- return curses;
- }
-
- /**
- * This is the weight of the curse when it chooses it. The lower the value, the less it gets chosen; the higher the value, the higher the chance of it getting picked.
- * @param world The world the player is currently in
- * @param player The cursed player
- * @param random A random class
- * @return The weight of the curse (by default 10)
- */
- public int weight(World world, EntityPlayer player, Random random)
- {
- return 10;
- }
-
- /*
- * This stat is used to determine the chance of certain actions happening
- */
- public int luck()
- {
- return 0;
- }
+ /**
+ * This runs when the player dies
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The thing that killed the player
+ */
+ public void playerDeathAction(World world, EntityPlayer player,
+ LivingDeathEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player is healed
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The event that the player is healing from
+ */
+ public void playerHealAction(World world, EntityPlayer player,
+ LivingHealEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is killed (whether by a player or other
+ * causes)
+ *
+ * @param world
+ * The world the player is in
+ * @param target
+ * The entity that died
+ * @param player
+ * The cursed player
+ */
+ public void entityDeathAction(World world, EntityLivingBase target,
+ EntityPlayer player) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player respawns
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ */
+ public void respawnAction(World world, EntityPlayer player) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a player gets attacked by anything but another player
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The event that attacked the player
+ * @param attacker
+ * The entity that attacked the player
+ */
+ public void attackedAction(World world, EntityPlayer player,
+ LivingAttackEvent event, Entity attacker) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is attacked by a player (this includes
+ * other players)
+ *
+ * @param event
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The player that caused the damage
+ * @param target
+ * The entity damaged
+ */
+ public void attackedByPlayerAction(LivingAttackEvent event,
+ World world, EntityPlayer player, Entity target) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is attacked by a player (this includes
+ * other players). This can cancel the damaging event.
+ *
+ * @param event
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The player that caused the damage
+ * @param target
+ * The entity damaged
+ * @return Whether or not to cancel the event
+ */
+ 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
+ * @param drops
+ * An array list containing the dropped items
+ */
+ public void entityDropItems(EntityPlayer player, Entity target,
+ ArrayList<EntityItem> drops) {
+ // Do nothing
+ }
+
+ /**
+ * This is for rendering special things on the player in 3rd person
+ * (meaning you won't see this render); This will also render in the
+ * inventory.
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The event used for this
+ */
+ @SideOnly(Side.CLIENT)
+ public void playerRender(EntityPlayer player,
+ RenderPlayerEvent.Specials.Post event) {
+ // Do nothing
+ }
+
+ /**
+ * This is for rendering special things on the player in 1st and 3rd
+ * person, but not in the player inventory.
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The event used for this
+ */
+ @SideOnly(Side.CLIENT)
+ public void playerHandRender(EntityPlayer player,
+ RenderHandEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a block drops an item (such as breaking a block and
+ * dropping itself, or breaking like a Diamond ore and dropping
+ * diamonds)
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The BlockEvent that triggers this
+ */
+ public void onBlockItemsDrop(EntityPlayer player,
+ BlockEvent.HarvestDropsEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a block is destroyed
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The BlockEvent that runs this
+ */
+ public void onBlockDestroyed(EntityPlayer player,
+ BlockEvent.BreakEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This determines if the player can toss an item or not (with Q)
+ *
+ * @return True if the player can no longer toss items; False if he
+ * can. (by default false)
+ */
+ public boolean itemToss() {
+ return false;
+ }
+
+ /**
+ * This controls whether a curse can be activated or not (makes it easy
+ * to do things like disable certain curses if in hardcore)
+ *
+ * @param world
+ * The world the player is in
+ * @return True for curses to be used; False otherwise (by default
+ * true)
+ */
+ public boolean canCurseBeActivated(World world) {
+ return canCurseBeActivated();
+ }
+
+ /**
+ * This controls whether a curse can be activated or not (makes it easy
+ * to do things like disable certain curses if in hardcore)
+ *
+ * @return True for curses to be used; False otherwise (by default
+ * true)
+ */
+ public boolean canCurseBeActivated() {
+ return true;
+ }
+
+ /**
+ * This is the list of all curses
+ *
+ * @return The list of registered curses
+ */
+ public static ArrayList<Curse> getCurseList() {
+ return curses;
+ }
+
+ /**
+ * This is the weight of the curse when it chooses it. The lower the
+ * value, the less it gets chosen; the higher the value, the higher the
+ * chance of it getting picked.
+ *
+ * @param world
+ * The world the player is currently in
+ * @param player
+ * The cursed player
+ * @param random
+ * A random class
+ * @return The weight of the curse (by default 10)
+ */
+ public int weight(World world, EntityPlayer player, Random random) {
+ return 10;
+ }
+
+ /*
+ * This stat is used to determine the chance of certain actions
+ * happening
+ */
+ public int luck() {
+ return 0;
+ }
+
+ /**
+ * This event is called whenever the player attempts to sleep.
+ *
+ * @param worldObj the world
+ * @param player the cursed player
+ * @param event the sleeping event
+ */
+ public void playerSleepAction(World worldObj, EntityPlayer player,
+ PlayerSleepInBedEvent event) {
+
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java
index 576f12b..c4a2c7a 100644..100755
--- a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java
+++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java
@@ -13,63 +13,101 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
* @author Sorin
*
*/
-public interface IJewelryItem
-{
- /**
- * @return Returns the id of the type, 0 is for ring, 1 is for bracelet, 2 is for necklace and 3 is for earrings
- */
- public int type();
-
- /**
- * This is the action performed each player tick
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player wearing the jewelry
- */
- public void onWearAction(ItemStack item, EntityPlayer player);
-
- /**
- * This performs an action whenever a player gets attacked by an entity besides another Player
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that was attacked
- * @param source Source of the damage
- * @param amount The amount of damage taken
- */
- public void onPlayerAttackedAction(ItemStack item, EntityPlayer player, DamageSource source, float amount);
-
- /**
- * This does an action whenever an Entity gets attacked by a player, this includes other Players
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The attacking player
- * @param entity The target entity
- * @param amount The amount of damage dealt
- */
- public void onEntityAttackedByPlayer(ItemStack item, EntityPlayer player, EntityLivingBase entity, float amount);
-
- /**
- * This runs whenever a player dies
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that died
- * @param source The damage source that caused the death
- */
- public void onPlayerDeadAction(ItemStack item, EntityPlayer player, DamageSource source);
-
- /**
- * Runs whenever a player respawns (switches dimensions or actually respawns)
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that respawns
- * @param event The clone event that runs whenever a player respawns, either because he died or switched dimensions
- */
- public void onPlayerRespawnAction(ItemStack item, PlayerEvent.Clone event);
+public interface IJewelryItem {
+ /**
+ * @return Returns the id of the type, 0 is for ring, 1 is for
+ * bracelet, 2 is for necklace and 3 is for earrings
+ */
+ public int type();
- /**
- * This runs when the item is equipped
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- */
- public void onJewelryEquipped(ItemStack item);
+ /**
+ * This is the action performed each player tick
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player wearing the jewelry
+ */
+ public void onWearAction(ItemStack item, EntityPlayer player);
- /**
- * This runs when the item is unequipped
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- */
- public void onJewelryUnequipped(ItemStack item);
+ /**
+ * This performs an action whenever a player gets attacked by an entity
+ * besides another Player
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player that was attacked
+ * @param source
+ * Source of the damage
+ * @param amount
+ * The amount of damage taken
+ */
+ public void onPlayerAttackedAction(ItemStack item, EntityPlayer player,
+ DamageSource source, float amount);
+
+ /**
+ * This does an action whenever an Entity gets attacked by a player,
+ * this includes other Players
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The attacking player
+ * @param entity
+ * The target entity
+ * @param amount
+ * The amount of damage dealt
+ */
+ public void onEntityAttackedByPlayer(ItemStack item,
+ EntityPlayer player, EntityLivingBase entity, float amount);
+
+ /**
+ * This runs whenever a player dies
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player that died
+ * @param source
+ * The damage source that caused the death
+ */
+ public void onPlayerDeadAction(ItemStack item, EntityPlayer player,
+ DamageSource source);
+
+ /**
+ * Runs whenever a player respawns (switches dimensions or actually
+ * respawns)
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param event
+ * The clone event that runs whenever a player respawns,
+ * either because he died or switched dimensions
+ */
+ public void onPlayerRespawnAction(ItemStack item,
+ PlayerEvent.Clone event);
+
+ /**
+ * This runs when the item is equipped
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ */
+ public void onJewelryEquipped(ItemStack item);
+
+ /**
+ * This runs when the item is unequipped
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ */
+ public void onJewelryUnequipped(ItemStack item);
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java
index 22e0ca8..05fee9d 100644..100755
--- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java
+++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java
@@ -2,6 +2,7 @@ package darkknight.jewelrycraft.api;
import java.util.ArrayList;
import java.util.Random;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -9,137 +10,204 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.player.PlayerEvent;
-public class ModifierEffects
-{
- protected ItemStack modifier;
- protected Random rand = new Random();
- protected static ArrayList<ModifierEffects> effects = new ArrayList<ModifierEffects>();
-
- /**
- * @param modifier The item to use as modifier
- */
- public ModifierEffects(ItemStack modifier)
- {
- this.modifier = modifier;
- effects.add(this);
- }
-
- /**
- * @return The list of all effects registered
- */
- public static ArrayList<ModifierEffects> getEffects()
- {
- return effects;
- }
-
- /**
- * @return The ItemStack set as the modifier
- */
- public ItemStack getModifier()
- {
- return modifier;
- }
-
- /**
- * This runs every tick
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param jewelry The actual jewelry item (used by me to determine the type of jewelry so I don't have to call item.getItem() blah blah blah)
- */
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {};
-
- /**
- * This runs when an entity is attacked. This event can be canceled.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param target The attacked entity
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the entity took
- * @return The state of the event (true to cancel it, false to not)
- */
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- return false;
- }
-
- /**
- * This runs when a player gets damaged. This event can be canceled.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The attacked player wearing a jewelry with this modifier on it
- * @param source The source of the damage
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the player took
- * @return The state of the event (true to cancel it, false to not)
- */
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- return false;
- }
-
- /**
- * This is the same as onEntityAttackedCacellable, but this can not be canceled. I recommend using this over onEntityAttackedCacellable, as it is more reliable.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param target The attacked entity
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the entity took
- */
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {}
-
- /**
- * This is just like onPlayerAttackedCacellable, only that this can not be canceled. I recommend using this over onPlayerAttackedCacellable, as it is more reliable.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The attacked player wearing a jewelry with this modifier on it
- * @param source The source of the damage
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the player took
- */
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {}
-
- /**
- * This runs when the player dies
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player that died wearing a jewelry with this modifier on it
- * @param source The source of the killing blow
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry)
- {}
-
- /**
- * This runs when the player respawns
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param event The PlayerEvent that runs when the player respawns (this is also called when a player moves between dimensions)
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event, Item jewelry)
- {}
-
- /**
- * This runs when the item containing this modifier is equipped
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onJewelryEquipped(ItemStack item, Item jewelry)
- {}
-
- /**
- * This runs when the item containing this modifier is unquipped
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onJewelryUnequipped(ItemStack item, Item jewelry)
- {}
+public class ModifierEffects {
+ protected ItemStack modifier;
+ protected Random rand = new Random();
+ protected static ArrayList<ModifierEffects> effects =
+ new ArrayList<>();
+
+ /**
+ * @param modifier
+ * The item to use as modifier
+ */
+ public ModifierEffects(ItemStack modifier) {
+ this.modifier = modifier;
+ effects.add(this);
+ }
+
+ /**
+ * @return The list of all effects registered
+ */
+ public static ArrayList<ModifierEffects> getEffects() {
+ return effects;
+ }
+
+ /**
+ * @return The ItemStack set as the modifier
+ */
+ public ItemStack getModifier() {
+ return modifier;
+ }
+
+ /**
+ * This runs every tick
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param jewelry
+ * The actual jewelry item (used by me to determine the type
+ * of jewelry so I don't have to call item.getItem() blah
+ * blah blah)
+ */
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ // Do nothing
+ };
+
+ /**
+ * This runs when an entity is attacked. This event can be canceled.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param target
+ * The attacked entity
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the entity took
+ * @return The state of the event (true to cancel it, false to not)
+ */
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
+ return false;
+ }
+
+ /**
+ * This runs when a player gets damaged. This event can be canceled.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The attacked player wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the damage
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the player took
+ * @return The state of the event (true to cancel it, false to not)
+ */
+ public boolean onPlayerAttackedCancellable(ItemStack item,
+ EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ return false;
+ }
+
+ /**
+ * This is the same as onEntityAttackedCacellable, but this can not be
+ * canceled. I recommend using this over onEntityAttackedCacellable, as
+ * it is more reliable.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param target
+ * The attacked entity
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the entity took
+ */
+ public void onEntityAttacked(ItemStack item, EntityPlayer player,
+ Entity target, Item jewelry, float amount) {
+ // Do nothing
+ }
+
+ /**
+ * This is just like onPlayerAttackedCacellable, only that this can not
+ * be canceled. I recommend using this over onPlayerAttackedCacellable,
+ * as it is more reliable.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The attacked player wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the damage
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the player took
+ */
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry, float amount) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player dies
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player that died wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the killing blow
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onPlayerDead(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player respawns
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param event
+ * The PlayerEvent that runs when the player respawns (this
+ * is also called when a player moves between dimensions)
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event,
+ Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the item containing this modifier is equipped
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onJewelryEquipped(ItemStack item, Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the item containing this modifier is unquipped
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onJewelryUnequipped(ItemStack item, Item jewelry) {
+ // Do nothing
+ }
}