From da0489296ee8a2d291de6bd72afc56673b872152 Mon Sep 17 00:00:00 2001 From: Kam Date: Thu, 27 Feb 2025 15:54:42 -0500 Subject: [PATCH] Better Reorganization --- .../npcs/CustomAttributes.java} | 10 +++-- .../npcs/command/AttributeCommand.java | 16 ++++---- .../kamkeel/npcs/command/CommandKamkeel.java | 4 +- .../command/profile/CommandProfileAdmin.java | 6 +-- .../command/profile/CommandProfileChange.java | 4 +- .../command/profile/CommandProfileCreate.java | 4 +- .../command/profile/CommandProfileList.java | 2 +- .../command/profile/CommandProfileRemove.java | 4 +- .../controllers}/AttributeController.java | 11 ++++-- .../npcs/controllers/ProfileController.java | 10 ++--- .../data}/attribute/AttributeDefinition.java | 2 +- .../data}/attribute/AttributeValueType.java | 2 +- .../data}/attribute/ICustomAttribute.java | 2 +- .../data/attribute}/PlayerAttribute.java | 5 +-- .../data/attribute}/PlayerAttributeMap.java | 5 +-- .../tracker}/PlayerAttributeTracker.java | 24 +++++++----- .../tracker}/PlayerEquipmentTracker.java | 12 +++--- .../data/{ => profile}/CNPCData.java | 12 +++--- .../{ => profile}/EnumProfileOperation.java | 2 +- .../data/{ => profile}/IProfileData.java | 4 +- .../data/{ => profile}/Profile.java | 2 +- .../ProfileInfoEntry.java} | 16 ++++---- .../data/{ => profile}/ProfileOperation.java | 2 +- .../controllers/data/{ => profile}/Slot.java | 2 +- .../request/profile/ProfileChangePacket.java | 2 +- .../request/profile/ProfileCreatePacket.java | 4 +- .../request/profile/ProfileGetInfoPacket.java | 18 ++++----- .../request/profile/ProfileGetPacket.java | 2 +- .../request/profile/ProfileRemovePacket.java | 2 +- .../request/profile/ProfileRenamePacket.java | 2 +- .../npcs/util/AttributeAttackUtil.java} | 37 ++++++++++--------- .../npcs/util/AttributeItemUtil.java} | 28 +++++++------- src/main/java/noppes/npcs/CustomNpcs.java | 4 +- .../noppes/npcs/ScriptPlayerEventHandler.java | 11 +++--- .../gui/player/inventory/GuiProfiles.java | 12 +++--- .../npcs/controllers/data/PlayerData.java | 2 +- .../noppes/npcs/controllers/data/Quest.java | 2 +- .../noppes/npcs/mixin/MixinItemStack.java | 6 +-- 38 files changed, 151 insertions(+), 144 deletions(-) rename src/main/java/{noppes/npcs/attribute/ModAttributes.java => kamkeel/npcs/CustomAttributes.java} (92%) rename src/main/java/{noppes/npcs/attribute => kamkeel/npcs/controllers}/AttributeController.java (84%) rename src/main/java/{noppes/npcs => kamkeel/npcs/controllers/data}/attribute/AttributeDefinition.java (95%) rename src/main/java/{noppes/npcs => kamkeel/npcs/controllers/data}/attribute/AttributeValueType.java (81%) rename src/main/java/{noppes/npcs => kamkeel/npcs/controllers/data}/attribute/ICustomAttribute.java (83%) rename src/main/java/{noppes/npcs/attribute/player => kamkeel/npcs/controllers/data/attribute}/PlayerAttribute.java (80%) rename src/main/java/{noppes/npcs/attribute/player => kamkeel/npcs/controllers/data/attribute}/PlayerAttributeMap.java (86%) rename src/main/java/{noppes/npcs/attribute/player => kamkeel/npcs/controllers/data/attribute/tracker}/PlayerAttributeTracker.java (82%) rename src/main/java/{noppes/npcs/attribute/player => kamkeel/npcs/controllers/data/attribute/tracker}/PlayerEquipmentTracker.java (83%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/CNPCData.java (75%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/EnumProfileOperation.java (60%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/IProfileData.java (91%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/Profile.java (98%) rename src/main/java/kamkeel/npcs/controllers/data/{InfoEntry.java => profile/ProfileInfoEntry.java} (70%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/ProfileOperation.java (94%) rename src/main/java/kamkeel/npcs/controllers/data/{ => profile}/Slot.java (98%) rename src/main/java/{noppes/npcs/attribute/AttributeAttackHelper.java => kamkeel/npcs/util/AttributeAttackUtil.java} (79%) rename src/main/java/{noppes/npcs/attribute/ItemAttributeHelper.java => kamkeel/npcs/util/AttributeItemUtil.java} (94%) diff --git a/src/main/java/noppes/npcs/attribute/ModAttributes.java b/src/main/java/kamkeel/npcs/CustomAttributes.java similarity index 92% rename from src/main/java/noppes/npcs/attribute/ModAttributes.java rename to src/main/java/kamkeel/npcs/CustomAttributes.java index 52fabffca..5cbe0b04d 100644 --- a/src/main/java/noppes/npcs/attribute/ModAttributes.java +++ b/src/main/java/kamkeel/npcs/CustomAttributes.java @@ -1,9 +1,13 @@ -package noppes.npcs.attribute; +package kamkeel.npcs; + +import kamkeel.npcs.controllers.AttributeController; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.data.attribute.AttributeValueType; /** * ModAttributes registers the core attributes (both non–magic and magic–based). */ -public class ModAttributes { +public class CustomAttributes { public static final String HEALTH_KEY = "health"; public static final String MAIN_ATTACK_KEY = "main_attack"; public static final String MAIN_ATTACK_BOOST_KEY = "main_attack_boost"; @@ -31,7 +35,7 @@ public class ModAttributes { public static AttributeDefinition MAGIC_DEFENSE; public static AttributeDefinition MAGIC_RESISTANCE; - public ModAttributes(){ + public CustomAttributes(){ HEALTH = AttributeController.registerAttribute(HEALTH_KEY, "Health", 'c', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.BASE); MAIN_ATTACK = AttributeController.registerAttribute(MAIN_ATTACK_KEY, "Main Attack Damage", '4', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.BASE); diff --git a/src/main/java/kamkeel/npcs/command/AttributeCommand.java b/src/main/java/kamkeel/npcs/command/AttributeCommand.java index ed4e98561..59952a1cb 100644 --- a/src/main/java/kamkeel/npcs/command/AttributeCommand.java +++ b/src/main/java/kamkeel/npcs/command/AttributeCommand.java @@ -10,10 +10,10 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.item.ItemStack; import net.minecraft.entity.player.EntityPlayer; -import noppes.npcs.attribute.AttributeController; -import noppes.npcs.attribute.AttributeDefinition; -import noppes.npcs.attribute.AttributeValueType; -import noppes.npcs.attribute.ItemAttributeHelper; +import kamkeel.npcs.controllers.AttributeController; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.data.attribute.AttributeValueType; +import kamkeel.npcs.util.AttributeItemUtil; import noppes.npcs.controllers.MagicController; import static kamkeel.npcs.util.ColorUtil.sendError; @@ -126,7 +126,7 @@ public class AttributeCommand extends CommandKamkeelBase { return; } - ItemAttributeHelper.writeMagicAttribute(held, attrKey, magicId, value); + AttributeItemUtil.writeMagicAttribute(held, attrKey, magicId, value); sendResult(sender, "Applied magic attribute " + attrKey + " with magicID " + magicId + " and value " + value + " to held item."); } else { if(args.length < 2){ @@ -140,7 +140,7 @@ public class AttributeCommand extends CommandKamkeelBase { sendError(sender, "Invalid number format for value."); return; } - ItemAttributeHelper.applyAttribute(held, attrKey, value); + AttributeItemUtil.applyAttribute(held, attrKey, value); sendResult(sender, "Applied attribute " + attrKey + " with value " + value + " to held item."); } } @@ -187,10 +187,10 @@ public class AttributeCommand extends CommandKamkeelBase { return; } - ItemAttributeHelper.removeMagicAttribute(held, attrKey, magicId); + AttributeItemUtil.removeMagicAttribute(held, attrKey, magicId); sendResult(sender, "Removed magic attribute " + attrKey + " (magicID " + magicId + ") from held item."); } else { - ItemAttributeHelper.removeAttribute(held, attrKey); + AttributeItemUtil.removeAttribute(held, attrKey); sendResult(sender, "Removed attribute " + attrKey + " from held item."); } } diff --git a/src/main/java/kamkeel/npcs/command/CommandKamkeel.java b/src/main/java/kamkeel/npcs/command/CommandKamkeel.java index bdf214769..e91c536bc 100644 --- a/src/main/java/kamkeel/npcs/command/CommandKamkeel.java +++ b/src/main/java/kamkeel/npcs/command/CommandKamkeel.java @@ -6,8 +6,8 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import noppes.npcs.CustomNpcsPermissions; -import noppes.npcs.attribute.AttributeController; -import noppes.npcs.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.AttributeController; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; import noppes.npcs.config.ConfigMain; import noppes.npcs.scripted.CustomNPCsException; diff --git a/src/main/java/kamkeel/npcs/command/profile/CommandProfileAdmin.java b/src/main/java/kamkeel/npcs/command/profile/CommandProfileAdmin.java index 4bc21da09..f68fd129d 100644 --- a/src/main/java/kamkeel/npcs/command/profile/CommandProfileAdmin.java +++ b/src/main/java/kamkeel/npcs/command/profile/CommandProfileAdmin.java @@ -1,10 +1,10 @@ package kamkeel.npcs.command.profile; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.EnumProfileOperation; +import kamkeel.npcs.controllers.data.profile.EnumProfileOperation; import noppes.npcs.api.handler.data.ISlot; -import kamkeel.npcs.controllers.data.Profile; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.Profile; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/kamkeel/npcs/command/profile/CommandProfileChange.java b/src/main/java/kamkeel/npcs/command/profile/CommandProfileChange.java index b7373aa34..481664626 100644 --- a/src/main/java/kamkeel/npcs/command/profile/CommandProfileChange.java +++ b/src/main/java/kamkeel/npcs/command/profile/CommandProfileChange.java @@ -1,8 +1,8 @@ package kamkeel.npcs.command.profile; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.EnumProfileOperation; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.EnumProfileOperation; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/kamkeel/npcs/command/profile/CommandProfileCreate.java b/src/main/java/kamkeel/npcs/command/profile/CommandProfileCreate.java index 6b06f266a..bda50bd85 100644 --- a/src/main/java/kamkeel/npcs/command/profile/CommandProfileCreate.java +++ b/src/main/java/kamkeel/npcs/command/profile/CommandProfileCreate.java @@ -1,8 +1,8 @@ package kamkeel.npcs.command.profile; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.EnumProfileOperation; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.EnumProfileOperation; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/kamkeel/npcs/command/profile/CommandProfileList.java b/src/main/java/kamkeel/npcs/command/profile/CommandProfileList.java index 17e82fcce..4463a1f58 100644 --- a/src/main/java/kamkeel/npcs/command/profile/CommandProfileList.java +++ b/src/main/java/kamkeel/npcs/command/profile/CommandProfileList.java @@ -2,7 +2,7 @@ package kamkeel.npcs.command.profile; import kamkeel.npcs.controllers.ProfileController; import noppes.npcs.api.handler.data.ISlot; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.Profile; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/kamkeel/npcs/command/profile/CommandProfileRemove.java b/src/main/java/kamkeel/npcs/command/profile/CommandProfileRemove.java index a80d76f8b..3c3247895 100644 --- a/src/main/java/kamkeel/npcs/command/profile/CommandProfileRemove.java +++ b/src/main/java/kamkeel/npcs/command/profile/CommandProfileRemove.java @@ -1,8 +1,8 @@ package kamkeel.npcs.command.profile; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.EnumProfileOperation; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.EnumProfileOperation; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/noppes/npcs/attribute/AttributeController.java b/src/main/java/kamkeel/npcs/controllers/AttributeController.java similarity index 84% rename from src/main/java/noppes/npcs/attribute/AttributeController.java rename to src/main/java/kamkeel/npcs/controllers/AttributeController.java index 70bd56ba1..9e9687f16 100644 --- a/src/main/java/noppes/npcs/attribute/AttributeController.java +++ b/src/main/java/kamkeel/npcs/controllers/AttributeController.java @@ -1,7 +1,10 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.controllers; import net.minecraft.entity.player.EntityPlayer; -import noppes.npcs.attribute.player.PlayerAttributeTracker; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.data.attribute.AttributeValueType; +import kamkeel.npcs.CustomAttributes; +import kamkeel.npcs.controllers.data.attribute.tracker.PlayerAttributeTracker; import java.util.Collection; import java.util.HashMap; @@ -15,7 +18,7 @@ import java.util.UUID; public class AttributeController { public AttributeController Instance; - public ModAttributes attributes; + public CustomAttributes attributes; // Tracking Player Attributes private static final Map trackers = new HashMap<>(); @@ -25,7 +28,7 @@ public class AttributeController { this.Instance = this; definitions.clear(); trackers.clear(); - attributes = new ModAttributes(); + attributes = new CustomAttributes(); } diff --git a/src/main/java/kamkeel/npcs/controllers/ProfileController.java b/src/main/java/kamkeel/npcs/controllers/ProfileController.java index 0a4078450..ce689924c 100644 --- a/src/main/java/kamkeel/npcs/controllers/ProfileController.java +++ b/src/main/java/kamkeel/npcs/controllers/ProfileController.java @@ -1,6 +1,6 @@ package kamkeel.npcs.controllers; -import kamkeel.npcs.controllers.data.*; +import kamkeel.npcs.controllers.data.profile.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; @@ -596,8 +596,8 @@ public class ProfileController implements IProfileHandler { } } - public List getProfileInfo(EntityPlayer player, int slotId) { - List infoList = new ArrayList<>(); + public List getProfileInfo(EntityPlayer player, int slotId) { + List infoList = new ArrayList<>(); Profile profile = getProfile(player); if (profile == null) return infoList; @@ -607,7 +607,7 @@ public class ProfileController implements IProfileHandler { if (slotId == profile.getCurrentSlotId()) { for (IProfileData pd : dataList) { NBTTagCompound currentNBT = pd.getCurrentNBT(player); - List subInfo = pd.getInfo(player, currentNBT); + List subInfo = pd.getInfo(player, currentNBT); infoList.addAll(subInfo); } } else { @@ -617,7 +617,7 @@ public class ProfileController implements IProfileHandler { for (IProfileData pd : dataList) { if (slot.getComponents().containsKey(pd.getTagName())) { NBTTagCompound sub = slot.getComponentData(pd.getTagName()); - List subInfo = pd.getInfo(player, sub); + List subInfo = pd.getInfo(player, sub); infoList.addAll(subInfo); } } diff --git a/src/main/java/noppes/npcs/attribute/AttributeDefinition.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeDefinition.java similarity index 95% rename from src/main/java/noppes/npcs/attribute/AttributeDefinition.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeDefinition.java index 16875e489..9b316c669 100644 --- a/src/main/java/noppes/npcs/attribute/AttributeDefinition.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeDefinition.java @@ -1,4 +1,4 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.controllers.data.attribute; public class AttributeDefinition { private final String key; // e.g., "main_attack_flat" diff --git a/src/main/java/noppes/npcs/attribute/AttributeValueType.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeValueType.java similarity index 81% rename from src/main/java/noppes/npcs/attribute/AttributeValueType.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeValueType.java index c986bcd35..0850182fe 100644 --- a/src/main/java/noppes/npcs/attribute/AttributeValueType.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/AttributeValueType.java @@ -1,4 +1,4 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.controllers.data.attribute; public enum AttributeValueType { FLAT, // e.g., +10 Health or +3 Damage diff --git a/src/main/java/noppes/npcs/attribute/ICustomAttribute.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/ICustomAttribute.java similarity index 83% rename from src/main/java/noppes/npcs/attribute/ICustomAttribute.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/ICustomAttribute.java index c88b7a5fc..98baab742 100644 --- a/src/main/java/noppes/npcs/attribute/ICustomAttribute.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/ICustomAttribute.java @@ -1,4 +1,4 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.controllers.data.attribute; /** * IAttributeInstance represents an instance of an attribute (with a base value and applied modifiers). diff --git a/src/main/java/noppes/npcs/attribute/player/PlayerAttribute.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttribute.java similarity index 80% rename from src/main/java/noppes/npcs/attribute/player/PlayerAttribute.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttribute.java index b435da478..dcd918225 100644 --- a/src/main/java/noppes/npcs/attribute/player/PlayerAttribute.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttribute.java @@ -1,9 +1,6 @@ -package noppes.npcs.attribute.player; +package kamkeel.npcs.controllers.data.attribute; -import noppes.npcs.attribute.AttributeDefinition; -import noppes.npcs.attribute.ICustomAttribute; - public class PlayerAttribute implements ICustomAttribute { private final AttributeDefinition attribute; private float baseValue; diff --git a/src/main/java/noppes/npcs/attribute/player/PlayerAttributeMap.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttributeMap.java similarity index 86% rename from src/main/java/noppes/npcs/attribute/player/PlayerAttributeMap.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttributeMap.java index cf04e6c7b..b489cf192 100644 --- a/src/main/java/noppes/npcs/attribute/player/PlayerAttributeMap.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/PlayerAttributeMap.java @@ -1,7 +1,4 @@ -package noppes.npcs.attribute.player; - -import noppes.npcs.attribute.AttributeDefinition; -import noppes.npcs.attribute.ICustomAttribute; +package kamkeel.npcs.controllers.data.attribute; import java.util.Collection; import java.util.HashMap; diff --git a/src/main/java/noppes/npcs/attribute/player/PlayerAttributeTracker.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerAttributeTracker.java similarity index 82% rename from src/main/java/noppes/npcs/attribute/player/PlayerAttributeTracker.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerAttributeTracker.java index afaebefdb..0e4c5395f 100644 --- a/src/main/java/noppes/npcs/attribute/player/PlayerAttributeTracker.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerAttributeTracker.java @@ -1,16 +1,22 @@ -package noppes.npcs.attribute.player; +package kamkeel.npcs.controllers.data.attribute.tracker; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.Map.Entry; +import kamkeel.npcs.CustomAttributes; +import kamkeel.npcs.controllers.AttributeController; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.data.attribute.ICustomAttribute; +import kamkeel.npcs.controllers.data.attribute.PlayerAttributeMap; +import kamkeel.npcs.util.AttributeAttackUtil; +import kamkeel.npcs.util.AttributeItemUtil; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import noppes.npcs.attribute.*; public class PlayerAttributeTracker { @@ -56,7 +62,7 @@ public class PlayerAttributeTracker { ItemStack[] equipment = new ItemStack[] { currentEquip.heldItem, currentEquip.boots, currentEquip.leggings, currentEquip.chestplate, currentEquip.helmet }; for (ItemStack piece : equipment) { if (piece != null) { - for (Entry entry : ItemAttributeHelper.readAttributes(piece).entrySet()) { + for (Entry entry : AttributeItemUtil.readAttributes(piece).entrySet()) { String key = entry.getKey(); float value = entry.getValue(); AttributeDefinition def = AttributeController.getAttribute(key); @@ -71,13 +77,13 @@ public class PlayerAttributeTracker { // Process Magic // OFFENSIVE MAGIC - Map magicFlat = ItemAttributeHelper.readMagicAttributeMap(piece, ModAttributes.MAGIC_DAMAGE_KEY); + Map magicFlat = AttributeItemUtil.readMagicAttributeMap(piece, CustomAttributes.MAGIC_DAMAGE_KEY); for (Entry entry : magicFlat.entrySet()) { int magicId = entry.getKey(); float value = entry.getValue(); magicDamage.put(magicId, magicDamage.getOrDefault(magicId, 0.0f) + value); } - Map magicPercent = ItemAttributeHelper.readMagicAttributeMap(piece, ModAttributes.MAGIC_BOOST_KEY); + Map magicPercent = AttributeItemUtil.readMagicAttributeMap(piece, CustomAttributes.MAGIC_BOOST_KEY); for (Entry entry : magicPercent.entrySet()) { int magicId = entry.getKey(); float value = entry.getValue(); @@ -85,13 +91,13 @@ public class PlayerAttributeTracker { } // DEFENSIVE MAGIC - Map magicDefFlat = ItemAttributeHelper.readMagicAttributeMap(piece, ModAttributes.MAGIC_DEFENSE_KEY); + Map magicDefFlat = AttributeItemUtil.readMagicAttributeMap(piece, CustomAttributes.MAGIC_DEFENSE_KEY); for (Entry entry : magicDefFlat.entrySet()) { int magicId = entry.getKey(); float value = entry.getValue(); magicDefense.put(magicId, magicDefense.getOrDefault(magicId, 0.0f) + value); } - Map magicResist = ItemAttributeHelper.readMagicAttributeMap(piece, ModAttributes.MAGIC_RESISTANCE_KEY); + Map magicResist = AttributeItemUtil.readMagicAttributeMap(piece, CustomAttributes.MAGIC_RESISTANCE_KEY); for (Entry entry : magicResist.entrySet()) { int magicId = entry.getKey(); float value = entry.getValue(); @@ -100,8 +106,8 @@ public class PlayerAttributeTracker { } } equipmentTracker = currentEquip; - maximumOutput = AttributeAttackHelper.calculateMaximumOutput(this); - extraHealth = getAttributeValue(ModAttributes.HEALTH); + maximumOutput = AttributeAttackUtil.calculateMaximumOutput(this); + extraHealth = getAttributeValue(CustomAttributes.HEALTH); updatePlayerMaxHealth(player); } diff --git a/src/main/java/noppes/npcs/attribute/player/PlayerEquipmentTracker.java b/src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerEquipmentTracker.java similarity index 83% rename from src/main/java/noppes/npcs/attribute/player/PlayerEquipmentTracker.java rename to src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerEquipmentTracker.java index ba216e2a5..c6862b207 100644 --- a/src/main/java/noppes/npcs/attribute/player/PlayerEquipmentTracker.java +++ b/src/main/java/kamkeel/npcs/controllers/data/attribute/tracker/PlayerEquipmentTracker.java @@ -1,9 +1,9 @@ -package noppes.npcs.attribute.player; +package kamkeel.npcs.controllers.data.attribute.tracker; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import noppes.npcs.attribute.ItemAttributeHelper; +import kamkeel.npcs.util.AttributeItemUtil; public class PlayerEquipmentTracker { public ItemStack heldItem; @@ -57,10 +57,10 @@ public class PlayerEquipmentTracker { if (a.getItem() != b.getItem()) return false; NBTTagCompound tagA = a.stackTagCompound; NBTTagCompound tagB = b.stackTagCompound; - String attrA = (tagA != null && tagA.hasKey(ItemAttributeHelper.RPGItemAttributes)) - ? tagA.getCompoundTag(ItemAttributeHelper.RPGItemAttributes).toString() : ""; - String attrB = (tagB != null && tagB.hasKey(ItemAttributeHelper.RPGItemAttributes)) - ? tagB.getCompoundTag(ItemAttributeHelper.RPGItemAttributes).toString() : ""; + String attrA = (tagA != null && tagA.hasKey(AttributeItemUtil.RPGItemAttributes)) + ? tagA.getCompoundTag(AttributeItemUtil.RPGItemAttributes).toString() : ""; + String attrB = (tagB != null && tagB.hasKey(AttributeItemUtil.RPGItemAttributes)) + ? tagB.getCompoundTag(AttributeItemUtil.RPGItemAttributes).toString() : ""; return attrA.equals(attrB); } } diff --git a/src/main/java/kamkeel/npcs/controllers/data/CNPCData.java b/src/main/java/kamkeel/npcs/controllers/data/profile/CNPCData.java similarity index 75% rename from src/main/java/kamkeel/npcs/controllers/data/CNPCData.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/CNPCData.java index 9da19b00f..3b923b792 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/CNPCData.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/CNPCData.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; import kamkeel.npcs.controllers.SyncController; import net.minecraft.entity.player.EntityPlayer; @@ -58,15 +58,15 @@ public class CNPCData implements IProfileData { } @Override - public List getInfo(EntityPlayer player, NBTTagCompound compound) { + public List getInfo(EntityPlayer player, NBTTagCompound compound) { PlayerData playerData = new PlayerData(); playerData.player = player; playerData.setNBT(compound); - List info = new ArrayList<>(); - info.add(new InfoEntry("profile.info.quest.finished", 0x60fa57, playerData.questData.finishedQuests.size(), 0xFFFFFF)); - info.add(new InfoEntry("profile.info.quest.active", 0xf75336, playerData.questData.activeQuests.size(), 0xFFFFFF)); - info.add(new InfoEntry("profile.info.dialog.read", 0x47acf5, playerData.dialogData.dialogsRead.size(), 0xFFFFFF)); + List info = new ArrayList<>(); + info.add(new ProfileInfoEntry("profile.info.quest.finished", 0x60fa57, playerData.questData.finishedQuests.size(), 0xFFFFFF)); + info.add(new ProfileInfoEntry("profile.info.quest.active", 0xf75336, playerData.questData.activeQuests.size(), 0xFFFFFF)); + info.add(new ProfileInfoEntry("profile.info.dialog.read", 0x47acf5, playerData.dialogData.dialogsRead.size(), 0xFFFFFF)); return info; } } diff --git a/src/main/java/kamkeel/npcs/controllers/data/EnumProfileOperation.java b/src/main/java/kamkeel/npcs/controllers/data/profile/EnumProfileOperation.java similarity index 60% rename from src/main/java/kamkeel/npcs/controllers/data/EnumProfileOperation.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/EnumProfileOperation.java index b4c10d3ec..7b5e45543 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/EnumProfileOperation.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/EnumProfileOperation.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; public enum EnumProfileOperation { SUCCESS, diff --git a/src/main/java/kamkeel/npcs/controllers/data/IProfileData.java b/src/main/java/kamkeel/npcs/controllers/data/profile/IProfileData.java similarity index 91% rename from src/main/java/kamkeel/npcs/controllers/data/IProfileData.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/IProfileData.java index b84af3d7d..1fc00168e 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/IProfileData.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/IProfileData.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -48,5 +48,5 @@ public interface IProfileData { * @param compound The NBT data from the slot under this profile data's tag. * @return A list of InfoEntry with information */ - public List getInfo(EntityPlayer player, NBTTagCompound compound); + public List getInfo(EntityPlayer player, NBTTagCompound compound); } diff --git a/src/main/java/kamkeel/npcs/controllers/data/Profile.java b/src/main/java/kamkeel/npcs/controllers/data/profile/Profile.java similarity index 98% rename from src/main/java/kamkeel/npcs/controllers/data/Profile.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/Profile.java index d1be4fd40..d09bf4369 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/Profile.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/Profile.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/java/kamkeel/npcs/controllers/data/InfoEntry.java b/src/main/java/kamkeel/npcs/controllers/data/profile/ProfileInfoEntry.java similarity index 70% rename from src/main/java/kamkeel/npcs/controllers/data/InfoEntry.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/ProfileInfoEntry.java index 7a8f29991..6adef4e67 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/InfoEntry.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/ProfileInfoEntry.java @@ -1,27 +1,27 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; import net.minecraft.nbt.NBTTagCompound; -public class InfoEntry { +public class ProfileInfoEntry { private String label; private String result; private int labelColor; private int resultColor; - public InfoEntry() {} + public ProfileInfoEntry() {} - public InfoEntry(String label, int labelColor, String result, int resultColor) { + public ProfileInfoEntry(String label, int labelColor, String result, int resultColor) { this.label = label; this.result = result; this.labelColor = labelColor; this.resultColor = resultColor; } - public InfoEntry(String label, int labelColor, int result, int resultColor) { + public ProfileInfoEntry(String label, int labelColor, int result, int resultColor) { this(label, labelColor, String.valueOf(result), resultColor); } - public InfoEntry(String label, String result) { + public ProfileInfoEntry(String label, String result) { this(label, 0xFFFFFF, result, 0xFFFFFF); } @@ -34,8 +34,8 @@ public class InfoEntry { return tag; } - public static InfoEntry readFromNBT(NBTTagCompound tag) { - return new InfoEntry( + public static ProfileInfoEntry readFromNBT(NBTTagCompound tag) { + return new ProfileInfoEntry( tag.getString("Label"), tag.getInteger("LabelColor"), tag.getString("Result"), diff --git a/src/main/java/kamkeel/npcs/controllers/data/ProfileOperation.java b/src/main/java/kamkeel/npcs/controllers/data/profile/ProfileOperation.java similarity index 94% rename from src/main/java/kamkeel/npcs/controllers/data/ProfileOperation.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/ProfileOperation.java index 7c3844794..72a5bb8c0 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ProfileOperation.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/ProfileOperation.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; public class ProfileOperation { private final EnumProfileOperation result; diff --git a/src/main/java/kamkeel/npcs/controllers/data/Slot.java b/src/main/java/kamkeel/npcs/controllers/data/profile/Slot.java similarity index 98% rename from src/main/java/kamkeel/npcs/controllers/data/Slot.java rename to src/main/java/kamkeel/npcs/controllers/data/profile/Slot.java index 6c74b47c3..03a2978c1 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/Slot.java +++ b/src/main/java/kamkeel/npcs/controllers/data/profile/Slot.java @@ -1,4 +1,4 @@ -package kamkeel.npcs.controllers.data; +package kamkeel.npcs.controllers.data.profile; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.api.handler.data.ISlot; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileChangePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileChangePacket.java index 19c62ffff..da7cb8236 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileChangePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileChangePacket.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileCreatePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileCreatePacket.java index b8d50e6d4..6438ab9bc 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileCreatePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileCreatePacket.java @@ -4,8 +4,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.Profile; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.Profile; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetInfoPacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetInfoPacket.java index 50f9d8fe1..46a755cd6 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetInfoPacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetInfoPacket.java @@ -5,8 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; import noppes.npcs.api.handler.data.ISlot; -import kamkeel.npcs.controllers.data.InfoEntry; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.ProfileInfoEntry; +import kamkeel.npcs.controllers.data.profile.Profile; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; @@ -64,9 +64,9 @@ public final class ProfileGetInfoPacket extends AbstractPacket { NBTTagCompound slotCompound = new NBTTagCompound(); NBTTagList infoList = new NBTTagList(); slotCompound.setInteger("ID", slot.getId()); - List profileInfo = ProfileController.Instance.getProfileInfo(player, slot.getId()); - for(InfoEntry infoEntry : profileInfo){ - infoList.appendTag(infoEntry.writeToNBT()); + List profileInfo = ProfileController.Instance.getProfileInfo(player, slot.getId()); + for(ProfileInfoEntry profileInfoEntry : profileInfo){ + infoList.appendTag(profileInfoEntry.writeToNBT()); } slotCompound.setTag("INFO", infoList); slotList.appendTag(slotCompound); @@ -76,8 +76,8 @@ public final class ProfileGetInfoPacket extends AbstractPacket { GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound); } - public static HashMap> readProfileInfo(NBTTagCompound compound) { - HashMap> slotInfoMap = new HashMap<>(); + public static HashMap> readProfileInfo(NBTTagCompound compound) { + HashMap> slotInfoMap = new HashMap<>(); if (!compound.getBoolean("PROFILE_INFO")) return slotInfoMap; @@ -89,10 +89,10 @@ public final class ProfileGetInfoPacket extends AbstractPacket { int slotId = slotCompound.getInteger("ID"); NBTTagList infoList = slotCompound.getTagList("INFO", Constants.NBT.TAG_COMPOUND); - List infoEntries = new ArrayList<>(); + List infoEntries = new ArrayList<>(); for (int j = 0; j < infoList.tagCount(); j++) { NBTTagCompound infoTag = infoList.getCompoundTagAt(j); - infoEntries.add(InfoEntry.readFromNBT(infoTag)); // Convert back to InfoEntry + infoEntries.add(ProfileInfoEntry.readFromNBT(infoTag)); // Convert back to InfoEntry } slotInfoMap.put(slotId, infoEntries); diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetPacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetPacket.java index ffbdb4997..94d577b30 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetPacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileGetPacket.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.Profile; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRemovePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRemovePacket.java index c762b435b..111c8ab98 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRemovePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRemovePacket.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.ProfileOperation; +import kamkeel.npcs.controllers.data.profile.ProfileOperation; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRenamePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRenamePacket.java index d692e1ed9..354b60e24 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRenamePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/profile/ProfileRenamePacket.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.Profile; import kamkeel.npcs.network.AbstractPacket; import kamkeel.npcs.network.PacketChannel; import kamkeel.npcs.network.PacketHandler; diff --git a/src/main/java/noppes/npcs/attribute/AttributeAttackHelper.java b/src/main/java/kamkeel/npcs/util/AttributeAttackUtil.java similarity index 79% rename from src/main/java/noppes/npcs/attribute/AttributeAttackHelper.java rename to src/main/java/kamkeel/npcs/util/AttributeAttackUtil.java index 0ff177f63..514e3d2ea 100644 --- a/src/main/java/noppes/npcs/attribute/AttributeAttackHelper.java +++ b/src/main/java/kamkeel/npcs/util/AttributeAttackUtil.java @@ -1,16 +1,17 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.util; +import kamkeel.npcs.CustomAttributes; import net.minecraft.entity.player.EntityPlayer; -import noppes.npcs.attribute.player.PlayerAttributeTracker; +import kamkeel.npcs.controllers.data.attribute.tracker.PlayerAttributeTracker; import noppes.npcs.controllers.MagicController; import noppes.npcs.entity.EntityNPCInterface; import java.util.Map; import java.util.Random; -import static noppes.npcs.attribute.AttributeController.getTracker; +import static kamkeel.npcs.controllers.AttributeController.getTracker; -public class AttributeAttackHelper { +public class AttributeAttackUtil { private static final Random random = new Random(); public static float calculateDamagePlayer(EntityPlayer attacker, EntityPlayer defender, float base){ @@ -20,13 +21,13 @@ public class AttributeAttackHelper { public static float calculateDamagePlayer(PlayerAttributeTracker attacker, PlayerAttributeTracker defender, float baseDamage) { // Calculate physical damage - float mainAttack = attacker.getAttributeValue(ModAttributes.MAIN_ATTACK); - float mainBoost = attacker.getAttributeValue(ModAttributes.MAIN_BOOST) + 1; + float mainAttack = attacker.getAttributeValue(CustomAttributes.MAIN_ATTACK); + float mainBoost = attacker.getAttributeValue(CustomAttributes.MAIN_BOOST) + 1; float physicalDamage = (baseDamage * mainBoost) + mainAttack; // Calculate neutral damage - float neutralDamage = attacker.getAttributeValue(ModAttributes.NEUTRAL_ATTACK); - float neutralBoost = attacker.getAttributeValue(ModAttributes.NEUTRAL_BOOST) + 1; + float neutralDamage = attacker.getAttributeValue(CustomAttributes.NEUTRAL_ATTACK); + float neutralBoost = attacker.getAttributeValue(CustomAttributes.NEUTRAL_BOOST) + 1; float neutralTotal = neutralDamage * neutralBoost; // Calculate magic damage @@ -53,8 +54,8 @@ public class AttributeAttackHelper { float totalDamage = physicalDamage + neutralTotal + magicTotal; // Critical hit: if critical, float damage and add bonus - float criticalChance = attacker.getAttributeValue(ModAttributes.CRITICAL_CHANCE); - float criticalBonus = attacker.getAttributeValue(ModAttributes.CRITICAL_DAMAGE); + float criticalChance = attacker.getAttributeValue(CustomAttributes.CRITICAL_CHANCE); + float criticalBonus = attacker.getAttributeValue(CustomAttributes.CRITICAL_DAMAGE); if (random.nextFloat() < (criticalChance / 100)) { totalDamage = (totalDamage * 2) + criticalBonus; } @@ -65,13 +66,13 @@ public class AttributeAttackHelper { public static float calculateDamageNPC(PlayerAttributeTracker attacker, EntityNPCInterface defender, float baseDamage) { // Calculate physical damage - float mainAttack = attacker.getAttributeValue(ModAttributes.MAIN_ATTACK); - float mainBoost = attacker.getAttributeValue(ModAttributes.MAIN_BOOST) + 1; + float mainAttack = attacker.getAttributeValue(CustomAttributes.MAIN_ATTACK); + float mainBoost = attacker.getAttributeValue(CustomAttributes.MAIN_BOOST) + 1; float physicalDamage = (baseDamage * mainBoost) + mainAttack; // Calculate neutral damage - float neutralDamage = attacker.getAttributeValue(ModAttributes.NEUTRAL_ATTACK); - float neutralBoost = attacker.getAttributeValue(ModAttributes.NEUTRAL_BOOST) + 1; + float neutralDamage = attacker.getAttributeValue(CustomAttributes.NEUTRAL_ATTACK); + float neutralBoost = attacker.getAttributeValue(CustomAttributes.NEUTRAL_BOOST) + 1; float neutralTotal = neutralDamage * neutralBoost; // Calculate magic damage @@ -117,8 +118,8 @@ public class AttributeAttackHelper { */ public static float calculateMaximumOutput(PlayerAttributeTracker attacker) { // Neutral damage remains unchanged. - float neutralDamage = attacker.getAttributeValue(ModAttributes.NEUTRAL_ATTACK); - float neutralBoost = attacker.getAttributeValue(ModAttributes.NEUTRAL_BOOST) + 1; + float neutralDamage = attacker.getAttributeValue(CustomAttributes.NEUTRAL_ATTACK); + float neutralBoost = attacker.getAttributeValue(CustomAttributes.NEUTRAL_BOOST) + 1; float neutralTotal = neutralDamage * neutralBoost; // For magic damage, we ignore any defensive values. @@ -145,8 +146,8 @@ public class AttributeAttackHelper { public static float calculateOutgoing(EntityPlayer entityPlayer, float baseDamage) { PlayerAttributeTracker attacker = getTracker(entityPlayer); - float mainAttack = attacker.getAttributeValue(ModAttributes.MAIN_ATTACK); - float mainBoost = attacker.getAttributeValue(ModAttributes.MAIN_BOOST) + 1; + float mainAttack = attacker.getAttributeValue(CustomAttributes.MAIN_ATTACK); + float mainBoost = attacker.getAttributeValue(CustomAttributes.MAIN_BOOST) + 1; float physicalDamage = (baseDamage * mainBoost) + mainAttack; return attacker.maximumOutput + physicalDamage; } diff --git a/src/main/java/noppes/npcs/attribute/ItemAttributeHelper.java b/src/main/java/kamkeel/npcs/util/AttributeItemUtil.java similarity index 94% rename from src/main/java/noppes/npcs/attribute/ItemAttributeHelper.java rename to src/main/java/kamkeel/npcs/util/AttributeItemUtil.java index fa66b9912..78f0f300a 100644 --- a/src/main/java/noppes/npcs/attribute/ItemAttributeHelper.java +++ b/src/main/java/kamkeel/npcs/util/AttributeItemUtil.java @@ -1,12 +1,15 @@ -package noppes.npcs.attribute; +package kamkeel.npcs.util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; +import kamkeel.npcs.controllers.AttributeController; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import kamkeel.npcs.controllers.data.attribute.AttributeDefinition; +import kamkeel.npcs.controllers.data.attribute.AttributeValueType; +import kamkeel.npcs.CustomAttributes; import noppes.npcs.client.ClientProxy; import noppes.npcs.controllers.MagicController; import noppes.npcs.controllers.data.Magic; @@ -14,15 +17,12 @@ import org.lwjgl.input.Keyboard; import java.util.*; -import static noppes.npcs.attribute.AttributeDefinition.AttributeSection.INFO; -import static noppes.npcs.attribute.AttributeDefinition.AttributeSection.MODIFIER; - /** * Provides helper functions to write/read item attributes to/from NBT. * Non–magic attributes are stored under a compound tag (TAG_ROOT), * and magic attributes are stored as a compound mapping (by magic ID) under specific keys. */ -public class ItemAttributeHelper { +public class AttributeItemUtil { public static final String RPGItemAttributes = "RPGCoreAttributes"; /** @@ -161,8 +161,8 @@ public class ItemAttributeHelper { while (iter.hasNext()) { String key = iter.next(); // Skip magic attribute keys; they are handled separately. - if(key.equals(ModAttributes.MAGIC_DAMAGE_KEY) || key.equals(ModAttributes.MAGIC_BOOST_KEY) - || key.equals(ModAttributes.MAGIC_DEFENSE_KEY) || key.equals(ModAttributes.MAGIC_RESISTANCE_KEY)) { + if(key.equals(CustomAttributes.MAGIC_DAMAGE_KEY) || key.equals(CustomAttributes.MAGIC_BOOST_KEY) + || key.equals(CustomAttributes.MAGIC_DEFENSE_KEY) || key.equals(CustomAttributes.MAGIC_RESISTANCE_KEY)) { continue; } Float value = attrTag.getFloat(key); @@ -212,10 +212,10 @@ public class ItemAttributeHelper { private static void processMagicAttributes(NBTTagCompound compound, List baseList, List modifierList, List infoList, List extraList) { String[] magicKeys = { - ModAttributes.MAGIC_DAMAGE_KEY, - ModAttributes.MAGIC_BOOST_KEY, - ModAttributes.MAGIC_DEFENSE_KEY, - ModAttributes.MAGIC_RESISTANCE_KEY + CustomAttributes.MAGIC_DAMAGE_KEY, + CustomAttributes.MAGIC_BOOST_KEY, + CustomAttributes.MAGIC_DEFENSE_KEY, + CustomAttributes.MAGIC_RESISTANCE_KEY }; for (String magicKey : magicKeys) { if (compound.hasKey(magicKey)) { @@ -260,9 +260,9 @@ public class ItemAttributeHelper { @SideOnly(Side.CLIENT) private static String getMagicAppendix(String type){ switch(type){ - case ModAttributes.MAGIC_DEFENSE_KEY: + case CustomAttributes.MAGIC_DEFENSE_KEY: return StatCollector.translateToLocal("rpgcore:attribute.defense"); - case ModAttributes.MAGIC_RESISTANCE_KEY: + case CustomAttributes.MAGIC_RESISTANCE_KEY: return StatCollector.translateToLocal("rpgcore:attribute.resistance"); default: return StatCollector.translateToLocal("rpgcore:attribute.damage"); diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java index a474044e9..c8dddba3d 100644 --- a/src/main/java/noppes/npcs/CustomNpcs.java +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -13,7 +13,7 @@ import kamkeel.npcs.addon.AddonManager; import kamkeel.npcs.command.CommandKamkeel; import kamkeel.npcs.command.profile.CommandProfile; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.CNPCData; +import kamkeel.npcs.controllers.data.profile.CNPCData; import kamkeel.npcs.developer.Developer; import kamkeel.npcs.network.PacketHandler; import net.minecraft.block.Block; @@ -27,7 +27,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.MinecraftForge; import nikedemos.markovnames.generators.*; -import noppes.npcs.attribute.AttributeController; +import kamkeel.npcs.controllers.AttributeController; import noppes.npcs.compat.PixelmonHelper; import noppes.npcs.config.ConfigMain; import noppes.npcs.config.LoadConfiguration; diff --git a/src/main/java/noppes/npcs/ScriptPlayerEventHandler.java b/src/main/java/noppes/npcs/ScriptPlayerEventHandler.java index 728439bd9..43eee78a4 100644 --- a/src/main/java/noppes/npcs/ScriptPlayerEventHandler.java +++ b/src/main/java/noppes/npcs/ScriptPlayerEventHandler.java @@ -23,9 +23,8 @@ import net.minecraftforge.event.entity.player.*; import net.minecraftforge.event.world.BlockEvent; import noppes.npcs.api.entity.IPlayer; import noppes.npcs.api.item.IItemCustomizable; -import noppes.npcs.attribute.AttributeController; -import noppes.npcs.attribute.AttributeAttackHelper; -import noppes.npcs.attribute.player.PlayerAttributeTracker; +import kamkeel.npcs.controllers.AttributeController; +import kamkeel.npcs.util.AttributeAttackUtil; import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumQuestType; import noppes.npcs.controllers.CustomEffectController; @@ -478,7 +477,7 @@ public class ScriptPlayerEventHandler { if(event.source.getEntity() instanceof EntityPlayer) { float attackAmount = event.ammount; if(ConfigMain.AttributesEnabled) - attackAmount = AttributeAttackHelper.calculateOutgoing((EntityPlayer) event.source.getEntity(), event.ammount); + attackAmount = AttributeAttackUtil.calculateOutgoing((EntityPlayer) event.source.getEntity(), event.ammount); noppes.npcs.scripted.event.PlayerEvent.AttackEvent pevent1 = new noppes.npcs.scripted.event.PlayerEvent.AttackEvent((IPlayer)NpcAPI.Instance().getIEntity((EntityPlayer)event.source.getEntity()), event.entityLiving, attackAmount, event.source); cancel = cancel || EventHooks.onPlayerAttack(handler, pevent1); @@ -500,9 +499,9 @@ public class ScriptPlayerEventHandler { // Player to Player Interaction if(ConfigMain.AttributesEnabled){ if(event.entityLiving instanceof EntityPlayer && source instanceof EntityPlayer){ - event.ammount = AttributeAttackHelper.calculateDamagePlayer((EntityPlayer) event.entityLiving, (EntityPlayer) source, event.ammount); + event.ammount = AttributeAttackUtil.calculateDamagePlayer((EntityPlayer) event.entityLiving, (EntityPlayer) source, event.ammount); } else if (!(event.entityLiving instanceof EntityNPCInterface) && source instanceof EntityPlayer){ - event.ammount = AttributeAttackHelper.calculateOutgoing((EntityPlayer) event.entityLiving, event.ammount); + event.ammount = AttributeAttackUtil.calculateOutgoing((EntityPlayer) event.entityLiving, event.ammount); } } diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiProfiles.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiProfiles.java index c4a805a68..904b637cf 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiProfiles.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiProfiles.java @@ -1,9 +1,9 @@ package noppes.npcs.client.gui.player.inventory; import noppes.npcs.api.handler.data.ISlot; -import kamkeel.npcs.controllers.data.InfoEntry; -import kamkeel.npcs.controllers.data.Profile; -import kamkeel.npcs.controllers.data.Slot; +import kamkeel.npcs.controllers.data.profile.ProfileInfoEntry; +import kamkeel.npcs.controllers.data.profile.Profile; +import kamkeel.npcs.controllers.data.profile.Slot; import kamkeel.npcs.network.PacketClient; import kamkeel.npcs.network.packets.request.profile.*; import net.minecraft.client.gui.GuiButton; @@ -36,7 +36,7 @@ public class GuiProfiles extends GuiCNPCInventory implements ISubGuiListener, IC private String rename; private Profile profile; private Slot slot; - private HashMap> slotInfoMap = new HashMap<>(); + private HashMap> slotInfoMap = new HashMap<>(); private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy HH:mm"); private int scrollY = 0; // Vertical scrolling position @@ -182,8 +182,8 @@ public class GuiProfiles extends GuiCNPCInventory implements ISubGuiListener, IC } if (slotInfoMap.containsKey(slot.getId())) { - List infoEntries = slotInfoMap.get(slot.getId()); - for (InfoEntry entry : infoEntries) { + List infoEntries = slotInfoMap.get(slot.getId()); + for (ProfileInfoEntry entry : infoEntries) { label = StatCollector.translateToLocal(entry.getLabel()); result = StatCollector.translateToLocal(entry.getResult()); labelColor = entry.getLabelColor(); diff --git a/src/main/java/noppes/npcs/controllers/data/PlayerData.java b/src/main/java/noppes/npcs/controllers/data/PlayerData.java index 041b15c0c..233296e33 100644 --- a/src/main/java/noppes/npcs/controllers/data/PlayerData.java +++ b/src/main/java/noppes/npcs/controllers/data/PlayerData.java @@ -2,7 +2,7 @@ package noppes.npcs.controllers.data; import kamkeel.npcs.addon.DBCAddon; import kamkeel.npcs.controllers.ProfileController; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.Profile; import kamkeel.npcs.network.packets.data.AchievementPacket; import kamkeel.npcs.network.packets.data.ChatAlertPacket; import kamkeel.npcs.network.packets.request.party.PartyInvitePacket; diff --git a/src/main/java/noppes/npcs/controllers/data/Quest.java b/src/main/java/noppes/npcs/controllers/data/Quest.java index aab2d65b9..d7f8ccdf8 100644 --- a/src/main/java/noppes/npcs/controllers/data/Quest.java +++ b/src/main/java/noppes/npcs/controllers/data/Quest.java @@ -2,7 +2,7 @@ package noppes.npcs.controllers.data; import kamkeel.npcs.controllers.ProfileController; import noppes.npcs.api.handler.data.ISlot; -import kamkeel.npcs.controllers.data.Profile; +import kamkeel.npcs.controllers.data.profile.Profile; import kamkeel.npcs.network.packets.data.QuestCompletionPacket; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; diff --git a/src/main/java/noppes/npcs/mixin/MixinItemStack.java b/src/main/java/noppes/npcs/mixin/MixinItemStack.java index 13baf133b..95420add9 100644 --- a/src/main/java/noppes/npcs/mixin/MixinItemStack.java +++ b/src/main/java/noppes/npcs/mixin/MixinItemStack.java @@ -3,7 +3,7 @@ package noppes.npcs.mixin; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import noppes.npcs.attribute.ItemAttributeHelper; +import kamkeel.npcs.util.AttributeItemUtil; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.List; -import static noppes.npcs.attribute.ItemAttributeHelper.RPGItemAttributes; +import static kamkeel.npcs.util.AttributeItemUtil.RPGItemAttributes; @Mixin(ItemStack.class) public abstract class MixinItemStack { @@ -29,7 +29,7 @@ public abstract class MixinItemStack { public void getAttributeTooltip(EntityPlayer player, boolean advanced, CallbackInfoReturnable> cir) { List tooltip = cir.getReturnValue(); if (hasTagCompound() && getTagCompound().hasKey(RPGItemAttributes)) { - cir.setReturnValue(ItemAttributeHelper.getToolTip(tooltip, getTagCompound())); + cir.setReturnValue(AttributeItemUtil.getToolTip(tooltip, getTagCompound())); } } }