From 01c8701b68986ccfa83e902515716838d6829311 Mon Sep 17 00:00:00 2001 From: Onyx Date: Tue, 1 Dec 2015 20:55:30 +0000 Subject: - Fixed all of the bugs mentioned on github - Added new config options - Rabbits paw now increases the chance of spawning hearts, rather than itself spawning some - Hearts now have a much lower chance to spawn by default - You can no longer increase your health past 20 hearts (aka double the default health) - The guide now also shows the total number of pages on each tab - A new luck stat has been added to the Curse API - Cleaned up the code a bit (removed unused methods, imports etc) - The displayer's info now has a purple solid color background; the text also has a much closer shadow and now shrinks in height as well as in width when too big - I have modified the potion list to use Mithion's code, credits have been given --- .../java/darkknight/jewelrycraft/api/Curse.java | 8 ++ .../darkknight/jewelrycraft/api/IJewelryItem.java | 138 +++++++++++---------- .../jewelrycraft/api/ModifierEffects.java | 31 ++++- 3 files changed, 110 insertions(+), 67 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/api') diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index 5fe5642..9d08582 100644 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -245,4 +245,12 @@ public abstract class Curse { return 10; } + + /* + * This stat is used to determine the chance of certain actions happening + */ + public int luck() + { + return 0; + } } diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java index 80121de..576f12b 100644 --- a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java +++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java @@ -1,63 +1,75 @@ -/** - * - */ -package darkknight.jewelrycraft.api; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -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); -} +/** + * + */ +package darkknight.jewelrycraft.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +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); + + /** + * 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 be88d31..22e0ca8 100644 --- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java +++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java @@ -42,6 +42,7 @@ public class ModifierEffects /** * 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) @@ -51,6 +52,7 @@ public class ModifierEffects /** * 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 @@ -65,6 +67,7 @@ public class ModifierEffects /** * 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 @@ -78,8 +81,8 @@ public class ModifierEffects } /** - * This is the same as onEntityAttackedCacellable, but this can not be canceled. - * I recommend using this over onEntityAttackedCacellable, as it is more reliable. + * 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 @@ -90,8 +93,8 @@ public class ModifierEffects {} /** - * This is just like onPlayerAttackedCacellable, only that this can not be canceled. - * I recommend using this over onPlayerAttackedCacellable, as it is more reliable. + * 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 @@ -103,6 +106,7 @@ public class ModifierEffects /** * 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 @@ -113,10 +117,29 @@ public class ModifierEffects /** * 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) + {} } -- cgit v1.2.3