mirror of
https://github.com/GTNewHorizons/ForbiddenMagic.git
synced 2026-11-20 12:09:50 +00:00
Apply spotless
This commit is contained in:
1 parent
bc98fa8da6
commit
45139f4730
147 files changed
+6491
-4294
No files matched your search
@@ -1,12 +1,5 @@
|
||||
package am2.api;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.BaseAttribute;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.IIcon;
|
||||
import am2.api.enchantment.IAMEnchantmentHelper;
|
||||
import am2.api.entities.IEntityManager;
|
||||
import am2.api.flickers.IFlickerRegistry;
|
||||
@@ -21,258 +14,287 @@ import am2.api.spell.enums.SkillPointTypes;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ArsMagicaApi {
|
||||
public static final ArsMagicaApi instance = new ArsMagicaApi();
|
||||
public static final ArsMagicaApi instance = new ArsMagicaApi();
|
||||
|
||||
/**
|
||||
* Easy access to this mod's ID
|
||||
*/
|
||||
public static final String AM2ModID = "arsmagica2";
|
||||
/**
|
||||
* Easy access to this mod's ID
|
||||
*/
|
||||
public static final String AM2ModID = "arsmagica2";
|
||||
|
||||
private static String extendedPropertiesIdentifier;
|
||||
private static String affinityDataIdentifier;
|
||||
private static String skillDataIdentifier;
|
||||
private static String riftStorageIdentifier;
|
||||
private static String extendedPropertiesIdentifier;
|
||||
private static String affinityDataIdentifier;
|
||||
private static String skillDataIdentifier;
|
||||
private static String riftStorageIdentifier;
|
||||
|
||||
/**
|
||||
* Attributes for AM2's properties
|
||||
*/
|
||||
//Bonus to max mana. Applied additively.
|
||||
public static final IAttribute maxManaBonus = new RangedAttribute("am2.maxManaBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Mana Bonus").setShouldWatch(true);
|
||||
//Bonus to max burnout. Applied additively.
|
||||
public static final IAttribute maxBurnoutBonus = new RangedAttribute("am2.maxBurnoutBonus", 0.0f, 0.0f, Double.MAX_VALUE).setDescription("Burnout Bonus").setShouldWatch(true);
|
||||
//Bonus to XP gained. Applied multiplicatively.
|
||||
public static final IAttribute xpGainModifier = new RangedAttribute("am2.xpMultiplier", 1.0f, 0.0f, Double.MAX_VALUE).setDescription("XP Mutiplier").setShouldWatch(true);
|
||||
//Bonus to mana regen rate. Applied multiplicatively.
|
||||
public static final IAttribute manaRegenTimeModifier = new RangedAttribute("am2.manaRegenModifier", 1.0f, 0.5f, 2.0f).setDescription("Mana Regen Rate Multiplier").setShouldWatch(true);
|
||||
//Bonus to burnout reduction rate. Applied multiplicatively.
|
||||
public static final IAttribute burnoutReductionRate = new RangedAttribute("am2.burnoutReduction", 1.0f, 0.1f, 2.0f).setDescription("Burnout Reduction Rate").setShouldWatch(true);
|
||||
/**
|
||||
* Attributes for AM2's properties
|
||||
*/
|
||||
// Bonus to max mana. Applied additively.
|
||||
public static final IAttribute maxManaBonus = new RangedAttribute("am2.maxManaBonus", 0.0f, 0.0f, Double.MAX_VALUE)
|
||||
.setDescription("Mana Bonus")
|
||||
.setShouldWatch(true);
|
||||
// Bonus to max burnout. Applied additively.
|
||||
public static final IAttribute maxBurnoutBonus = new RangedAttribute(
|
||||
"am2.maxBurnoutBonus", 0.0f, 0.0f, Double.MAX_VALUE)
|
||||
.setDescription("Burnout Bonus")
|
||||
.setShouldWatch(true);
|
||||
// Bonus to XP gained. Applied multiplicatively.
|
||||
public static final IAttribute xpGainModifier = new RangedAttribute(
|
||||
"am2.xpMultiplier", 1.0f, 0.0f, Double.MAX_VALUE)
|
||||
.setDescription("XP Mutiplier")
|
||||
.setShouldWatch(true);
|
||||
// Bonus to mana regen rate. Applied multiplicatively.
|
||||
public static final IAttribute manaRegenTimeModifier = new RangedAttribute(
|
||||
"am2.manaRegenModifier", 1.0f, 0.5f, 2.0f)
|
||||
.setDescription("Mana Regen Rate Multiplier")
|
||||
.setShouldWatch(true);
|
||||
// Bonus to burnout reduction rate. Applied multiplicatively.
|
||||
public static final IAttribute burnoutReductionRate = new RangedAttribute("am2.burnoutReduction", 1.0f, 0.1f, 2.0f)
|
||||
.setDescription("Burnout Reduction Rate")
|
||||
.setShouldWatch(true);
|
||||
|
||||
private static final float manaBurnoutRatio = 0.38f;
|
||||
private ArsMagicaApi(){
|
||||
private static final float manaBurnoutRatio = 0.38f;
|
||||
|
||||
}
|
||||
private ArsMagicaApi() {}
|
||||
|
||||
//================================================================================
|
||||
// Getters
|
||||
//================================================================================
|
||||
/**
|
||||
* Gets the spell part manager. Used to register new shapes/components/modifiers/talents
|
||||
*/
|
||||
public final ISpellPartManager getSpellPartManager(){
|
||||
return spellPartManager;
|
||||
}
|
||||
// ================================================================================
|
||||
// Getters
|
||||
// ================================================================================
|
||||
/**
|
||||
* Gets the spell part manager. Used to register new shapes/components/modifiers/talents
|
||||
*/
|
||||
public final ISpellPartManager getSpellPartManager() {
|
||||
return spellPartManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enchantment helper. Used to resolve current enchantment IDs.
|
||||
*/
|
||||
public final IAMEnchantmentHelper getEnchantHelper(){
|
||||
return enchantmentHelper;
|
||||
}
|
||||
/**
|
||||
* Gets the enchantment helper. Used to resolve current enchantment IDs.
|
||||
*/
|
||||
public final IAMEnchantmentHelper getEnchantHelper() {
|
||||
return enchantmentHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the skill tree manager. Used to register spell parts into the skill trees (accessible via occulus)
|
||||
*/
|
||||
public final ISkillTreeManager getSkillTreeManager(){
|
||||
return this.skillTreeManager;
|
||||
}
|
||||
/**
|
||||
* Gets the skill tree manager. Used to register spell parts into the skill trees (accessible via occulus)
|
||||
*/
|
||||
public final ISkillTreeManager getSkillTreeManager() {
|
||||
return this.skillTreeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to calculate the burnout for a spell based on mana cost.
|
||||
*/
|
||||
public static final float getBurnoutFromMana(float manaCost){
|
||||
return manaCost * manaBurnoutRatio;
|
||||
}
|
||||
/**
|
||||
* Helper method to calculate the burnout for a spell based on mana cost.
|
||||
*/
|
||||
public static final float getBurnoutFromMana(float manaCost) {
|
||||
return manaCost * manaBurnoutRatio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the keystone helper instance. Used to check inventories for keys and check access to blocks lockable by keystone.
|
||||
*/
|
||||
public final IKeystoneHelper getKeystoneHelper(){
|
||||
return this.keystoneHelper;
|
||||
}
|
||||
/**
|
||||
* Gets the keystone helper instance. Used to check inventories for keys and check access to blocks lockable by keystone.
|
||||
*/
|
||||
public final IKeystoneHelper getKeystoneHelper() {
|
||||
return this.keystoneHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity manager. Used to blacklist things from the progeny and butchery flicker operators
|
||||
*/
|
||||
public final IEntityManager getEntityManager(){
|
||||
return this.entityManager;
|
||||
}
|
||||
/**
|
||||
* Gets the entity manager. Used to blacklist things from the progeny and butchery flicker operators
|
||||
*/
|
||||
public final IEntityManager getEntityManager() {
|
||||
return this.entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fuel helper instance. Used to register new fuels for the Obelisk.
|
||||
*/
|
||||
public final IObeliskFuelHelper getFuelHelper(){
|
||||
return this.obeliskFuelHelper;
|
||||
}
|
||||
/**
|
||||
* Gets the fuel helper instance. Used to register new fuels for the Obelisk.
|
||||
*/
|
||||
public final IObeliskFuelHelper getFuelHelper() {
|
||||
return this.obeliskFuelHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flicker registry. Used to register new flicker operators into the habitat.
|
||||
*/
|
||||
public final IFlickerRegistry getFlickerOperatorRegistry(){
|
||||
return flickerOperatorRegistry;
|
||||
}
|
||||
/**
|
||||
* Gets the flicker registry. Used to register new flicker operators into the habitat.
|
||||
*/
|
||||
public final IFlickerRegistry getFlickerOperatorRegistry() {
|
||||
return flickerOperatorRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the armor imbuement registry. Used to register new imbuements and check if imbuements are present on a given item stack.
|
||||
*/
|
||||
public final IImbuementRegistry getArmorInfusionRegistry(){
|
||||
return this.armorInfusionRegistry;
|
||||
}
|
||||
/**
|
||||
* Gets the armor imbuement registry. Used to register new imbuements and check if imbuements are present on a given item stack.
|
||||
*/
|
||||
public final IImbuementRegistry getArmorInfusionRegistry() {
|
||||
return this.armorInfusionRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AM recipe manager. Used to register new essence refiner recipes.
|
||||
*/
|
||||
public final IAMRecipeManager getEssenceRecipeManager(){
|
||||
return this.essenceRecipes;
|
||||
}
|
||||
/**
|
||||
* Gets the AM recipe manager. Used to register new essence refiner recipes.
|
||||
*/
|
||||
public final IAMRecipeManager getEssenceRecipeManager() {
|
||||
return this.essenceRecipes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is AM2 running in colourblind mode?
|
||||
*/
|
||||
public final boolean getColourblindMode(){
|
||||
return this.colourblindMode;
|
||||
}
|
||||
/**
|
||||
* Is AM2 running in colourblind mode?
|
||||
*/
|
||||
public final boolean getColourblindMode() {
|
||||
return this.colourblindMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extended properties for the passed in entity living
|
||||
*/
|
||||
public final IExtendedProperties getExtendedProperties(EntityLivingBase entity){
|
||||
return (IExtendedProperties) entity.getExtendedProperties(extendedPropertiesIdentifier);
|
||||
}
|
||||
/**
|
||||
* Returns the extended properties for the passed in entity living
|
||||
*/
|
||||
public final IExtendedProperties getExtendedProperties(EntityLivingBase entity) {
|
||||
return (IExtendedProperties) entity.getExtendedProperties(extendedPropertiesIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the skill data instance (known shapes/modifiers/components/talents)
|
||||
*/
|
||||
public final ISkillData getSkillData(EntityPlayer entity){
|
||||
return (ISkillData) entity.getExtendedProperties(skillDataIdentifier);
|
||||
}
|
||||
/**
|
||||
* Returns the skill data instance (known shapes/modifiers/components/talents)
|
||||
*/
|
||||
public final ISkillData getSkillData(EntityPlayer entity) {
|
||||
return (ISkillData) entity.getExtendedProperties(skillDataIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the affinity data for the passed in entity
|
||||
*/
|
||||
public final IAffinityData getAffinityData(EntityLivingBase entity){
|
||||
return (IAffinityData) entity.getExtendedProperties(affinityDataIdentifier);
|
||||
}
|
||||
/**
|
||||
* Returns the affinity data for the passed in entity
|
||||
*/
|
||||
public final IAffinityData getAffinityData(EntityLivingBase entity) {
|
||||
return (IAffinityData) entity.getExtendedProperties(affinityDataIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rift storage for the passed in player.
|
||||
*/
|
||||
public final IInventory getRiftStorage(EntityPlayer entity){
|
||||
return (IInventory) entity.getExtendedProperties(riftStorageIdentifier);
|
||||
}
|
||||
/**
|
||||
* Returns the rift storage for the passed in player.
|
||||
*/
|
||||
public final IInventory getRiftStorage(EntityPlayer entity) {
|
||||
return (IInventory) entity.getExtendedProperties(riftStorageIdentifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a skill tree entry (Shape, Component, Modifier, or Talent) into the mod
|
||||
* @param entry The skill tree entry to register
|
||||
* @param name The unlocalized name that is used to identify this entry
|
||||
* @param tree Which skill tree the entry should be located in
|
||||
* @param x The x coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param y The y coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param point The type of skill point needed to unlock this entry
|
||||
* @param prerequs Any skill tree entries that are required as prerequisites for this one. All prerequisites must be registered before the current entry.
|
||||
*/
|
||||
public final void registerSkillTreeEntry(ISkillTreeEntry entry, String name, SkillTrees tree, int x, int y, SkillPointTypes point, ISkillTreeEntry...prereqs){
|
||||
spellPartManager.registerSkillTreeEntry(entry, name);
|
||||
skillTreeManager.RegisterPart(entry, x, y, tree, point, prereqs);
|
||||
}
|
||||
/**
|
||||
* Registers a skill tree entry (Shape, Component, Modifier, or Talent) into the mod
|
||||
* @param entry The skill tree entry to register
|
||||
* @param name The unlocalized name that is used to identify this entry
|
||||
* @param tree Which skill tree the entry should be located in
|
||||
* @param x The x coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param y The y coordinate that the entry should be located at in the tree. Typical increments are of 45 to space the items.
|
||||
* @param point The type of skill point needed to unlock this entry
|
||||
* @param prerequs Any skill tree entries that are required as prerequisites for this one. All prerequisites must be registered before the current entry.
|
||||
*/
|
||||
public final void registerSkillTreeEntry(
|
||||
ISkillTreeEntry entry,
|
||||
String name,
|
||||
SkillTrees tree,
|
||||
int x,
|
||||
int y,
|
||||
SkillPointTypes point,
|
||||
ISkillTreeEntry... prereqs) {
|
||||
spellPartManager.registerSkillTreeEntry(entry, name);
|
||||
skillTreeManager.RegisterPart(entry, x, y, tree, point, prereqs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the IIcon to use for the specified skill. This should be called during the API's registerSkillTreeIcons event for each entry that you registered. You get a reference to the ISpellIconManager which has the same method, so this is only here for convenience.
|
||||
* @param name The unlocalized name that was used to register the spell. See {@link #registerSkillTreeEntry(ISkillTreeEntry, String, SkillTrees, int, int, SkillPointTypes, ISkillTreeEntry...) registerSkillTreeEntry} method for more info on the name.
|
||||
* @param IIcon The IIcon to use. You need to register these IIcons with the game beforehand during your mod's load phase - AM won't do it for you.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void registerSkillIcon(String name, IIcon IIcon){
|
||||
spellIconManager.registerIcon(name, IIcon);
|
||||
}
|
||||
/**
|
||||
* Registers the IIcon to use for the specified skill. This should be called during the API's registerSkillTreeIcons event for each entry that you registered. You get a reference to the ISpellIconManager which has the same method, so this is only here for convenience.
|
||||
* @param name The unlocalized name that was used to register the spell. See {@link #registerSkillTreeEntry(ISkillTreeEntry, String, SkillTrees, int, int, SkillPointTypes, ISkillTreeEntry...) registerSkillTreeEntry} method for more info on the name.
|
||||
* @param IIcon The IIcon to use. You need to register these IIcons with the game beforehand during your mod's load phase - AM won't do it for you.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void registerSkillIcon(String name, IIcon IIcon) {
|
||||
spellIconManager.registerIcon(name, IIcon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IIcon manager. This is used to register spell IIcons.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final ISpellIconManager getSpellIconManager(){
|
||||
return spellIconManager;
|
||||
}
|
||||
/**
|
||||
* Returns the IIcon manager. This is used to register spell IIcons.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final ISpellIconManager getSpellIconManager() {
|
||||
return spellIconManager;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// Setters - for AM use only, do not call these.
|
||||
//================================================================================
|
||||
public final void setSpellPartManager(ISpellPartManager manager){
|
||||
if (this.spellPartManager == null){
|
||||
this.spellPartManager = manager;
|
||||
}
|
||||
}
|
||||
public final void setEnchantmentHelper(IAMEnchantmentHelper helper){
|
||||
if (this.enchantmentHelper == null){
|
||||
this.enchantmentHelper = helper;
|
||||
}
|
||||
}
|
||||
public final void setSkillTreeManager(ISkillTreeManager manager){
|
||||
if (this.skillTreeManager == null)
|
||||
this.skillTreeManager = manager;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void setSpellIconManager(ISpellIconManager manager){
|
||||
if (this.spellIconManager == null)
|
||||
this.spellIconManager = manager;
|
||||
}
|
||||
public final void setKeystoneHelper(IKeystoneHelper helper){
|
||||
if (this.keystoneHelper == null){
|
||||
this.keystoneHelper = helper;
|
||||
}
|
||||
}
|
||||
public final void setExtendedPropertiesID(String identifier){
|
||||
if (extendedPropertiesIdentifier == null)
|
||||
extendedPropertiesIdentifier = identifier;
|
||||
}
|
||||
public final void setAffinityDataID(String identifier){
|
||||
if (affinityDataIdentifier == null)
|
||||
affinityDataIdentifier = identifier;
|
||||
}
|
||||
public final void setSkillDataID(String identifier){
|
||||
if (skillDataIdentifier == null)
|
||||
skillDataIdentifier = identifier;
|
||||
}
|
||||
public final void setRiftStorageID(String identifier){
|
||||
if (riftStorageIdentifier == null)
|
||||
riftStorageIdentifier = identifier;
|
||||
}
|
||||
public final void setEntityManager(IEntityManager manager){
|
||||
if (entityManager == null)
|
||||
entityManager = manager;
|
||||
}
|
||||
public final void setObeliskFuelHelper(IObeliskFuelHelper manager){
|
||||
if (obeliskFuelHelper == null)
|
||||
obeliskFuelHelper = manager;
|
||||
}
|
||||
public final void setFlickerOperatorRegistry(IFlickerRegistry registry){
|
||||
if (flickerOperatorRegistry == null)
|
||||
flickerOperatorRegistry = registry;
|
||||
}
|
||||
public final void setInfusionRegistry(IImbuementRegistry registry){
|
||||
if (this.armorInfusionRegistry == null)
|
||||
this.armorInfusionRegistry = registry;
|
||||
}
|
||||
public final void setEssenceRecipeHandler(IAMRecipeManager manager){
|
||||
if (this.essenceRecipes != null)
|
||||
this.essenceRecipes = manager;
|
||||
}
|
||||
public final void setColourblindMode(boolean colourblindMode){
|
||||
this.colourblindMode = colourblindMode;
|
||||
}
|
||||
// ================================================================================
|
||||
// Setters - for AM use only, do not call these.
|
||||
// ================================================================================
|
||||
public final void setSpellPartManager(ISpellPartManager manager) {
|
||||
if (this.spellPartManager == null) {
|
||||
this.spellPartManager = manager;
|
||||
}
|
||||
}
|
||||
|
||||
private ISpellPartManager spellPartManager;
|
||||
private ISkillTreeManager skillTreeManager;
|
||||
private IAMEnchantmentHelper enchantmentHelper;
|
||||
private IEntityManager entityManager;
|
||||
private IKeystoneHelper keystoneHelper;
|
||||
private IObeliskFuelHelper obeliskFuelHelper;
|
||||
private IFlickerRegistry flickerOperatorRegistry;
|
||||
private IImbuementRegistry armorInfusionRegistry;
|
||||
private IAMRecipeManager essenceRecipes;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ISpellIconManager spellIconManager;
|
||||
private boolean colourblindMode;
|
||||
public final void setEnchantmentHelper(IAMEnchantmentHelper helper) {
|
||||
if (this.enchantmentHelper == null) {
|
||||
this.enchantmentHelper = helper;
|
||||
}
|
||||
}
|
||||
|
||||
public final void setSkillTreeManager(ISkillTreeManager manager) {
|
||||
if (this.skillTreeManager == null) this.skillTreeManager = manager;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final void setSpellIconManager(ISpellIconManager manager) {
|
||||
if (this.spellIconManager == null) this.spellIconManager = manager;
|
||||
}
|
||||
|
||||
public final void setKeystoneHelper(IKeystoneHelper helper) {
|
||||
if (this.keystoneHelper == null) {
|
||||
this.keystoneHelper = helper;
|
||||
}
|
||||
}
|
||||
|
||||
public final void setExtendedPropertiesID(String identifier) {
|
||||
if (extendedPropertiesIdentifier == null) extendedPropertiesIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setAffinityDataID(String identifier) {
|
||||
if (affinityDataIdentifier == null) affinityDataIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setSkillDataID(String identifier) {
|
||||
if (skillDataIdentifier == null) skillDataIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setRiftStorageID(String identifier) {
|
||||
if (riftStorageIdentifier == null) riftStorageIdentifier = identifier;
|
||||
}
|
||||
|
||||
public final void setEntityManager(IEntityManager manager) {
|
||||
if (entityManager == null) entityManager = manager;
|
||||
}
|
||||
|
||||
public final void setObeliskFuelHelper(IObeliskFuelHelper manager) {
|
||||
if (obeliskFuelHelper == null) obeliskFuelHelper = manager;
|
||||
}
|
||||
|
||||
public final void setFlickerOperatorRegistry(IFlickerRegistry registry) {
|
||||
if (flickerOperatorRegistry == null) flickerOperatorRegistry = registry;
|
||||
}
|
||||
|
||||
public final void setInfusionRegistry(IImbuementRegistry registry) {
|
||||
if (this.armorInfusionRegistry == null) this.armorInfusionRegistry = registry;
|
||||
}
|
||||
|
||||
public final void setEssenceRecipeHandler(IAMRecipeManager manager) {
|
||||
if (this.essenceRecipes != null) this.essenceRecipes = manager;
|
||||
}
|
||||
|
||||
public final void setColourblindMode(boolean colourblindMode) {
|
||||
this.colourblindMode = colourblindMode;
|
||||
}
|
||||
|
||||
private ISpellPartManager spellPartManager;
|
||||
private ISkillTreeManager skillTreeManager;
|
||||
private IAMEnchantmentHelper enchantmentHelper;
|
||||
private IEntityManager entityManager;
|
||||
private IKeystoneHelper keystoneHelper;
|
||||
private IObeliskFuelHelper obeliskFuelHelper;
|
||||
private IFlickerRegistry flickerOperatorRegistry;
|
||||
private IImbuementRegistry armorInfusionRegistry;
|
||||
private IAMRecipeManager essenceRecipes;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ISpellIconManager spellIconManager;
|
||||
|
||||
private boolean colourblindMode;
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package am2.api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IAMRecipeManager {
|
||||
/**
|
||||
* Adds a recipe to the essence refiner.
|
||||
* @param output The output created
|
||||
* @param components The components required. Must be a length of 5.
|
||||
*/
|
||||
public void addRefinerRecipe(ItemStack output, ItemStack[] components);
|
||||
/**
|
||||
* Adds a recipe to the essence refiner.
|
||||
* @param output The output created
|
||||
* @param components The components required. Must be a length of 5.
|
||||
*/
|
||||
public void addRefinerRecipe(ItemStack output, ItemStack[] components);
|
||||
}
|
||||
@@ -4,25 +4,25 @@ import am2.api.spell.enums.Affinity;
|
||||
|
||||
public interface IAffinityData {
|
||||
|
||||
/**
|
||||
* Gets the depth of the specified affinity as a percentage.
|
||||
*/
|
||||
float getAffinityDepth(Affinity affinity);
|
||||
/**
|
||||
* Gets the factor at which affinity gains are currently reduced.
|
||||
*/
|
||||
float getDiminishingReturnsFactor();
|
||||
/**
|
||||
* Directly sets an affinity. Does not take into account oppositions. Use sparingly.
|
||||
* @param affinity The affinity to set
|
||||
* @param depth The depth to set
|
||||
*/
|
||||
void setAffinityAndDepth(Affinity affinity, float depth);
|
||||
/**
|
||||
* Increments the affinity by the specified amount, and decrements other affinities by an amount related to
|
||||
* how much in opposition they are to the specified affinity.
|
||||
* @param affinity The affinity to increase
|
||||
* @param amt The amount to increase the affinity by
|
||||
*/
|
||||
void incrementAffinity(Affinity affinity, float amt);
|
||||
/**
|
||||
* Gets the depth of the specified affinity as a percentage.
|
||||
*/
|
||||
float getAffinityDepth(Affinity affinity);
|
||||
/**
|
||||
* Gets the factor at which affinity gains are currently reduced.
|
||||
*/
|
||||
float getDiminishingReturnsFactor();
|
||||
/**
|
||||
* Directly sets an affinity. Does not take into account oppositions. Use sparingly.
|
||||
* @param affinity The affinity to set
|
||||
* @param depth The depth to set
|
||||
*/
|
||||
void setAffinityAndDepth(Affinity affinity, float depth);
|
||||
/**
|
||||
* Increments the affinity by the specified amount, and decrements other affinities by an amount related to
|
||||
* how much in opposition they are to the specified affinity.
|
||||
* @param affinity The affinity to increase
|
||||
* @param amt The amount to increase the affinity by
|
||||
*/
|
||||
void incrementAffinity(Affinity affinity, float amt);
|
||||
}
|
||||
@@ -8,18 +8,23 @@ import am2.api.math.AMVector3;
|
||||
*
|
||||
*/
|
||||
public interface IExtendedProperties {
|
||||
public float getCurrentMana();
|
||||
public float getMaxMana();
|
||||
public float getCurrentMana();
|
||||
|
||||
public int getMarkDimension();
|
||||
public int getMagicLevel();
|
||||
public int getNumSummons();
|
||||
public float getMaxMana();
|
||||
|
||||
public AMVector3 getMarkLocation();
|
||||
public int getMarkDimension();
|
||||
|
||||
public boolean getHasUnlockedAugmented();
|
||||
public boolean getMarkSet();
|
||||
public int getMagicLevel();
|
||||
|
||||
public boolean setMagicLevelWithMana(int magicLevel);
|
||||
public void setCurrentMana(float currentMana);
|
||||
public int getNumSummons();
|
||||
|
||||
public AMVector3 getMarkLocation();
|
||||
|
||||
public boolean getHasUnlockedAugmented();
|
||||
|
||||
public boolean getMarkSet();
|
||||
|
||||
public boolean setMagicLevelWithMana(int magicLevel);
|
||||
|
||||
public void setCurrentMana(float currentMana);
|
||||
}
|
||||
@@ -1,66 +1,66 @@
|
||||
package am2.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.LearnStates;
|
||||
import am2.api.spell.enums.SkillPointTypes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface ISkillData {
|
||||
/**
|
||||
* Checks if the specified skill tree entry is known
|
||||
*/
|
||||
boolean isEntryKnown(SkillTreeEntry entry);
|
||||
/**
|
||||
* Returns the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
int getSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Sets the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints, SkillPointTypes type);
|
||||
/**
|
||||
* Sets the number of skill points for all types that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints_blue, int spellPoints_green, int spellPoints_red);
|
||||
/**
|
||||
* Increments the skill points of the specified type.
|
||||
*/
|
||||
void incrementSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Decrements the skill points of the specified type. Cannot go below 0.
|
||||
*/
|
||||
void decrementSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Learns the specified entry. This will attempt to decrement skill points but is not bounded by it - make sure you check {@link #getLearnState(SkillTreeEntry, EntityPlayer)} first!
|
||||
* @param entry
|
||||
*/
|
||||
void learn(ISkillTreeEntry entry);
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known shapes.
|
||||
*/
|
||||
Integer[] getKnownShapes();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known components.
|
||||
*/
|
||||
Integer[] getKnownComponents();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known modifiers.
|
||||
*/
|
||||
Integer[] getKnownModifiers();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known talents.
|
||||
*/
|
||||
Integer[] getKnownTalents();
|
||||
/**
|
||||
* Forces changes to sync to appropriate clients. Chances are you won't have to call this, as the sync will happen at regular intervals if there are actually changes to sync. This is for when you need the changes clientside immediately.
|
||||
*/
|
||||
void forceSync();
|
||||
/**
|
||||
* Clears all spell knowledge and skill points. Does not do any refunding -- this is NOT a respec!
|
||||
*/
|
||||
void clearAllKnowledge();
|
||||
/**
|
||||
* Gets the learn state for the specified skill.
|
||||
*/
|
||||
LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player);
|
||||
/**
|
||||
* Checks if the specified skill tree entry is known
|
||||
*/
|
||||
boolean isEntryKnown(SkillTreeEntry entry);
|
||||
/**
|
||||
* Returns the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
int getSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Sets the number of skill points of the given type that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints, SkillPointTypes type);
|
||||
/**
|
||||
* Sets the number of skill points for all types that this skill data has
|
||||
*/
|
||||
void setSpellPoints(int spellPoints_blue, int spellPoints_green, int spellPoints_red);
|
||||
/**
|
||||
* Increments the skill points of the specified type.
|
||||
*/
|
||||
void incrementSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Decrements the skill points of the specified type. Cannot go below 0.
|
||||
*/
|
||||
void decrementSpellPoints(SkillPointTypes type);
|
||||
/**
|
||||
* Learns the specified entry. This will attempt to decrement skill points but is not bounded by it - make sure you check {@link #getLearnState(SkillTreeEntry, EntityPlayer)} first!
|
||||
* @param entry
|
||||
*/
|
||||
void learn(ISkillTreeEntry entry);
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known shapes.
|
||||
*/
|
||||
Integer[] getKnownShapes();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known components.
|
||||
*/
|
||||
Integer[] getKnownComponents();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known modifiers.
|
||||
*/
|
||||
Integer[] getKnownModifiers();
|
||||
/**
|
||||
* Returns an array of shifted IDs representing the known talents.
|
||||
*/
|
||||
Integer[] getKnownTalents();
|
||||
/**
|
||||
* Forces changes to sync to appropriate clients. Chances are you won't have to call this, as the sync will happen at regular intervals if there are actually changes to sync. This is for when you need the changes clientside immediately.
|
||||
*/
|
||||
void forceSync();
|
||||
/**
|
||||
* Clears all spell knowledge and skill points. Does not do any refunding -- this is NOT a respec!
|
||||
*/
|
||||
void clearAllKnowledge();
|
||||
/**
|
||||
* Gets the learn state for the specified skill.
|
||||
*/
|
||||
LearnStates getLearnState(SkillTreeEntry entry, EntityPlayer player);
|
||||
}
|
||||
@@ -4,29 +4,35 @@ import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
|
||||
public class SkillTreeEntry {
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final SkillTrees tree;
|
||||
public final SkillTreeEntry[] prerequisites;
|
||||
public final ISkillTreeEntry registeredItem;
|
||||
public final int tier;
|
||||
public boolean enabled;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final SkillTrees tree;
|
||||
public final SkillTreeEntry[] prerequisites;
|
||||
public final ISkillTreeEntry registeredItem;
|
||||
public final int tier;
|
||||
public boolean enabled;
|
||||
|
||||
public SkillTreeEntry(int x, int y, SkillTrees tree, SkillTreeEntry[] prerequisites, ISkillTreeEntry registeredItem, boolean enabled){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.tree = tree;
|
||||
this.prerequisites = prerequisites;
|
||||
this.registeredItem = registeredItem;
|
||||
this.enabled = enabled;
|
||||
public SkillTreeEntry(
|
||||
int x,
|
||||
int y,
|
||||
SkillTrees tree,
|
||||
SkillTreeEntry[] prerequisites,
|
||||
ISkillTreeEntry registeredItem,
|
||||
boolean enabled) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.tree = tree;
|
||||
this.prerequisites = prerequisites;
|
||||
this.registeredItem = registeredItem;
|
||||
this.enabled = enabled;
|
||||
|
||||
int highestTier = 0;
|
||||
for (SkillTreeEntry entry : prerequisites){
|
||||
if (entry.tier >= highestTier){
|
||||
highestTier = entry.tier + 1;
|
||||
}
|
||||
}
|
||||
int highestTier = 0;
|
||||
for (SkillTreeEntry entry : prerequisites) {
|
||||
if (entry.tier >= highestTier) {
|
||||
highestTier = entry.tier + 1;
|
||||
}
|
||||
}
|
||||
|
||||
this.tier = highestTier;
|
||||
}
|
||||
this.tier = highestTier;
|
||||
}
|
||||
}
|
||||
@@ -3,20 +3,20 @@ package am2.api.blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IKeystoneLockable <T extends TileEntity, IInventory> {
|
||||
/**
|
||||
* Return a three element array of the three runes in the inventory that make up the current keystone combination.
|
||||
* Elements can be NULL if there is no rune present.
|
||||
*/
|
||||
public ItemStack[] getRunesInKey();
|
||||
public interface IKeystoneLockable<T extends TileEntity, IInventory> {
|
||||
/**
|
||||
* Return a three element array of the three runes in the inventory that make up the current keystone combination.
|
||||
* Elements can be NULL if there is no rune present.
|
||||
*/
|
||||
public ItemStack[] getRunesInKey();
|
||||
|
||||
/**
|
||||
* Does the keystone need to be the currently held item? Trumps {@link #keystoneMustBeInActionBar()}.
|
||||
*/
|
||||
public boolean keystoneMustBeHeld();
|
||||
/**
|
||||
* Does the keystone need to be the currently held item? Trumps {@link #keystoneMustBeInActionBar()}.
|
||||
*/
|
||||
public boolean keystoneMustBeHeld();
|
||||
|
||||
/**
|
||||
* Does the keystone need to be in the action bar? Or can it be anywhere in the inventory?
|
||||
*/
|
||||
public boolean keystoneMustBeInActionBar();
|
||||
/**
|
||||
* Does the keystone need to be in the action bar? Or can it be anywhere in the inventory?
|
||||
*/
|
||||
public boolean keystoneMustBeInActionBar();
|
||||
}
|
||||
@@ -2,404 +2,409 @@ package am2.api.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MultiblockStructureDefinition{
|
||||
public class BlockDec{
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public BlockDec(Block block, int meta){
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock(){
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta(){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String blockName = "";
|
||||
if (block != null){
|
||||
blockName = block.getLocalizedName();
|
||||
}else{
|
||||
blockName = "Unknown";
|
||||
}
|
||||
return String.format("Block: %s, meta: %d", blockName, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockDec){
|
||||
return this.block == ((BlockDec)obj).block && (this.meta == -1 || ((BlockDec)obj).meta == -1 || this.meta == ((BlockDec)obj).meta);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Block.getIdFromBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
public class BlockCoord implements Comparable<BlockCoord>{
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public BlockCoord(int offsetX, int offsetY, int offsetZ){
|
||||
this.x = offsetX;
|
||||
this.y = offsetY;
|
||||
this.z = offsetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockCoord){
|
||||
return this.x == ((BlockCoord)obj).x && this.y == ((BlockCoord)obj).y && this.z == ((BlockCoord)obj).z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.x + this.y + this.z;
|
||||
}
|
||||
|
||||
|
||||
public int getX(){
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY(){
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ(){
|
||||
return this.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("BlockCoord: %d, %d, %d", x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockCoord o) {
|
||||
return this.z > o.z ? 1 : this.z < o.z ? -1 : this.x > o.x ? 1 : this.x < o.x ? -1 : this.y > o.y ? 1 : this.y < o.y ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class StructureGroup
|
||||
{
|
||||
String name;
|
||||
int mutex;
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> allowedBlocks;
|
||||
|
||||
public StructureGroup(String name, int mutex){
|
||||
this.name = name;
|
||||
this.mutex = mutex;
|
||||
allowedBlocks = new HashMap<BlockCoord, ArrayList<BlockDec>>();
|
||||
}
|
||||
|
||||
void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
BlockCoord originOffset = new BlockCoord(offsetX, offsetY, offsetZ);
|
||||
if (!allowedBlocks.containsKey(originOffset)){
|
||||
allowedBlocks.put(originOffset, new ArrayList<BlockDec>());
|
||||
}
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(originOffset);
|
||||
positionReplacements.add(new BlockDec(block, meta));
|
||||
}
|
||||
|
||||
ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord){
|
||||
return allowedBlocks.get(coord);
|
||||
}
|
||||
|
||||
boolean matchGroup(World world, int originX, int originY, int originZ){
|
||||
for (BlockCoord offset : allowedBlocks.keySet()){
|
||||
Block block = world.getBlock(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
int meta = world.getBlockMetadata(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(offset);
|
||||
boolean valid = false;
|
||||
for (BlockDec bd : positionReplacements){
|
||||
if (bd.block == block && (bd.meta == -1 || bd.meta == meta)){
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
if (!valid) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer){
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> toReturn = new HashMap<MultiblockStructureDefinition.BlockCoord, ArrayList<BlockDec>>();
|
||||
|
||||
if (layer > getMaxLayer() || layer < getMinLayer()){
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
for (BlockCoord bc : allowedBlocks.keySet()){
|
||||
if (bc.y == layer){
|
||||
toReturn.put(bc, allowedBlocks.get(bc));
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, Block newBlock){
|
||||
replaceAllBlocksOfType(originalBlock, -1, newBlock, -1);
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, int originalMeta, Block newBlock, int newMeta){
|
||||
for (BlockCoord bc : allowedBlocks.keySet()){
|
||||
for (BlockDec bd : allowedBlocks.get(bc)){
|
||||
if (bd.block == originalBlock){
|
||||
if (bd.meta == originalMeta || originalMeta == -1){
|
||||
bd.block = newBlock;
|
||||
if (newMeta != -1){
|
||||
bd.meta = newMeta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getAllowedBlocks(){
|
||||
return (HashMap<BlockCoord, ArrayList<BlockDec>>) allowedBlocks.clone();
|
||||
}
|
||||
|
||||
public void deleteBlocksFromWorld(World world, int x, int y, int z) {
|
||||
for (BlockCoord offset : allowedBlocks.keySet()){
|
||||
world.setBlockToAir(x + offset.x, y + offset.y, z + offset.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private StructureGroup mainGroup;
|
||||
private ArrayList<StructureGroup> blockGroups;
|
||||
private ArrayList<Integer> mutexCache;
|
||||
|
||||
public static final int MAINGROUP_MUTEX = 1;
|
||||
|
||||
private String id;
|
||||
|
||||
private int maxX = 0;
|
||||
private int minX = 0;
|
||||
private int maxY = 0;
|
||||
private int minY = 0;
|
||||
private int maxZ = 0;
|
||||
private int minZ = 0;
|
||||
|
||||
public MultiblockStructureDefinition(String id){
|
||||
blockGroups = new ArrayList<StructureGroup>();
|
||||
mutexCache = new ArrayList<Integer>();
|
||||
this.id = id;
|
||||
|
||||
//default group
|
||||
mainGroup = createGroup("main", MAINGROUP_MUTEX);
|
||||
}
|
||||
|
||||
public String getID(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getMutexList(){
|
||||
return mutexCache;
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getGroupsForMutex(int mutex){
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.mutex == mutex){
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(StructureGroup group, BlockCoord coord){
|
||||
return group.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord){
|
||||
return mainGroup.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
|
||||
if (offsetY > maxY){
|
||||
maxY = offsetY;
|
||||
}else if (offsetY < minY){
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX){
|
||||
maxX = offsetX;
|
||||
}else if (offsetX < minX){
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ){
|
||||
maxZ = offsetZ;
|
||||
}else if (offsetZ < minZ){
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
mainGroup.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block){
|
||||
addAllowedBlock(offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block, int meta){
|
||||
if (!blockGroups.contains(group)){
|
||||
blockGroups.add(group);
|
||||
}
|
||||
|
||||
if (offsetY > maxY){
|
||||
maxY = offsetY;
|
||||
}else if (offsetY < minY){
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX){
|
||||
maxX = offsetX;
|
||||
}else if (offsetX < minX){
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ){
|
||||
maxZ = offsetZ;
|
||||
}else if (offsetZ < minZ){
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
group.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block){
|
||||
addAllowedBlock(group, offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public StructureGroup createGroup(String name, int mutex){
|
||||
if (!mutexCache.contains(mutex)){
|
||||
mutexCache.add(mutex);
|
||||
}
|
||||
StructureGroup group = new StructureGroup(name, mutex);
|
||||
blockGroups.add(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName, int newMutex){
|
||||
StructureGroup copyGroup = null;
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.name.equals(originalName)){
|
||||
copyGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (copyGroup == null) return null;
|
||||
|
||||
StructureGroup newGroup;
|
||||
|
||||
if (newMutex > -1){
|
||||
newGroup = new StructureGroup(destinationName, newMutex);
|
||||
}else{
|
||||
newGroup = new StructureGroup(destinationName, copyGroup.mutex);
|
||||
}
|
||||
|
||||
for (BlockCoord bc : copyGroup.allowedBlocks.keySet()){
|
||||
for (BlockDec bd : copyGroup.allowedBlocks.get(bc)){
|
||||
newGroup.addAllowedBlock(bc.x, bc.y, bc.z, bd.block, bd.meta);
|
||||
}
|
||||
}
|
||||
|
||||
blockGroups.add(newGroup);
|
||||
|
||||
return newGroup;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName){
|
||||
return copyGroup(originalName, destinationName, -1);
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getMatchedGroups(int mutex, World world, int originX, int originY, int originZ){
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
for (StructureGroup group : blockGroups){
|
||||
if ((group.mutex & mutex) == group.mutex){
|
||||
if (group.matchGroup(world, originX, originY, originZ)){
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private boolean matchMutex(int mutex, World world, int originX, int originY, int originZ){
|
||||
for (StructureGroup group : blockGroups){
|
||||
if ((group.mutex & mutex) == group.mutex){
|
||||
if (group.matchGroup(world, originX, originY, originZ)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkStructure(World world, int originX, int originY, int originZ){
|
||||
boolean valid = true;
|
||||
for (int i: mutexCache){
|
||||
valid &= matchMutex(i, world, originX, originY, originZ);
|
||||
if (!valid) break;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public int getMinLayer(){
|
||||
return this.minY;
|
||||
}
|
||||
|
||||
public int getMaxLayer(){
|
||||
return this.maxY;
|
||||
}
|
||||
|
||||
public int getHeight(){
|
||||
return this.maxY - this.minY;
|
||||
}
|
||||
|
||||
public int getWidth(){
|
||||
return this.maxX - this.minX;
|
||||
}
|
||||
|
||||
public int getLength(){
|
||||
return this.maxZ - this.minZ;
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer){
|
||||
return mainGroup.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(StructureGroup group, int layer){
|
||||
return group.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public void removeMutex(int mutex, World world, int x, int y, int z){
|
||||
for (StructureGroup group : blockGroups){
|
||||
if (group.mutex == mutex){
|
||||
group.deleteBlocksFromWorld(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class MultiblockStructureDefinition {
|
||||
public class BlockDec {
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public BlockDec(Block block, int meta) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String blockName = "";
|
||||
if (block != null) {
|
||||
blockName = block.getLocalizedName();
|
||||
} else {
|
||||
blockName = "Unknown";
|
||||
}
|
||||
return String.format("Block: %s, meta: %d", blockName, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockDec) {
|
||||
return this.block == ((BlockDec) obj).block
|
||||
&& (this.meta == -1 || ((BlockDec) obj).meta == -1 || this.meta == ((BlockDec) obj).meta);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Block.getIdFromBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
public class BlockCoord implements Comparable<BlockCoord> {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public BlockCoord(int offsetX, int offsetY, int offsetZ) {
|
||||
this.x = offsetX;
|
||||
this.y = offsetY;
|
||||
this.z = offsetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockCoord) {
|
||||
return this.x == ((BlockCoord) obj).x
|
||||
&& this.y == ((BlockCoord) obj).y
|
||||
&& this.z == ((BlockCoord) obj).z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.x + this.y + this.z;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("BlockCoord: %d, %d, %d", x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockCoord o) {
|
||||
return this.z > o.z
|
||||
? 1
|
||||
: this.z < o.z
|
||||
? -1
|
||||
: this.x > o.x ? 1 : this.x < o.x ? -1 : this.y > o.y ? 1 : this.y < o.y ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class StructureGroup {
|
||||
String name;
|
||||
int mutex;
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> allowedBlocks;
|
||||
|
||||
public StructureGroup(String name, int mutex) {
|
||||
this.name = name;
|
||||
this.mutex = mutex;
|
||||
allowedBlocks = new HashMap<BlockCoord, ArrayList<BlockDec>>();
|
||||
}
|
||||
|
||||
void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta) {
|
||||
BlockCoord originOffset = new BlockCoord(offsetX, offsetY, offsetZ);
|
||||
if (!allowedBlocks.containsKey(originOffset)) {
|
||||
allowedBlocks.put(originOffset, new ArrayList<BlockDec>());
|
||||
}
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(originOffset);
|
||||
positionReplacements.add(new BlockDec(block, meta));
|
||||
}
|
||||
|
||||
ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord) {
|
||||
return allowedBlocks.get(coord);
|
||||
}
|
||||
|
||||
boolean matchGroup(World world, int originX, int originY, int originZ) {
|
||||
for (BlockCoord offset : allowedBlocks.keySet()) {
|
||||
Block block = world.getBlock(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
int meta = world.getBlockMetadata(originX + offset.x, originY + offset.y, originZ + offset.z);
|
||||
ArrayList<BlockDec> positionReplacements = allowedBlocks.get(offset);
|
||||
boolean valid = false;
|
||||
for (BlockDec bd : positionReplacements) {
|
||||
if (bd.block == block && (bd.meta == -1 || bd.meta == meta)) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
if (!valid) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer) {
|
||||
HashMap<BlockCoord, ArrayList<BlockDec>> toReturn =
|
||||
new HashMap<MultiblockStructureDefinition.BlockCoord, ArrayList<BlockDec>>();
|
||||
|
||||
if (layer > getMaxLayer() || layer < getMinLayer()) {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
for (BlockCoord bc : allowedBlocks.keySet()) {
|
||||
if (bc.y == layer) {
|
||||
toReturn.put(bc, allowedBlocks.get(bc));
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, Block newBlock) {
|
||||
replaceAllBlocksOfType(originalBlock, -1, newBlock, -1);
|
||||
}
|
||||
|
||||
public void replaceAllBlocksOfType(Block originalBlock, int originalMeta, Block newBlock, int newMeta) {
|
||||
for (BlockCoord bc : allowedBlocks.keySet()) {
|
||||
for (BlockDec bd : allowedBlocks.get(bc)) {
|
||||
if (bd.block == originalBlock) {
|
||||
if (bd.meta == originalMeta || originalMeta == -1) {
|
||||
bd.block = newBlock;
|
||||
if (newMeta != -1) {
|
||||
bd.meta = newMeta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getAllowedBlocks() {
|
||||
return (HashMap<BlockCoord, ArrayList<BlockDec>>) allowedBlocks.clone();
|
||||
}
|
||||
|
||||
public void deleteBlocksFromWorld(World world, int x, int y, int z) {
|
||||
for (BlockCoord offset : allowedBlocks.keySet()) {
|
||||
world.setBlockToAir(x + offset.x, y + offset.y, z + offset.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private StructureGroup mainGroup;
|
||||
private ArrayList<StructureGroup> blockGroups;
|
||||
private ArrayList<Integer> mutexCache;
|
||||
|
||||
public static final int MAINGROUP_MUTEX = 1;
|
||||
|
||||
private String id;
|
||||
|
||||
private int maxX = 0;
|
||||
private int minX = 0;
|
||||
private int maxY = 0;
|
||||
private int minY = 0;
|
||||
private int maxZ = 0;
|
||||
private int minZ = 0;
|
||||
|
||||
public MultiblockStructureDefinition(String id) {
|
||||
blockGroups = new ArrayList<StructureGroup>();
|
||||
mutexCache = new ArrayList<Integer>();
|
||||
this.id = id;
|
||||
|
||||
// default group
|
||||
mainGroup = createGroup("main", MAINGROUP_MUTEX);
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getMutexList() {
|
||||
return mutexCache;
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getGroupsForMutex(int mutex) {
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
|
||||
for (StructureGroup group : blockGroups) {
|
||||
if (group.mutex == mutex) {
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(StructureGroup group, BlockCoord coord) {
|
||||
return group.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public ArrayList<BlockDec> getAllowedBlocksAt(BlockCoord coord) {
|
||||
return mainGroup.getAllowedBlocksAt(coord);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block, int meta) {
|
||||
|
||||
if (offsetY > maxY) {
|
||||
maxY = offsetY;
|
||||
} else if (offsetY < minY) {
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX) {
|
||||
maxX = offsetX;
|
||||
} else if (offsetX < minX) {
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ) {
|
||||
maxZ = offsetZ;
|
||||
} else if (offsetZ < minZ) {
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
mainGroup.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(int offsetX, int offsetY, int offsetZ, Block block) {
|
||||
addAllowedBlock(offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block, int meta) {
|
||||
if (!blockGroups.contains(group)) {
|
||||
blockGroups.add(group);
|
||||
}
|
||||
|
||||
if (offsetY > maxY) {
|
||||
maxY = offsetY;
|
||||
} else if (offsetY < minY) {
|
||||
minY = offsetY;
|
||||
}
|
||||
|
||||
if (offsetX > maxX) {
|
||||
maxX = offsetX;
|
||||
} else if (offsetX < minX) {
|
||||
minX = offsetX;
|
||||
}
|
||||
|
||||
if (offsetZ > maxZ) {
|
||||
maxZ = offsetZ;
|
||||
} else if (offsetZ < minZ) {
|
||||
minZ = offsetZ;
|
||||
}
|
||||
|
||||
group.addAllowedBlock(offsetX, offsetY, offsetZ, block, meta);
|
||||
}
|
||||
|
||||
public void addAllowedBlock(StructureGroup group, int offsetX, int offsetY, int offsetZ, Block block) {
|
||||
addAllowedBlock(group, offsetX, offsetY, offsetZ, block, -1);
|
||||
}
|
||||
|
||||
public StructureGroup createGroup(String name, int mutex) {
|
||||
if (!mutexCache.contains(mutex)) {
|
||||
mutexCache.add(mutex);
|
||||
}
|
||||
StructureGroup group = new StructureGroup(name, mutex);
|
||||
blockGroups.add(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName, int newMutex) {
|
||||
StructureGroup copyGroup = null;
|
||||
for (StructureGroup group : blockGroups) {
|
||||
if (group.name.equals(originalName)) {
|
||||
copyGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (copyGroup == null) return null;
|
||||
|
||||
StructureGroup newGroup;
|
||||
|
||||
if (newMutex > -1) {
|
||||
newGroup = new StructureGroup(destinationName, newMutex);
|
||||
} else {
|
||||
newGroup = new StructureGroup(destinationName, copyGroup.mutex);
|
||||
}
|
||||
|
||||
for (BlockCoord bc : copyGroup.allowedBlocks.keySet()) {
|
||||
for (BlockDec bd : copyGroup.allowedBlocks.get(bc)) {
|
||||
newGroup.addAllowedBlock(bc.x, bc.y, bc.z, bd.block, bd.meta);
|
||||
}
|
||||
}
|
||||
|
||||
blockGroups.add(newGroup);
|
||||
|
||||
return newGroup;
|
||||
}
|
||||
|
||||
public StructureGroup copyGroup(String originalName, String destinationName) {
|
||||
return copyGroup(originalName, destinationName, -1);
|
||||
}
|
||||
|
||||
public ArrayList<StructureGroup> getMatchedGroups(int mutex, World world, int originX, int originY, int originZ) {
|
||||
ArrayList<StructureGroup> toReturn = new ArrayList<StructureGroup>();
|
||||
for (StructureGroup group : blockGroups) {
|
||||
if ((group.mutex & mutex) == group.mutex) {
|
||||
if (group.matchGroup(world, originX, originY, originZ)) {
|
||||
toReturn.add(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private boolean matchMutex(int mutex, World world, int originX, int originY, int originZ) {
|
||||
for (StructureGroup group : blockGroups) {
|
||||
if ((group.mutex & mutex) == group.mutex) {
|
||||
if (group.matchGroup(world, originX, originY, originZ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkStructure(World world, int originX, int originY, int originZ) {
|
||||
boolean valid = true;
|
||||
for (int i : mutexCache) {
|
||||
valid &= matchMutex(i, world, originX, originY, originZ);
|
||||
if (!valid) break;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public int getMinLayer() {
|
||||
return this.minY;
|
||||
}
|
||||
|
||||
public int getMaxLayer() {
|
||||
return this.maxY;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.maxY - this.minY;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.maxX - this.minX;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.maxZ - this.minZ;
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(int layer) {
|
||||
return mainGroup.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public HashMap<BlockCoord, ArrayList<BlockDec>> getStructureLayer(StructureGroup group, int layer) {
|
||||
return group.getStructureLayer(layer);
|
||||
}
|
||||
|
||||
public void removeMutex(int mutex, World world, int x, int y, int z) {
|
||||
for (StructureGroup group : blockGroups) {
|
||||
if (group.mutex == mutex) {
|
||||
group.deleteBlocksFromWorld(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package am2.api.enchantment;
|
||||
|
||||
public interface IAMEnchantmentHelper {
|
||||
/**
|
||||
* Gets the current ID for soulbound enchantment
|
||||
*/
|
||||
public int getSoulboundID();
|
||||
/**
|
||||
* Gets the current ID for magic resist enchantment
|
||||
*/
|
||||
public int getMagicResistID();
|
||||
/**
|
||||
* Gets the current ID for soulbound enchantment
|
||||
*/
|
||||
public int getSoulboundID();
|
||||
/**
|
||||
* Gets the current ID for magic resist enchantment
|
||||
*/
|
||||
public int getMagicResistID();
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package am2.api.entities;
|
||||
|
||||
public interface IEntityManager {
|
||||
/**
|
||||
* Adds the specified entities to the butchery blacklist (won't be affected by sigil of butchery)
|
||||
*/
|
||||
public void addButcheryBlacklist(Class...clazz);
|
||||
/**
|
||||
* Adds the specified entities to the progeny blacklist (won't be affected by sigil of progeny)
|
||||
*/
|
||||
public void addProgenyBlacklist(Class...clazz);
|
||||
/**
|
||||
* Adds the specified entities to the butchery blacklist (won't be affected by sigil of butchery)
|
||||
*/
|
||||
public void addButcheryBlacklist(Class... clazz);
|
||||
/**
|
||||
* Adds the specified entities to the progeny blacklist (won't be affected by sigil of progeny)
|
||||
*/
|
||||
public void addProgenyBlacklist(Class... clazz);
|
||||
}
|
||||
@@ -9,16 +9,16 @@ import net.minecraft.item.ItemStack;
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public class ManaCostEvent extends Event{
|
||||
public final ItemStack spell;
|
||||
public final EntityLivingBase caster;
|
||||
public float manaCost;
|
||||
public float burnout;
|
||||
public class ManaCostEvent extends Event {
|
||||
public final ItemStack spell;
|
||||
public final EntityLivingBase caster;
|
||||
public float manaCost;
|
||||
public float burnout;
|
||||
|
||||
public ManaCostEvent(ItemStack spell, EntityLivingBase caster, float manaCost, float burnout){
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
}
|
||||
public ManaCostEvent(ItemStack spell, EntityLivingBase caster, float manaCost, float burnout) {
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package am2.api.events;
|
||||
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
|
||||
/**
|
||||
* Called whenever a spell's modified variable is calculated
|
||||
@@ -11,31 +11,37 @@ import am2.api.spell.enums.SpellModifiers;
|
||||
*
|
||||
*/
|
||||
public class ModifierCalculatedEvent extends Event {
|
||||
//The attribute being modified
|
||||
public final SpellModifiers attribute;
|
||||
//The caster of the spell
|
||||
public final EntityLivingBase caster;
|
||||
//The spell being cast. This is a copy of the ItemStack.
|
||||
public final ItemStack spell;
|
||||
//the initial value of the variable
|
||||
public final double initialValue;
|
||||
//the type of operation being used to modify the value
|
||||
public final OperationType operation;
|
||||
// The attribute being modified
|
||||
public final SpellModifiers attribute;
|
||||
// The caster of the spell
|
||||
public final EntityLivingBase caster;
|
||||
// The spell being cast. This is a copy of the ItemStack.
|
||||
public final ItemStack spell;
|
||||
// the initial value of the variable
|
||||
public final double initialValue;
|
||||
// the type of operation being used to modify the value
|
||||
public final OperationType operation;
|
||||
|
||||
//the final modified value of the variable
|
||||
public double modifiedValue;
|
||||
// the final modified value of the variable
|
||||
public double modifiedValue;
|
||||
|
||||
public enum OperationType{
|
||||
ADD,
|
||||
MULTIPLY
|
||||
}
|
||||
public enum OperationType {
|
||||
ADD,
|
||||
MULTIPLY
|
||||
}
|
||||
|
||||
public ModifierCalculatedEvent(ItemStack spell, EntityLivingBase caster, SpellModifiers attribute, double initialValue, double modifiedValue, OperationType operation){
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.attribute = attribute;
|
||||
this.initialValue = initialValue;
|
||||
this.modifiedValue = modifiedValue;
|
||||
this.operation = operation;
|
||||
}
|
||||
public ModifierCalculatedEvent(
|
||||
ItemStack spell,
|
||||
EntityLivingBase caster,
|
||||
SpellModifiers attribute,
|
||||
double initialValue,
|
||||
double modifiedValue,
|
||||
OperationType operation) {
|
||||
this.spell = spell;
|
||||
this.caster = caster;
|
||||
this.attribute = attribute;
|
||||
this.initialValue = initialValue;
|
||||
this.modifiedValue = modifiedValue;
|
||||
this.operation = operation;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package am2.api.events;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* Raised when a player's magic level changes.
|
||||
@@ -9,11 +9,11 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
*
|
||||
*/
|
||||
public class PlayerMagicLevelChangeEvent extends Event {
|
||||
public final int level;
|
||||
public final EntityLivingBase entity;
|
||||
public final int level;
|
||||
public final EntityLivingBase entity;
|
||||
|
||||
public PlayerMagicLevelChangeEvent(EntityLivingBase entity, int level){
|
||||
this.entity = entity;
|
||||
this.level = level;
|
||||
}
|
||||
public PlayerMagicLevelChangeEvent(EntityLivingBase entity, int level) {
|
||||
this.entity = entity;
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
package am2.api.events;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Cancelable
|
||||
public class ReconstructorRepairEvent extends Event{
|
||||
|
||||
/**
|
||||
* The item being repaired.
|
||||
*/
|
||||
public ItemStack item;
|
||||
|
||||
/**
|
||||
* Called when the arcane reconstructor ticks on repairing an item.
|
||||
* @param item
|
||||
*/
|
||||
public ReconstructorRepairEvent(ItemStack item){
|
||||
this.item = item;
|
||||
}
|
||||
public class ReconstructorRepairEvent extends Event {
|
||||
|
||||
/**
|
||||
* The item being repaired.
|
||||
*/
|
||||
public ItemStack item;
|
||||
|
||||
/**
|
||||
* Called when the arcane reconstructor ticks on repairing an item.
|
||||
* @param item
|
||||
*/
|
||||
public ReconstructorRepairEvent(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import am2.api.spell.ISpellIconManager;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class RegisterSkillTreeIcons extends Event{
|
||||
public final ISpellIconManager manager;
|
||||
public class RegisterSkillTreeIcons extends Event {
|
||||
public final ISpellIconManager manager;
|
||||
|
||||
public RegisterSkillTreeIcons(ISpellIconManager manager){
|
||||
this.manager = manager;
|
||||
}
|
||||
public RegisterSkillTreeIcons(ISpellIconManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package am2.api.events;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* Raised when a player learns a skill at the Occulus
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public class SkillLearnedEvent extends Event{
|
||||
public final EntityPlayer player;
|
||||
public final ISkillTreeEntry skill;
|
||||
public class SkillLearnedEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public final ISkillTreeEntry skill;
|
||||
|
||||
public SkillLearnedEvent(EntityPlayer player, ISkillTreeEntry entry){
|
||||
this.player = player;
|
||||
this.skill = entry;
|
||||
}
|
||||
public SkillLearnedEvent(EntityPlayer player, ISkillTreeEntry entry) {
|
||||
this.player = player;
|
||||
this.skill = entry;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +1,106 @@
|
||||
package am2.api.events;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import am2.api.spell.ItemSpellBase;
|
||||
import am2.api.spell.enums.SpellCastResult;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SpellCastingEvent{
|
||||
@Cancelable
|
||||
public class Pre extends Event{
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
public class SpellCastingEvent {
|
||||
@Cancelable
|
||||
public class Pre extends Event {
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
|
||||
public Pre(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled){
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public class Post extends Event{
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public final SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
public Pre(
|
||||
ItemStack stack,
|
||||
ItemSpellBase spell,
|
||||
EntityLivingBase caster,
|
||||
float manaCost,
|
||||
float burnout,
|
||||
boolean isChanneled) {
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
}
|
||||
}
|
||||
|
||||
public Post(ItemStack stack, ItemSpellBase spell, EntityLivingBase caster, float manaCost, float burnout, boolean isChanneled, SpellCastResult castResult){
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
this.castResult = castResult;
|
||||
}
|
||||
}
|
||||
@Cancelable
|
||||
public class Post extends Event {
|
||||
/**
|
||||
* The spell being cast
|
||||
*/
|
||||
public final ItemSpellBase spell;
|
||||
/**
|
||||
* The caster of the spell
|
||||
*/
|
||||
public final EntityLivingBase caster;
|
||||
/**
|
||||
* The calculated mana cost of the spell
|
||||
*/
|
||||
public final float manaCost;
|
||||
/**
|
||||
* The calculated burnout of the spell
|
||||
*/
|
||||
public final float burnout;
|
||||
/**
|
||||
* The itemstack representing the spell
|
||||
*/
|
||||
public final ItemStack stack;
|
||||
/**
|
||||
* The result to be returned after casting the spell
|
||||
*/
|
||||
public final SpellCastResult castResult;
|
||||
/**
|
||||
* Is the spell channeled (maintained in any way, not the shape, so beam counts too)
|
||||
*/
|
||||
public final boolean isChanneled;
|
||||
|
||||
public Post(
|
||||
ItemStack stack,
|
||||
ItemSpellBase spell,
|
||||
EntityLivingBase caster,
|
||||
float manaCost,
|
||||
float burnout,
|
||||
boolean isChanneled,
|
||||
SpellCastResult castResult) {
|
||||
this.caster = caster;
|
||||
this.spell = spell;
|
||||
this.manaCost = manaCost;
|
||||
this.burnout = burnout;
|
||||
this.stack = stack;
|
||||
this.isChanneled = isChanneled;
|
||||
this.castResult = castResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,32 +2,34 @@ package am2.api.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class SpellRecipeItemsEvent extends Event{
|
||||
public final String registeredName; //The registered name of the spell part. Used to identify what spell shape/component/modifier we are working with
|
||||
public final int ID; //The ID of the spell part. Also can be used to identify what we are working with, if you don't like strings.
|
||||
public class SpellRecipeItemsEvent extends Event {
|
||||
public final String registeredName; // The registered name of the spell part. Used to identify what spell
|
||||
// shape/component/modifier we are working with
|
||||
public final int
|
||||
ID; // The ID of the spell part. Also can be used to identify what we are working with, if you don't like
|
||||
// strings.
|
||||
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
*</pre>
|
||||
*/
|
||||
public Object[] recipeItems; //The actual recipe items. Change or verify them here.
|
||||
|
||||
public SpellRecipeItemsEvent(String name, int ID, Object[] recipeItems){
|
||||
registeredName = name;
|
||||
this.ID = ID;
|
||||
this.recipeItems = recipeItems;
|
||||
}
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
*</pre>
|
||||
*/
|
||||
public Object[] recipeItems; // The actual recipe items. Change or verify them here.
|
||||
|
||||
public SpellRecipeItemsEvent(String name, int ID, Object[] recipeItems) {
|
||||
registeredName = name;
|
||||
this.ID = ID;
|
||||
this.recipeItems = recipeItems;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package am2.api.flickers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IFlickerController <T extends TileEntity> {
|
||||
public byte[] getMetadata(IFlickerFunctionality operator);
|
||||
public void setMetadata(IFlickerFunctionality operator, byte[] meta);
|
||||
public void removeMetadata(IFlickerFunctionality operator);
|
||||
public interface IFlickerController<T extends TileEntity> {
|
||||
public byte[] getMetadata(IFlickerFunctionality operator);
|
||||
|
||||
public void setMetadata(IFlickerFunctionality operator, byte[] meta);
|
||||
|
||||
public void removeMetadata(IFlickerFunctionality operator);
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
package am2.api.flickers;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlickerFunctionality {
|
||||
boolean RequiresPower();
|
||||
int PowerPerOperation();
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered);
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered);
|
||||
int TimeBetweenOperation(boolean powered, Affinity[] flickers);
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
Object[] getRecipe();
|
||||
boolean RequiresPower();
|
||||
|
||||
int PowerPerOperation();
|
||||
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered);
|
||||
|
||||
boolean DoOperation(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered);
|
||||
|
||||
int TimeBetweenOperation(boolean powered, Affinity[] flickers);
|
||||
|
||||
void RemoveOperator(World worldObj, IFlickerController controller, boolean powered, Affinity[] flickers);
|
||||
|
||||
Object[] getRecipe();
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package am2.api.flickers;
|
||||
|
||||
public interface IFlickerRegistry {
|
||||
/**
|
||||
* Attempts to register a flicker operator into the flicker network
|
||||
* @param singleton The instance of the class that should be called upon to perform the operations when loaded into a flicker block
|
||||
* @param mask The bit mask representing the flicker combination. These are ORed affinity masks. @see am2.api.spell.enums.Affinity.getMask for specific mask flags (flickers represent an affinity)
|
||||
* @return True if registered, false if the mask is already in use.
|
||||
*/
|
||||
public boolean registerFlickerOperator(IFlickerFunctionality singleton, int mask);
|
||||
/**
|
||||
* Attempts to register a flicker operator into the flicker network
|
||||
* @param singleton The instance of the class that should be called upon to perform the operations when loaded into a flicker block
|
||||
* @param mask The bit mask representing the flicker combination. These are ORed affinity masks. @see am2.api.spell.enums.Affinity.getMask for specific mask flags (flickers represent an affinity)
|
||||
* @return True if registered, false if the mask is already in use.
|
||||
*/
|
||||
public boolean registerFlickerOperator(IFlickerFunctionality singleton, int mask);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
public enum BadThingTypes{
|
||||
ALL,
|
||||
DARKNEXUS
|
||||
}
|
||||
public enum BadThingTypes {
|
||||
ALL,
|
||||
DARKNEXUS
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -14,25 +12,25 @@ import net.minecraft.world.World;
|
||||
*
|
||||
*/
|
||||
public interface IIllEffect extends Comparable {
|
||||
/**
|
||||
* The severity level of the effect. Controls at what instability level the effect could be applied.
|
||||
* @return One of the values in the IllEffectSeverity enum.
|
||||
*/
|
||||
public IllEffectSeverity GetSeverity();
|
||||
|
||||
/**
|
||||
* Callback to actually apply the ill effect.
|
||||
* @param world The world the effect is happening in
|
||||
* @param x The x coordinate of the vinteum crystal
|
||||
* @param y The y coordinate of the vinteum crystal
|
||||
* @param z The z coordinate of the vinteum crystal
|
||||
* @return A map of entity players affected, as well as any metadata relevant to the effect applied on that player.
|
||||
*/
|
||||
public Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Gets the localized description of this ill effect as pertains to the affected entity player.
|
||||
* This will only be called based on your own class, so you can assume the metadata matches your metadata output from ApplyIllEffect.
|
||||
*/
|
||||
public String getDescription(EntityPlayer player, Object metadata);
|
||||
/**
|
||||
* The severity level of the effect. Controls at what instability level the effect could be applied.
|
||||
* @return One of the values in the IllEffectSeverity enum.
|
||||
*/
|
||||
public IllEffectSeverity GetSeverity();
|
||||
|
||||
/**
|
||||
* Callback to actually apply the ill effect.
|
||||
* @param world The world the effect is happening in
|
||||
* @param x The x coordinate of the vinteum crystal
|
||||
* @param y The y coordinate of the vinteum crystal
|
||||
* @param z The z coordinate of the vinteum crystal
|
||||
* @return A map of entity players affected, as well as any metadata relevant to the effect applied on that player.
|
||||
*/
|
||||
public Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Gets the localized description of this ill effect as pertains to the affected entity player.
|
||||
* This will only be called based on your own class, so you can assume the metadata matches your metadata output from ApplyIllEffect.
|
||||
*/
|
||||
public String getDescription(EntityPlayer player, Object metadata);
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package am2.api.illeffect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -11,31 +9,30 @@ import net.minecraft.world.World;
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public abstract class IllEffectBase implements IIllEffect{
|
||||
public abstract class IllEffectBase implements IIllEffect {
|
||||
|
||||
@Override
|
||||
public final int compareTo(Object o) {
|
||||
if (!(o instanceof IIllEffect)) return 0;
|
||||
IIllEffect right = (IIllEffect)o;
|
||||
int myOrdinal = this.GetSeverity().ordinal();
|
||||
int theirOrdinal = right.GetSeverity().ordinal();
|
||||
|
||||
if (myOrdinal == theirOrdinal){
|
||||
return 0;
|
||||
}else if (myOrdinal < theirOrdinal){
|
||||
return -1;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public final int compareTo(Object o) {
|
||||
if (!(o instanceof IIllEffect)) return 0;
|
||||
IIllEffect right = (IIllEffect) o;
|
||||
int myOrdinal = this.GetSeverity().ordinal();
|
||||
int theirOrdinal = right.GetSeverity().ordinal();
|
||||
|
||||
@Override
|
||||
public abstract IllEffectSeverity GetSeverity();
|
||||
|
||||
@Override
|
||||
public abstract String getDescription(EntityPlayer player, Object metadata);
|
||||
if (myOrdinal == theirOrdinal) {
|
||||
return 0;
|
||||
} else if (myOrdinal < theirOrdinal) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
@Override
|
||||
public abstract IllEffectSeverity GetSeverity();
|
||||
|
||||
@Override
|
||||
public abstract String getDescription(EntityPlayer player, Object metadata);
|
||||
|
||||
@Override
|
||||
public abstract Map<EntityPlayer, Object> ApplyIllEffect(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -6,9 +6,9 @@ package am2.api.illeffect;
|
||||
*
|
||||
*/
|
||||
public enum IllEffectSeverity {
|
||||
MINOR,
|
||||
MODERATE,
|
||||
MAJOR,
|
||||
SEVERE,
|
||||
FATAL
|
||||
MINOR,
|
||||
MODERATE,
|
||||
MAJOR,
|
||||
SEVERE,
|
||||
FATAL
|
||||
}
|
||||
@@ -1,30 +1,29 @@
|
||||
package am2.api.items;
|
||||
|
||||
import am2.api.blocks.IKeystoneLockable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import am2.api.blocks.IKeystoneLockable;
|
||||
|
||||
public interface IKeystoneHelper {
|
||||
/**
|
||||
* Gets all the keys from all keystones in the entity's inventory
|
||||
*/
|
||||
public ArrayList<Long> GetKeysInInvenory(EntityLivingBase ent);
|
||||
/**
|
||||
* Gets all the keys from all keystones in the entity's inventory
|
||||
*/
|
||||
public ArrayList<Long> GetKeysInInvenory(EntityLivingBase ent);
|
||||
|
||||
/**
|
||||
* Returns the key combination made by the specified runes
|
||||
* @param runes An array of runes no larger than three elements (anything above will be ignored)
|
||||
* @return
|
||||
*/
|
||||
public long getKeyFromRunes(ItemStack[] runes);
|
||||
/**
|
||||
* Returns the key combination made by the specified runes
|
||||
* @param runes An array of runes no larger than three elements (anything above will be ignored)
|
||||
* @return
|
||||
*/
|
||||
public long getKeyFromRunes(ItemStack[] runes);
|
||||
|
||||
/**
|
||||
* Returns true or false based on whether the passed in player meets the keystone requirements needed to access the specified container
|
||||
* @param inventory The inventory the player is trying to access
|
||||
* @param player The player attempting the access check
|
||||
* @return True if the conditions are met, otherwise false
|
||||
*/
|
||||
public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player);
|
||||
/**
|
||||
* Returns true or false based on whether the passed in player meets the keystone requirements needed to access the specified container
|
||||
* @param inventory The inventory the player is trying to access
|
||||
* @param player The player attempting the access check
|
||||
* @return True if the conditions are met, otherwise false
|
||||
*/
|
||||
public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player);
|
||||
}
|
||||
@@ -2,15 +2,14 @@ package am2.api.items.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class ArmorTextureEvent extends Event {
|
||||
public final int slot;
|
||||
public final int renderIndex;
|
||||
|
||||
public class ArmorTextureEvent extends Event{
|
||||
public final int slot;
|
||||
public final int renderIndex;
|
||||
public String texture;
|
||||
|
||||
public String texture;
|
||||
|
||||
public ArmorTextureEvent(int slot, int renderIndex){
|
||||
this.slot = slot;
|
||||
this.renderIndex = renderIndex;
|
||||
}
|
||||
public ArmorTextureEvent(int slot, int renderIndex) {
|
||||
this.slot = slot;
|
||||
this.renderIndex = renderIndex;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +1,60 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IArmorImbuement {
|
||||
/**
|
||||
* Gets the ID of the infusion effect. Must be unique.
|
||||
*/
|
||||
String getID();
|
||||
/**
|
||||
* Gets the IIcon index for the texture in the GUI
|
||||
*/
|
||||
int getIconIndex();
|
||||
/**
|
||||
* Gets the tier for this infusion
|
||||
*/
|
||||
ImbuementTiers getTier();
|
||||
/**
|
||||
* Gets all situations under which this infusion applies
|
||||
*/
|
||||
EnumSet<ImbuementApplicationTypes> getApplicationTypes();
|
||||
/**
|
||||
* Applies the effect. This will be called when any of the application types is matched in an event.
|
||||
* @param player The player wearing the armor
|
||||
* @param world The world the player is in
|
||||
* @param stack The itemstack that was matched
|
||||
* @param matchedType The application type that was matched.
|
||||
* @param params Depends on the application type.
|
||||
* <br/>
|
||||
* In the case of ON_TICK, it will be a 1-length array with the first element being the LivingEvent event <br/>
|
||||
* In the case of ON_JUMP, it will be a 1-length array with the first element being the LivingJumpEvent event<br/>
|
||||
* In the case of ON_HIT, it will be a 1-length array with the first element being the LivingHurtEvent event<br/>
|
||||
* In the case of ON_MINING_SPEED, it will be a 1-length array with the first element being the BreakSpeed event <br/>
|
||||
*/
|
||||
boolean applyEffect(EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object...params);
|
||||
/**
|
||||
* Gets the ID of the infusion effect. Must be unique.
|
||||
*/
|
||||
String getID();
|
||||
/**
|
||||
* Gets the IIcon index for the texture in the GUI
|
||||
*/
|
||||
int getIconIndex();
|
||||
/**
|
||||
* Gets the tier for this infusion
|
||||
*/
|
||||
ImbuementTiers getTier();
|
||||
/**
|
||||
* Gets all situations under which this infusion applies
|
||||
*/
|
||||
EnumSet<ImbuementApplicationTypes> getApplicationTypes();
|
||||
/**
|
||||
* Applies the effect. This will be called when any of the application types is matched in an event.
|
||||
* @param player The player wearing the armor
|
||||
* @param world The world the player is in
|
||||
* @param stack The itemstack that was matched
|
||||
* @param matchedType The application type that was matched.
|
||||
* @param params Depends on the application type.
|
||||
* <br/>
|
||||
* In the case of ON_TICK, it will be a 1-length array with the first element being the LivingEvent event <br/>
|
||||
* In the case of ON_JUMP, it will be a 1-length array with the first element being the LivingJumpEvent event<br/>
|
||||
* In the case of ON_HIT, it will be a 1-length array with the first element being the LivingHurtEvent event<br/>
|
||||
* In the case of ON_MINING_SPEED, it will be a 1-length array with the first element being the BreakSpeed event <br/>
|
||||
*/
|
||||
boolean applyEffect(
|
||||
EntityPlayer player, World world, ItemStack stack, ImbuementApplicationTypes matchedType, Object... params);
|
||||
|
||||
/**
|
||||
* Gets all armor slots that this effect can be applied to
|
||||
*/
|
||||
int[] getValidSlots();
|
||||
/**
|
||||
* Gets all armor slots that this effect can be applied to
|
||||
*/
|
||||
int[] getValidSlots();
|
||||
|
||||
/**
|
||||
* If the slot is on cooldown, can the effect still apply?
|
||||
*/
|
||||
boolean canApplyOnCooldown();
|
||||
/**
|
||||
* If the slot is on cooldown, can the effect still apply?
|
||||
*/
|
||||
boolean canApplyOnCooldown();
|
||||
|
||||
/**
|
||||
* Get the amount of cooldown to add to the slot once the effect applies
|
||||
*/
|
||||
int getCooldown();
|
||||
/**
|
||||
* Get the amount of cooldown to add to the slot once the effect applies
|
||||
*/
|
||||
int getCooldown();
|
||||
|
||||
/**
|
||||
* How much does the infusion damage the armor?
|
||||
*/
|
||||
int getArmorDamage();
|
||||
/**
|
||||
* How much does the infusion damage the armor?
|
||||
*/
|
||||
int getArmorDamage();
|
||||
}
|
||||
@@ -2,27 +2,26 @@ package am2.api.items.armor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public interface IImbuementRegistry {
|
||||
/**
|
||||
* Registers a new imbuement instance into the system
|
||||
*/
|
||||
void registerImbuement(IArmorImbuement imbuementInstance);
|
||||
/**
|
||||
* Locates the specified imbuement registered to the passed-in ID.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
IArmorImbuement getImbuementByID(String ID);
|
||||
/**
|
||||
* Returns all imbuements registered into the specified tier for the given armor type (slot).
|
||||
*/
|
||||
IArmorImbuement[] getImbuementsForTier(ImbuementTiers tier, int armorType);
|
||||
/**
|
||||
* Is the given imbuement instance present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, IArmorImbuement imbuement);
|
||||
/**
|
||||
* Is the given imbuement ID present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, String id);
|
||||
/**
|
||||
* Registers a new imbuement instance into the system
|
||||
*/
|
||||
void registerImbuement(IArmorImbuement imbuementInstance);
|
||||
/**
|
||||
* Locates the specified imbuement registered to the passed-in ID.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
IArmorImbuement getImbuementByID(String ID);
|
||||
/**
|
||||
* Returns all imbuements registered into the specified tier for the given armor type (slot).
|
||||
*/
|
||||
IArmorImbuement[] getImbuementsForTier(ImbuementTiers tier, int armorType);
|
||||
/**
|
||||
* Is the given imbuement instance present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, IArmorImbuement imbuement);
|
||||
/**
|
||||
* Is the given imbuement ID present on the passed-in item stack?
|
||||
*/
|
||||
boolean isImbuementPresent(ItemStack stack, String id);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
public enum ImbuementApplicationTypes {
|
||||
NONE,
|
||||
ON_TICK,
|
||||
ON_HIT,
|
||||
ON_JUMP,
|
||||
ON_MINING_SPEED,
|
||||
ON_DEATH
|
||||
NONE,
|
||||
ON_TICK,
|
||||
ON_HIT,
|
||||
ON_JUMP,
|
||||
ON_MINING_SPEED,
|
||||
ON_DEATH
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package am2.api.items.armor;
|
||||
|
||||
public enum ImbuementTiers {
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD,
|
||||
FOURTH
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD,
|
||||
FOURTH
|
||||
}
|
||||
@@ -1,42 +1,39 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMLineSegment {
|
||||
private AMVector3 a,b;
|
||||
private AMVector3 a, b;
|
||||
|
||||
public AMLineSegment(AMVector3 a, AMVector3 b){
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
public AMLineSegment(AMVector3 a, AMVector3 b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public AMVector3 closestPointOnLine(AMVector3 vPoint)
|
||||
{
|
||||
public AMVector3 closestPointOnLine(AMVector3 vPoint) {
|
||||
|
||||
// Create the vector from end point vA to our point vPoint.
|
||||
AMVector3 vVector1 = vPoint.copy().sub(a);
|
||||
// Create the vector from end point vA to our point vPoint.
|
||||
AMVector3 vVector1 = vPoint.copy().sub(a);
|
||||
|
||||
// Create a normalized direction vector from end point vA to end point vB
|
||||
AMVector3 vVector2 = b.copy().sub(a).normalize();
|
||||
// Create a normalized direction vector from end point vA to end point vB
|
||||
AMVector3 vVector2 = b.copy().sub(a).normalize();
|
||||
|
||||
// Use the distance formula to find the distance of the line segment (or magnitude)
|
||||
float d = (float) a.distanceTo(b);
|
||||
// Use the distance formula to find the distance of the line segment (or magnitude)
|
||||
float d = (float) a.distanceTo(b);
|
||||
|
||||
// Using the dot product, we project the vVector1 onto the vector vVector2.
|
||||
// This essentially gives us the distance from our projected vector from vA.
|
||||
float t = AMVector3.dotProduct(vVector2, vVector1);
|
||||
// Using the dot product, we project the vVector1 onto the vector vVector2.
|
||||
// This essentially gives us the distance from our projected vector from vA.
|
||||
float t = AMVector3.dotProduct(vVector2, vVector1);
|
||||
|
||||
// If our projected distance from vA, "t", is less than or equal to 0, it must
|
||||
// be closest to the end point vA. We want to return this end point.
|
||||
if (t <= 0)
|
||||
return a.copy();
|
||||
// If our projected distance from vA, "t", is less than or equal to 0, it must
|
||||
// be closest to the end point vA. We want to return this end point.
|
||||
if (t <= 0) return a.copy();
|
||||
|
||||
// If our projected distance from vA, "t", is greater than or equal to the magnitude
|
||||
// or distance of the line segment, it must be closest to the end point vB. So, return vB.
|
||||
if (t >= d)
|
||||
return b.copy();
|
||||
// If our projected distance from vA, "t", is greater than or equal to the magnitude
|
||||
// or distance of the line segment, it must be closest to the end point vB. So, return vB.
|
||||
if (t >= d) return b.copy();
|
||||
|
||||
AMVector3 vVector3 = vVector2.copy().scale(t);
|
||||
AMVector3 vClosestPoint = a.copy().add(vVector3);
|
||||
AMVector3 vVector3 = vVector2.copy().scale(t);
|
||||
AMVector3 vClosestPoint = a.copy().add(vVector3);
|
||||
|
||||
return vClosestPoint;
|
||||
}
|
||||
return vClosestPoint;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,50 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMMatrix4 {
|
||||
float[] mat;
|
||||
|
||||
public class AMMatrix4
|
||||
{
|
||||
float[] mat;
|
||||
public AMMatrix4() {
|
||||
loadIdentity();
|
||||
}
|
||||
|
||||
public AMMatrix4()
|
||||
{
|
||||
loadIdentity();
|
||||
}
|
||||
public AMMatrix4 loadIdentity() {
|
||||
this.mat = new float[16];
|
||||
float tmp35_34 = (this.mat[10] = this.mat[15] = 1.0F);
|
||||
this.mat[5] = tmp35_34;
|
||||
this.mat[0] = tmp35_34;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMMatrix4 loadIdentity()
|
||||
{
|
||||
this.mat = new float[16];
|
||||
float tmp35_34 = (this.mat[10] = this.mat[15] = 1.0F);
|
||||
this.mat[5] = tmp35_34;
|
||||
this.mat[0] = tmp35_34;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 translate(AMVector3 vec) {
|
||||
float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3];
|
||||
float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7];
|
||||
float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11];
|
||||
vec.x = x;
|
||||
vec.y = y;
|
||||
vec.z = z;
|
||||
return vec;
|
||||
}
|
||||
|
||||
public AMVector3 translate(AMVector3 vec)
|
||||
{
|
||||
float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3];
|
||||
float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7];
|
||||
float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11];
|
||||
vec.x = x;
|
||||
vec.y = y;
|
||||
vec.z = z;
|
||||
return vec;
|
||||
}
|
||||
|
||||
public static AMMatrix4 rotationMat(double angle, AMVector3 axis)
|
||||
{
|
||||
axis = axis.copy().normalize();
|
||||
float x = axis.x;
|
||||
float y = axis.y;
|
||||
float z = axis.z;
|
||||
angle *= 0.0174532925D;
|
||||
float cos = (float)Math.cos(angle);
|
||||
float ocos = 1.0F - cos;
|
||||
float sin = (float)Math.sin(angle);
|
||||
AMMatrix4 rotmat = new AMMatrix4();
|
||||
rotmat.mat[0] = (x * x * ocos + cos);
|
||||
rotmat.mat[1] = (y * x * ocos + z * sin);
|
||||
rotmat.mat[2] = (x * z * ocos - y * sin);
|
||||
rotmat.mat[4] = (x * y * ocos - z * sin);
|
||||
rotmat.mat[5] = (y * y * ocos + cos);
|
||||
rotmat.mat[6] = (y * z * ocos + x * sin);
|
||||
rotmat.mat[8] = (x * z * ocos + y * sin);
|
||||
rotmat.mat[9] = (y * z * ocos - x * sin);
|
||||
rotmat.mat[10] = (z * z * ocos + cos);
|
||||
rotmat.mat[15] = 1.0F;
|
||||
return rotmat;
|
||||
}
|
||||
public static AMMatrix4 rotationMat(double angle, AMVector3 axis) {
|
||||
axis = axis.copy().normalize();
|
||||
float x = axis.x;
|
||||
float y = axis.y;
|
||||
float z = axis.z;
|
||||
angle *= 0.0174532925D;
|
||||
float cos = (float) Math.cos(angle);
|
||||
float ocos = 1.0F - cos;
|
||||
float sin = (float) Math.sin(angle);
|
||||
AMMatrix4 rotmat = new AMMatrix4();
|
||||
rotmat.mat[0] = (x * x * ocos + cos);
|
||||
rotmat.mat[1] = (y * x * ocos + z * sin);
|
||||
rotmat.mat[2] = (x * z * ocos - y * sin);
|
||||
rotmat.mat[4] = (x * y * ocos - z * sin);
|
||||
rotmat.mat[5] = (y * y * ocos + cos);
|
||||
rotmat.mat[6] = (y * z * ocos + x * sin);
|
||||
rotmat.mat[8] = (x * z * ocos + y * sin);
|
||||
rotmat.mat[9] = (y * z * ocos - x * sin);
|
||||
rotmat.mat[10] = (z * z * ocos + cos);
|
||||
rotmat.mat[15] = 1.0F;
|
||||
return rotmat;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,54 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMPlane {
|
||||
AMVector3 planeDef[];
|
||||
AMVector3 planeDef[];
|
||||
|
||||
public AMPlane(AMVector3...plane){
|
||||
planeDef = plane;
|
||||
}
|
||||
public AMPlane(AMVector3... plane) {
|
||||
planeDef = plane;
|
||||
}
|
||||
|
||||
private AMVector3 planeNormal(){
|
||||
AMVector3 vVector1 = new AMVector3(planeDef[2], planeDef[0]);
|
||||
AMVector3 vVector2 = new AMVector3(planeDef[1], planeDef[0]);
|
||||
private AMVector3 planeNormal() {
|
||||
AMVector3 vVector1 = new AMVector3(planeDef[2], planeDef[0]);
|
||||
AMVector3 vVector2 = new AMVector3(planeDef[1], planeDef[0]);
|
||||
|
||||
AMVector3 vNormal = AMVector3.crossProduct(vVector1, vVector2);
|
||||
AMVector3 vNormal = AMVector3.crossProduct(vVector1, vVector2);
|
||||
|
||||
vNormal.normalize();
|
||||
return vNormal;
|
||||
}
|
||||
vNormal.normalize();
|
||||
return vNormal;
|
||||
}
|
||||
|
||||
private float planeDistance(AMVector3 normal, AMVector3 point){
|
||||
float distance = 0;
|
||||
distance = - ((normal.x * point.x) + (normal.y * point.y) + (normal.z * point.z));
|
||||
private float planeDistance(AMVector3 normal, AMVector3 point) {
|
||||
float distance = 0;
|
||||
distance = -((normal.x * point.x) + (normal.y * point.y) + (normal.z * point.z));
|
||||
|
||||
return distance;
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
public boolean lineSegmentCrosses(AMVector3 p1, AMVector3 p2){
|
||||
float distance1=0, distance2=0;
|
||||
public boolean lineSegmentCrosses(AMVector3 p1, AMVector3 p2) {
|
||||
float distance1 = 0, distance2 = 0;
|
||||
|
||||
AMVector3 vNormal = planeNormal();
|
||||
AMVector3 vNormal = planeNormal();
|
||||
|
||||
float originDistance = planeDistance(vNormal, planeDef[0]);
|
||||
float originDistance = planeDistance(vNormal, planeDef[0]);
|
||||
|
||||
distance1 = ((vNormal.x * p1.x) + // Ax +
|
||||
(vNormal.y * p1.y) + // Bx +
|
||||
(vNormal.z * p1.z)) + originDistance; // Cz + D
|
||||
distance1 = ((vNormal.x * p1.x)
|
||||
+ // Ax +
|
||||
(vNormal.y * p1.y)
|
||||
+ // Bx +
|
||||
(vNormal.z * p1.z))
|
||||
+ originDistance; // Cz + D
|
||||
|
||||
distance2 = ((vNormal.x * p2.x) + // Ax +
|
||||
(vNormal.y * p2.y) + // Bx +
|
||||
(vNormal.z * p2.z)) + originDistance; // Cz + D
|
||||
distance2 = ((vNormal.x * p2.x)
|
||||
+ // Ax +
|
||||
(vNormal.y * p2.y)
|
||||
+ // Bx +
|
||||
(vNormal.z * p2.z))
|
||||
+ originDistance; // Cz + D
|
||||
|
||||
if(distance1 * distance2 >= 0) // Check to see if both point's distances are both negative or both positive
|
||||
return false; // Return false if each point has the same sign. -1 and 1 would mean each point is on either side of the plane. -1 -2 or 3 4 wouldn't...
|
||||
if (distance1 * distance2 >= 0) // Check to see if both point's distances are both negative or both positive
|
||||
return false; // Return false if each point has the same sign. -1 and 1 would mean each point is on either side
|
||||
// of the plane. -1 -2 or 3 4 wouldn't...
|
||||
|
||||
return true; // The line intersected the plane, Return TRUE
|
||||
}
|
||||
return true; // The line intersected the plane, Return TRUE
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
package am2.api.math;
|
||||
|
||||
public class AMVector2 {
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public int iX;
|
||||
public int iY;
|
||||
|
||||
public AMVector2(double x, double y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.iX = (int)x;
|
||||
this.iY = (int)y;
|
||||
}
|
||||
|
||||
public AMVector2 subtract(AMVector2 vec){
|
||||
return new AMVector2(this.x - vec.x, this.y - vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 add(AMVector2 vec){
|
||||
return new AMVector2(this.x + vec.x, this.y + vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 multiply(AMVector2 vec){
|
||||
return new AMVector2(this.x * vec.x, this.y * vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 divide(AMVector2 vec){
|
||||
return new AMVector2(this.x / vec.x, this.y / vec.y);
|
||||
}
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public int iX;
|
||||
public int iY;
|
||||
|
||||
public AMVector2(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.iX = (int) x;
|
||||
this.iY = (int) y;
|
||||
}
|
||||
|
||||
public AMVector2 subtract(AMVector2 vec) {
|
||||
return new AMVector2(this.x - vec.x, this.y - vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 add(AMVector2 vec) {
|
||||
return new AMVector2(this.x + vec.x, this.y + vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 multiply(AMVector2 vec) {
|
||||
return new AMVector2(this.x * vec.x, this.y * vec.y);
|
||||
}
|
||||
|
||||
public AMVector2 divide(AMVector2 vec) {
|
||||
return new AMVector2(this.x / vec.x, this.y / vec.y);
|
||||
}
|
||||
}
|
||||
@@ -6,241 +6,219 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class AMVector3
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public class AMVector3 {
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public AMVector3(double x, double y, double z)
|
||||
{
|
||||
this.x = (float)x;
|
||||
this.y = (float)y;
|
||||
this.z = (float)z;
|
||||
}
|
||||
public AMVector3(double x, double y, double z) {
|
||||
this.x = (float) x;
|
||||
this.y = (float) y;
|
||||
this.z = (float) z;
|
||||
}
|
||||
|
||||
public AMVector3(TileEntity tile)
|
||||
{
|
||||
this.x = (tile.xCoord);
|
||||
this.y = (tile.yCoord);
|
||||
this.z = (tile.zCoord);
|
||||
}
|
||||
public AMVector3(TileEntity tile) {
|
||||
this.x = (tile.xCoord);
|
||||
this.y = (tile.yCoord);
|
||||
this.z = (tile.zCoord);
|
||||
}
|
||||
|
||||
public AMVector3(Vec3 vec){
|
||||
this.x = (float) vec.xCoord;
|
||||
this.y = (float) vec.yCoord;
|
||||
this.z = (float) vec.zCoord;
|
||||
}
|
||||
public AMVector3(Vec3 vec) {
|
||||
this.x = (float) vec.xCoord;
|
||||
this.y = (float) vec.yCoord;
|
||||
this.z = (float) vec.zCoord;
|
||||
}
|
||||
|
||||
public AMVector3(AMVector3 a, AMVector3 b){
|
||||
this.x = a.x - b.x; // Get the X value of our new vector
|
||||
this.y = a.y - b.y; // Get the Y value of our new vector
|
||||
this.z = a.z - b.z; // Get the Z value of our new vector
|
||||
}
|
||||
public AMVector3(AMVector3 a, AMVector3 b) {
|
||||
this.x = a.x - b.x; // Get the X value of our new vector
|
||||
this.y = a.y - b.y; // Get the Y value of our new vector
|
||||
this.z = a.z - b.z; // Get the Z value of our new vector
|
||||
}
|
||||
|
||||
public AMVector3(Entity entity)
|
||||
{
|
||||
this(entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
public AMVector3(Entity entity) {
|
||||
this(entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
|
||||
public AMVector3 add(AMVector3 vec)
|
||||
{
|
||||
this.x += vec.x;
|
||||
this.y += vec.y;
|
||||
this.z += vec.z;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 add(AMVector3 vec) {
|
||||
this.x += vec.x;
|
||||
this.y += vec.y;
|
||||
this.z += vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 sub(AMVector3 vec)
|
||||
{
|
||||
this.x -= vec.x;
|
||||
this.y -= vec.y;
|
||||
this.z -= vec.z;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 sub(AMVector3 vec) {
|
||||
this.x -= vec.x;
|
||||
this.y -= vec.y;
|
||||
this.z -= vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 scale(float scale)
|
||||
{
|
||||
this.x *= scale;
|
||||
this.y *= scale;
|
||||
this.z *= scale;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 scale(float scale) {
|
||||
this.x *= scale;
|
||||
this.y *= scale;
|
||||
this.z *= scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 scale(float scalex, float scaley, float scalez)
|
||||
{
|
||||
this.x *= scalex;
|
||||
this.y *= scaley;
|
||||
this.z *= scalez;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 scale(float scalex, float scaley, float scalez) {
|
||||
this.x *= scalex;
|
||||
this.y *= scaley;
|
||||
this.z *= scalez;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 modulo(float divisor){
|
||||
this.x %= divisor;
|
||||
this.y %= divisor;
|
||||
this.z %= divisor;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 modulo(float divisor) {
|
||||
this.x %= divisor;
|
||||
this.y %= divisor;
|
||||
this.z %= divisor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AMVector3 normalize()
|
||||
{
|
||||
float length = length();
|
||||
this.x /= length;
|
||||
this.y /= length;
|
||||
this.z /= length;
|
||||
return this;
|
||||
}
|
||||
public AMVector3 normalize() {
|
||||
float length = length();
|
||||
this.x /= length;
|
||||
this.y /= length;
|
||||
this.z /= length;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float length()
|
||||
{
|
||||
return (float)Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
}
|
||||
public float length() {
|
||||
return (float) Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
}
|
||||
|
||||
public float lengthPow2()
|
||||
{
|
||||
return this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
}
|
||||
public float lengthPow2() {
|
||||
return this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
}
|
||||
|
||||
public AMVector3 copy()
|
||||
{
|
||||
return new AMVector3(this.x, this.y, this.z);
|
||||
}
|
||||
public AMVector3 copy() {
|
||||
return new AMVector3(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public static AMVector3 crossProduct(AMVector3 vec1, AMVector3 vec2)
|
||||
{
|
||||
return new AMVector3(vec1.y * vec2.z - vec1.z * vec2.y, vec1.z * vec2.x - vec1.x * vec2.z, vec1.x * vec2.y - vec1.y * vec2.x);
|
||||
}
|
||||
public static AMVector3 crossProduct(AMVector3 vec1, AMVector3 vec2) {
|
||||
return new AMVector3(
|
||||
vec1.y * vec2.z - vec1.z * vec2.y,
|
||||
vec1.z * vec2.x - vec1.x * vec2.z,
|
||||
vec1.x * vec2.y - vec1.y * vec2.x);
|
||||
}
|
||||
|
||||
public static AMVector3 xCrossProduct(AMVector3 vec)
|
||||
{
|
||||
return new AMVector3(0.0D, vec.z, -vec.y);
|
||||
}
|
||||
public static AMVector3 xCrossProduct(AMVector3 vec) {
|
||||
return new AMVector3(0.0D, vec.z, -vec.y);
|
||||
}
|
||||
|
||||
public static AMVector3 zCrossProduct(AMVector3 vec)
|
||||
{
|
||||
return new AMVector3(-vec.y, vec.x, 0.0D);
|
||||
}
|
||||
public static AMVector3 zCrossProduct(AMVector3 vec) {
|
||||
return new AMVector3(-vec.y, vec.x, 0.0D);
|
||||
}
|
||||
|
||||
public static float dotProduct(AMVector3 vec1, AMVector3 vec2)
|
||||
{
|
||||
return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z);
|
||||
}
|
||||
public static float dotProduct(AMVector3 vec1, AMVector3 vec2) {
|
||||
return (vec1.x * vec2.x) + (vec1.y * vec2.y) + (vec1.z * vec2.z);
|
||||
}
|
||||
|
||||
public static float angle(AMVector3 vec1, AMVector3 vec2)
|
||||
{
|
||||
return anglePreNorm(vec1.copy().normalize(), vec2.copy().normalize());
|
||||
}
|
||||
public static float angle(AMVector3 vec1, AMVector3 vec2) {
|
||||
return anglePreNorm(vec1.copy().normalize(), vec2.copy().normalize());
|
||||
}
|
||||
|
||||
public static float anglePreNorm(AMVector3 vec1, AMVector3 vec2)
|
||||
{
|
||||
return (float)Math.acos(dotProduct(vec1, vec2));
|
||||
}
|
||||
public static float anglePreNorm(AMVector3 vec1, AMVector3 vec2) {
|
||||
return (float) Math.acos(dotProduct(vec1, vec2));
|
||||
}
|
||||
|
||||
public static AMVector3 zero(){
|
||||
return new AMVector3(0,0,0);
|
||||
}
|
||||
public static AMVector3 zero() {
|
||||
return new AMVector3(0, 0, 0);
|
||||
}
|
||||
|
||||
public AMVector3 rotate(float angle, AMVector3 axis)
|
||||
{
|
||||
return AMMatrix4.rotationMat(angle, axis).translate(this);
|
||||
}
|
||||
public AMVector3 rotate(float angle, AMVector3 axis) {
|
||||
return AMMatrix4.rotationMat(angle, axis).translate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[" + this.x + "," + this.y + "," + this.z + "]";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + this.x + "," + this.y + "," + this.z + "]";
|
||||
}
|
||||
|
||||
public Vec3 toVec3D()
|
||||
{
|
||||
return Vec3.createVectorHelper(this.x, this.y, this.z);
|
||||
}
|
||||
public Vec3 toVec3D() {
|
||||
return Vec3.createVectorHelper(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public static AMVector3 getPerpendicular(AMVector3 vec)
|
||||
{
|
||||
if (vec.z == 0.0F) {
|
||||
return zCrossProduct(vec);
|
||||
}
|
||||
return xCrossProduct(vec);
|
||||
}
|
||||
public static AMVector3 getPerpendicular(AMVector3 vec) {
|
||||
if (vec.z == 0.0F) {
|
||||
return zCrossProduct(vec);
|
||||
}
|
||||
return xCrossProduct(vec);
|
||||
}
|
||||
|
||||
public boolean isZero()
|
||||
{
|
||||
return (this.x == 0.0F) && (this.y == 0.0F) && (this.z == 0.0F);
|
||||
}
|
||||
public boolean isZero() {
|
||||
return (this.x == 0.0F) && (this.y == 0.0F) && (this.z == 0.0F);
|
||||
}
|
||||
|
||||
public boolean isWithinRange(float min, float max)
|
||||
{
|
||||
return (this.x >= min && x <= max) && (this.y >= min && this.y <= max) && (this.z >= min && this.z <= max);
|
||||
}
|
||||
public boolean isWithinRange(float min, float max) {
|
||||
return (this.x >= min && x <= max) && (this.y >= min && this.y <= max) && (this.z >= min && this.z <= max);
|
||||
}
|
||||
|
||||
public double distanceTo(AMVector3 target){
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6);
|
||||
}
|
||||
public double distanceTo(AMVector3 target) {
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6);
|
||||
}
|
||||
|
||||
public double distanceSqTo(AMVector3 target){
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return var2 * var2 + var4 * var4 + var6 * var6;
|
||||
}
|
||||
public double distanceSqTo(AMVector3 target) {
|
||||
double var2 = target.x - this.x;
|
||||
double var4 = target.y - this.y;
|
||||
double var6 = target.z - this.z;
|
||||
return var2 * var2 + var4 * var4 + var6 * var6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral floors
|
||||
*/
|
||||
public void floorToI() {
|
||||
this.x = (float) Math.floor(this.x);
|
||||
this.y = (float) Math.floor(this.y);
|
||||
this.z = (float) Math.floor(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral floors
|
||||
*/
|
||||
public void floorToI(){
|
||||
this.x = (float) Math.floor(this.x);
|
||||
this.y = (float) Math.floor(this.y);
|
||||
this.z = (float) Math.floor(this.z);
|
||||
}
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral logical roundings
|
||||
*/
|
||||
public void roundToI() {
|
||||
this.x = Math.round(this.x);
|
||||
this.y = Math.round(this.y);
|
||||
this.z = Math.round(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral logical roundings
|
||||
*/
|
||||
public void roundToI(){
|
||||
this.x = Math.round(this.x);
|
||||
this.y = Math.round(this.y);
|
||||
this.z = Math.round(this.z);
|
||||
}
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral ceilings
|
||||
*/
|
||||
public void ceilToI() {
|
||||
this.x = (float) Math.ceil(this.x);
|
||||
this.y = (float) Math.ceil(this.y);
|
||||
this.z = (float) Math.ceil(this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds all values in this Vector to their integral ceilings
|
||||
*/
|
||||
public void ceilToI(){
|
||||
this.x = (float) Math.ceil(this.x);
|
||||
this.y = (float) Math.ceil(this.y);
|
||||
this.z = (float) Math.ceil(this.z);
|
||||
}
|
||||
/**
|
||||
* Writes the vector3 to the specified compound - note that the way this function works, only one vector3 can be written to a compound at a time.
|
||||
* Use sub-compounds if you need more!
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
compound.setFloat("Vec3_x", x);
|
||||
compound.setFloat("Vec3_y", y);
|
||||
compound.setFloat("Vec3_z", z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the vector3 to the specified compound - note that the way this function works, only one vector3 can be written to a compound at a time.
|
||||
* Use sub-compounds if you need more!
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setFloat("Vec3_x", x);
|
||||
compound.setFloat("Vec3_y", y);
|
||||
compound.setFloat("Vec3_z", z);
|
||||
}
|
||||
public static AMVector3 readFromNBT(NBTTagCompound compound) {
|
||||
return new AMVector3(compound.getFloat("Vec3_x"), compound.getFloat("Vec3_y"), compound.getFloat("Vec3_z"));
|
||||
}
|
||||
|
||||
public static AMVector3 readFromNBT(NBTTagCompound compound){
|
||||
return new AMVector3(compound.getFloat("Vec3_x"), compound.getFloat("Vec3_y"), compound.getFloat("Vec3_z"));
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AMVector3) {
|
||||
AMVector3 comp = (AMVector3) obj;
|
||||
return (comp.x == this.x && comp.y == this.y && comp.z == this.z);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AMVector3){
|
||||
AMVector3 comp = (AMVector3) obj;
|
||||
return (comp.x == this.x && comp.y == this.y && comp.z == this.z);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) (x + y + z);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) (x + y + z);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,26 @@
|
||||
package am2.api.particles;
|
||||
|
||||
public interface IBeamParticle {
|
||||
/**
|
||||
* Sets the beam type. Determines the texture of the beam. Valid types are 0-2.
|
||||
*/
|
||||
public void setType(int type);
|
||||
/**
|
||||
* Sets the color from a single integer. Good for hex colors.
|
||||
*/
|
||||
public void setRGBColor(int color);
|
||||
/**
|
||||
* Sets the beam color from 3 int values (0-255).
|
||||
*/
|
||||
public void setRGBColorI(int r, int g, int b);
|
||||
/**
|
||||
* Sets the beam color from 3 floating point values (0.0f - 1.0f)
|
||||
*/
|
||||
public void setRGBColorF(float r, float g, float b);
|
||||
/**
|
||||
* Indicates that this beam is being cast by a player that is in first person. Should only be called when creating a beam from the local player, if the player is in first person.
|
||||
* <br />
|
||||
* This will offset the beam to make it look like it is coming from the player's active item and not their face.
|
||||
*/
|
||||
public void setFirstPersonPlayerCast();
|
||||
/**
|
||||
* Sets the beam type. Determines the texture of the beam. Valid types are 0-2.
|
||||
*/
|
||||
public void setType(int type);
|
||||
/**
|
||||
* Sets the color from a single integer. Good for hex colors.
|
||||
*/
|
||||
public void setRGBColor(int color);
|
||||
/**
|
||||
* Sets the beam color from 3 int values (0-255).
|
||||
*/
|
||||
public void setRGBColorI(int r, int g, int b);
|
||||
/**
|
||||
* Sets the beam color from 3 floating point values (0.0f - 1.0f)
|
||||
*/
|
||||
public void setRGBColorF(float r, float g, float b);
|
||||
/**
|
||||
* Indicates that this beam is being cast by a player that is in first person. Should only be called when creating a beam from the local player, if the player is in first person.
|
||||
* <br />
|
||||
* This will offset the beam to make it look like it is coming from the player's active item and not their face.
|
||||
*/
|
||||
public void setFirstPersonPlayerCast();
|
||||
}
|
||||
@@ -3,14 +3,14 @@ package am2.api.power;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IObeliskFuelHelper {
|
||||
/**
|
||||
* Registers a new fuel type for the obelisk to burn
|
||||
* @param stack The stack to use as a comparator (stackSize is ignored, just use 1)
|
||||
* @param burnTime How long the obelisk should burn for when given one of these items
|
||||
*/
|
||||
public void registerFuelType(ItemStack stack, int burnTime);
|
||||
/**
|
||||
* Retrieves the burn time for the specified stack. Returns 0 if it is not a valid fuel.
|
||||
*/
|
||||
public int getFuelBurnTime(ItemStack stack);
|
||||
/**
|
||||
* Registers a new fuel type for the obelisk to burn
|
||||
* @param stack The stack to use as a comparator (stackSize is ignored, just use 1)
|
||||
* @param burnTime How long the obelisk should burn for when given one of these items
|
||||
*/
|
||||
public void registerFuelType(ItemStack stack, int burnTime);
|
||||
/**
|
||||
* Retrieves the burn time for the specified stack. Returns 0 if it is not a valid fuel.
|
||||
*/
|
||||
public int getFuelBurnTime(ItemStack stack);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package am2.api.power;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
@@ -6,49 +7,48 @@ import net.minecraft.tileentity.TileEntity;
|
||||
* @author Mithion
|
||||
* This will eventually allow you to interface with the AM power network - currently it is not fully working.
|
||||
*/
|
||||
public interface IPowerNode <T extends TileEntity> {
|
||||
public interface IPowerNode<T extends TileEntity> {
|
||||
|
||||
/**
|
||||
* Gets the current capacity in the power block
|
||||
*/
|
||||
public float getCapacity();
|
||||
/**
|
||||
* Gets the current capacity in the power block
|
||||
*/
|
||||
public float getCapacity();
|
||||
|
||||
/**
|
||||
* Can this block provide power?
|
||||
* @param type The power type we are checking for
|
||||
*/
|
||||
public boolean canProvidePower(PowerTypes type);
|
||||
/**
|
||||
* Can this block provide power?
|
||||
* @param type The power type we are checking for
|
||||
*/
|
||||
public boolean canProvidePower(PowerTypes type);
|
||||
|
||||
/**
|
||||
* Can this block relay power?
|
||||
* @param type The type of power we are looking for
|
||||
*/
|
||||
public boolean canRelayPower(PowerTypes type);
|
||||
/**
|
||||
* Can this block relay power?
|
||||
* @param type The type of power we are looking for
|
||||
*/
|
||||
public boolean canRelayPower(PowerTypes type);
|
||||
|
||||
/**
|
||||
* Can this block request power?
|
||||
*/
|
||||
public boolean canRequestPower();
|
||||
/**
|
||||
* Can this block request power?
|
||||
*/
|
||||
public boolean canRequestPower();
|
||||
|
||||
/**
|
||||
* Is this block a nexus?
|
||||
*/
|
||||
public boolean isSource();
|
||||
/**
|
||||
* Is this block a nexus?
|
||||
*/
|
||||
public boolean isSource();
|
||||
|
||||
/**
|
||||
* How fast does this block charge?
|
||||
*/
|
||||
public int getChargeRate();
|
||||
/**
|
||||
* How fast does this block charge?
|
||||
*/
|
||||
public int getChargeRate();
|
||||
|
||||
/**
|
||||
* Gets the current power type of the block.
|
||||
*/
|
||||
public PowerTypes[] getValidPowerTypes();
|
||||
|
||||
/**
|
||||
* Offset of any particle effects to the origin of the block
|
||||
* @param axis The axis in question. 0=x, 1=y, 2=z
|
||||
*/
|
||||
public float particleOffset(int axis);
|
||||
/**
|
||||
* Gets the current power type of the block.
|
||||
*/
|
||||
public PowerTypes[] getValidPowerTypes();
|
||||
|
||||
/**
|
||||
* Offset of any particle effects to the origin of the block
|
||||
* @param axis The axis in question. 0=x, 1=y, 2=z
|
||||
*/
|
||||
public float particleOffset(int axis);
|
||||
}
|
||||
@@ -1,69 +1,70 @@
|
||||
package am2.api.power;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import am2.api.ArsMagicaApi;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class PowerTypes{
|
||||
public final class PowerTypes {
|
||||
|
||||
public static final PowerTypes NONE = new PowerTypes(0, "None", "\u00A7f");
|
||||
public static final PowerTypes LIGHT = new PowerTypes(1, "Light", "\u00A7b");
|
||||
public static final PowerTypes NEUTRAL = new PowerTypes(2, "Neutral", "\u00A71");
|
||||
public static final PowerTypes DARK = new PowerTypes(4, "Dark", "\u00A74");
|
||||
public static final PowerTypes NONE = new PowerTypes(0, "None", "\u00A7f");
|
||||
public static final PowerTypes LIGHT = new PowerTypes(1, "Light", "\u00A7b");
|
||||
public static final PowerTypes NEUTRAL = new PowerTypes(2, "Neutral", "\u00A71");
|
||||
public static final PowerTypes DARK = new PowerTypes(4, "Dark", "\u00A74");
|
||||
|
||||
private static final ArrayList<PowerTypes> allPowerTypes = new ArrayList<PowerTypes>() {{
|
||||
add(LIGHT);
|
||||
add(NEUTRAL);
|
||||
add(DARK);
|
||||
}};
|
||||
private static final ArrayList<PowerTypes> allPowerTypes = new ArrayList<PowerTypes>() {
|
||||
{
|
||||
add(LIGHT);
|
||||
add(NEUTRAL);
|
||||
add(DARK);
|
||||
}
|
||||
};
|
||||
|
||||
private int _id;
|
||||
private String _name;
|
||||
private String _chatColor;
|
||||
private int _id;
|
||||
private String _name;
|
||||
private String _chatColor;
|
||||
|
||||
private PowerTypes(int ID, String name, String chatColor){
|
||||
if ((ID & -ID) != ID){
|
||||
throw new InvalidParameterException(String.format("ID must be a bitflag that is a power of 2! (You used %d)", ID));
|
||||
}
|
||||
_id = ID;
|
||||
_name = name;
|
||||
_chatColor = chatColor;
|
||||
}
|
||||
private PowerTypes(int ID, String name, String chatColor) {
|
||||
if ((ID & -ID) != ID) {
|
||||
throw new InvalidParameterException(
|
||||
String.format("ID must be a bitflag that is a power of 2! (You used %d)", ID));
|
||||
}
|
||||
_id = ID;
|
||||
_name = name;
|
||||
_chatColor = chatColor;
|
||||
}
|
||||
|
||||
public static void RegisterPowerType(int id, String name, String chatColor){
|
||||
if (getByID(id) == NONE){
|
||||
FMLLog.info("Ars Magica 2 >> Attempted to register power type %s with ID of %d, but that ID is already taken! The type was NOT registered!");
|
||||
}else{
|
||||
allPowerTypes.add(new PowerTypes(id, name, chatColor));
|
||||
FMLLog.info("Ars Magica 2 >> Registered new power type %s with ID %d", name, id);
|
||||
}
|
||||
}
|
||||
public static void RegisterPowerType(int id, String name, String chatColor) {
|
||||
if (getByID(id) == NONE) {
|
||||
FMLLog.info(
|
||||
"Ars Magica 2 >> Attempted to register power type %s with ID of %d, but that ID is already taken! The type was NOT registered!");
|
||||
} else {
|
||||
allPowerTypes.add(new PowerTypes(id, name, chatColor));
|
||||
FMLLog.info("Ars Magica 2 >> Registered new power type %s with ID %d", name, id);
|
||||
}
|
||||
}
|
||||
|
||||
public int ID(){
|
||||
return _id;
|
||||
}
|
||||
public int ID() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return _name;
|
||||
}
|
||||
public String name() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String chatColor(){
|
||||
if (ArsMagicaApi.instance.getColourblindMode()){
|
||||
return "";
|
||||
}
|
||||
return _chatColor;
|
||||
}
|
||||
public String chatColor() {
|
||||
if (ArsMagicaApi.instance.getColourblindMode()) {
|
||||
return "";
|
||||
}
|
||||
return _chatColor;
|
||||
}
|
||||
|
||||
public static PowerTypes[] all(){
|
||||
return allPowerTypes.toArray(new PowerTypes[allPowerTypes.size()]);
|
||||
}
|
||||
public static PowerTypes[] all() {
|
||||
return allPowerTypes.toArray(new PowerTypes[allPowerTypes.size()]);
|
||||
}
|
||||
|
||||
public static PowerTypes getByID(int id){
|
||||
for (PowerTypes type : all())
|
||||
if (type.ID() == id)
|
||||
return type;
|
||||
return NONE;
|
||||
}
|
||||
public static PowerTypes getByID(int id) {
|
||||
for (PowerTypes type : all()) if (type.ID() == id) return type;
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,21 @@ import am2.api.spell.enums.SkillPointTypes;
|
||||
import am2.api.spell.enums.SkillTrees;
|
||||
|
||||
public interface ISkillTreeManager {
|
||||
/**
|
||||
* Registers a spell part into the skill tree (where it can be unlocked).
|
||||
* Pass a null prerequisite for no prerequisite.
|
||||
* Throws an exception if the prerequisite passed in is not a registered entry in the skill tree, or if it is in a different tree.
|
||||
* @param shape The shape to register
|
||||
* @param x The x-coordinate in the skill tree to display the shape IIcon
|
||||
* @param y The y-coordinate in the skill tree to display the shape IIcon
|
||||
* @param tree The skill tree to register the shape into
|
||||
* @param prerequisites The prerequisite skills needed for the shape.
|
||||
*/
|
||||
public void RegisterPart(ISkillTreeEntry part, int x, int y, SkillTrees tree, SkillPointTypes requiredPoint, ISkillTreeEntry ... prerequisites);
|
||||
/**
|
||||
* Registers a spell part into the skill tree (where it can be unlocked).
|
||||
* Pass a null prerequisite for no prerequisite.
|
||||
* Throws an exception if the prerequisite passed in is not a registered entry in the skill tree, or if it is in a different tree.
|
||||
* @param shape The shape to register
|
||||
* @param x The x-coordinate in the skill tree to display the shape IIcon
|
||||
* @param y The y-coordinate in the skill tree to display the shape IIcon
|
||||
* @param tree The skill tree to register the shape into
|
||||
* @param prerequisites The prerequisite skills needed for the shape.
|
||||
*/
|
||||
public void RegisterPart(
|
||||
ISkillTreeEntry part,
|
||||
int x,
|
||||
int y,
|
||||
SkillTrees tree,
|
||||
SkillPointTypes requiredPoint,
|
||||
ISkillTreeEntry... prerequisites);
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package am2.api.spell;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface ISpellIconManager {
|
||||
/**
|
||||
* Returns the IIcon registered to the specified spell name. Returns the missing IIcon if one doesn't exist.
|
||||
*/
|
||||
public IIcon getIcon(String spellName);
|
||||
|
||||
/**
|
||||
* Registers an IIcon to be associated with a spell component
|
||||
* @param spellName The unlocalized name of the spell used when it was registered
|
||||
* @param IIcon The IIcon of the spell
|
||||
*/
|
||||
public void registerIcon(String spellName, IIcon IIcon);
|
||||
/**
|
||||
* Returns the IIcon registered to the specified spell name. Returns the missing IIcon if one doesn't exist.
|
||||
*/
|
||||
public IIcon getIcon(String spellName);
|
||||
|
||||
/**
|
||||
* Registers an IIcon to be associated with a spell component
|
||||
* @param spellName The unlocalized name of the spell used when it was registered
|
||||
* @param IIcon The IIcon of the spell
|
||||
*/
|
||||
public void registerIcon(String spellName, IIcon IIcon);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package am2.api.spell;
|
||||
import am2.api.spell.component.interfaces.ISpellModifier;
|
||||
|
||||
public interface ISpellModifierManager {
|
||||
public int registerSpellModifier(ISpellModifier modifier, String modifierName);
|
||||
public ISpellModifier getSpellModifier(int modifierID);
|
||||
public int registerSpellModifier(ISpellModifier modifier, String modifierName);
|
||||
|
||||
public ISpellModifier getSpellModifier(int modifierID);
|
||||
}
|
||||
@@ -3,25 +3,25 @@ package am2.api.spell;
|
||||
import am2.api.spell.component.interfaces.ISkillTreeEntry;
|
||||
|
||||
public interface ISpellPartManager {
|
||||
/**
|
||||
* Registers the skill tree entry into the skill manager.
|
||||
* @param component The skill tree entry to register
|
||||
* @param name The unlocalized name you want to register it to. Local translations are am2.spell.unlocalized_name, so register this into the language registry for localization.
|
||||
* @return The shifted numeric ID that is used, this should be stored somewhere
|
||||
*/
|
||||
public int registerSkillTreeEntry(ISkillTreeEntry component, String name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID The shifted ID of the skill.
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(int ID);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name The unlocalized name of the skill
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(String name);
|
||||
/**
|
||||
* Registers the skill tree entry into the skill manager.
|
||||
* @param component The skill tree entry to register
|
||||
* @param name The unlocalized name you want to register it to. Local translations are am2.spell.unlocalized_name, so register this into the language registry for localization.
|
||||
* @return The shifted numeric ID that is used, this should be stored somewhere
|
||||
*/
|
||||
public int registerSkillTreeEntry(ISkillTreeEntry component, String name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID The shifted ID of the skill.
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(int ID);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name The unlocalized name of the skill
|
||||
* @return The skill tree entry or null if not found.
|
||||
*/
|
||||
public ISkillTreeEntry getSkill(String name);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package am2.api.spell;
|
||||
import am2.api.spell.component.interfaces.ISpellShape;
|
||||
|
||||
public interface ISpellShapeManager {
|
||||
public int registerSpellShape(ISpellShape shape, String shapeName);
|
||||
public ISpellShape getSpellShape(int shapeID);
|
||||
public int registerSpellShape(ISpellShape shape, String shapeName);
|
||||
|
||||
public ISpellShape getSpellShape(int shapeID);
|
||||
}
|
||||
@@ -10,19 +10,20 @@ import net.minecraft.world.World;
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
public abstract class ItemSpellBase extends Item{
|
||||
public ItemSpellBase() {
|
||||
super();
|
||||
}
|
||||
public abstract class ItemSpellBase extends Item {
|
||||
public ItemSpellBase() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific version of getMovingObjectPosition that takes into account the targeting types that I need
|
||||
* @param caster The caster of the spell
|
||||
* @param world The world the spell is being cast in
|
||||
* @param range The range to raycast
|
||||
* @param targetEntities Stop at collision with entities
|
||||
* @param targetWater Stop at collision with any non-solid block
|
||||
* @return A MovingObjectPosition instance if a collision was found, null otherwise
|
||||
*/
|
||||
public abstract MovingObjectPosition getMovingObjectPosition(EntityLivingBase caster, World world, double range, boolean targetEntities, boolean targetWater);
|
||||
/**
|
||||
* Specific version of getMovingObjectPosition that takes into account the targeting types that I need
|
||||
* @param caster The caster of the spell
|
||||
* @param world The world the spell is being cast in
|
||||
* @param range The range to raycast
|
||||
* @param targetEntities Stop at collision with entities
|
||||
* @param targetWater Stop at collision with any non-solid block
|
||||
* @return A MovingObjectPosition instance if a collision was found, null otherwise
|
||||
*/
|
||||
public abstract MovingObjectPosition getMovingObjectPosition(
|
||||
EntityLivingBase caster, World world, double range, boolean targetEntities, boolean targetWater);
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import am2.api.blocks.MultiblockStructureDefinition;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRitualInteraction <T extends ISkillTreeEntry> {
|
||||
/**
|
||||
* Gets a MultiblockStructureDefinition outlining the ritual blocks needed and where they should be relative to a given location.
|
||||
* This should be instantiated on mod load and cached somewhere, and NOT instantiated upon request.
|
||||
*/
|
||||
public MultiblockStructureDefinition getRitualShape();
|
||||
public interface IRitualInteraction<T extends ISkillTreeEntry> {
|
||||
/**
|
||||
* Gets a MultiblockStructureDefinition outlining the ritual blocks needed and where they should be relative to a given location.
|
||||
* This should be instantiated on mod load and cached somewhere, and NOT instantiated upon request.
|
||||
*/
|
||||
public MultiblockStructureDefinition getRitualShape();
|
||||
|
||||
/**
|
||||
* Gets a list of items that need to be present in {@link #getReagentSearchRadius() getReagentSearchRadius()} for the ritual to match.
|
||||
* Items on the ground as well as items attached to Wizard's Chalk are included.
|
||||
*/
|
||||
public ItemStack[] getReagents();
|
||||
/**
|
||||
* Gets a list of items that need to be present in {@link #getReagentSearchRadius() getReagentSearchRadius()} for the ritual to match.
|
||||
* Items on the ground as well as items attached to Wizard's Chalk are included.
|
||||
*/
|
||||
public ItemStack[] getReagents();
|
||||
|
||||
/**
|
||||
* Gets the radius to search for reagents when checking the ritual.
|
||||
*/
|
||||
public int getReagentSearchRadius();
|
||||
/**
|
||||
* Gets the radius to search for reagents when checking the ritual.
|
||||
*/
|
||||
public int getReagentSearchRadius();
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
public interface ISkillTreeEntry {
|
||||
/**
|
||||
* Gets the ID of the skill. Must be unique among all other skills.
|
||||
* @return The ID of the part.
|
||||
*/
|
||||
public int getID();
|
||||
/**
|
||||
* Gets the ID of the skill. Must be unique among all other skills.
|
||||
* @return The ID of the part.
|
||||
*/
|
||||
public int getID();
|
||||
}
|
||||
@@ -1,72 +1,89 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import am2.api.spell.enums.Affinity;
|
||||
|
||||
public interface ISpellComponent extends ISpellPart{
|
||||
/**
|
||||
* Apply the effect to a single block
|
||||
* @param stack The item stack that contains the effect data
|
||||
* @param world The world the effect is in
|
||||
* @param blockx The x coordinate of the block
|
||||
* @param blocky The y coordinate of the block
|
||||
* @param blockz The z coordinate of the block
|
||||
* @param blockFace The face of the block that was targeted
|
||||
* @param impactX The x coordinate of the impact
|
||||
* @param impactY The y coordinate of the impact
|
||||
* @param impactZ The z coordinate of the impact
|
||||
* @param caster The caster of the spell
|
||||
* @return True if the effect was successfully applied to the block
|
||||
*/
|
||||
public boolean applyEffectBlock(ItemStack stack, World world, int blockx, int blocky, int blockz, int blockFace, double impactX, double impactY, double impactZ, EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Apply the effect to a single entity
|
||||
* @param stack The stack representing the spell
|
||||
* @param world The world the spell was cast in
|
||||
* @param caster The caster of the spell
|
||||
* @param target The current target of the spell
|
||||
* @return True if the effect was applied successfully to the entity
|
||||
*/
|
||||
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target);
|
||||
|
||||
/**
|
||||
* Gets the mana cost of the spell
|
||||
*/
|
||||
public float manaCost(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets the burnout of the spell
|
||||
*/
|
||||
public float burnout(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets any reagents that must be present in the caster's inventory in order
|
||||
* to cast the spell.
|
||||
*/
|
||||
public ItemStack[] reagents(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Spawn visual effects for the component
|
||||
* @param colorModifier The color from the color modifier. -1 if missing.
|
||||
*/
|
||||
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier);
|
||||
|
||||
/**
|
||||
* Gets the affinity of the spell
|
||||
*/
|
||||
public EnumSet<Affinity> getAffinity();
|
||||
|
||||
/**
|
||||
* Gets the amount (before diminishing returns) that this component, when successfully applied,
|
||||
* shifts the caster's affinity
|
||||
* @param affinity The affinity being shifted
|
||||
*/
|
||||
public float getAffinityShift(Affinity affinity);
|
||||
public interface ISpellComponent extends ISpellPart {
|
||||
/**
|
||||
* Apply the effect to a single block
|
||||
* @param stack The item stack that contains the effect data
|
||||
* @param world The world the effect is in
|
||||
* @param blockx The x coordinate of the block
|
||||
* @param blocky The y coordinate of the block
|
||||
* @param blockz The z coordinate of the block
|
||||
* @param blockFace The face of the block that was targeted
|
||||
* @param impactX The x coordinate of the impact
|
||||
* @param impactY The y coordinate of the impact
|
||||
* @param impactZ The z coordinate of the impact
|
||||
* @param caster The caster of the spell
|
||||
* @return True if the effect was successfully applied to the block
|
||||
*/
|
||||
public boolean applyEffectBlock(
|
||||
ItemStack stack,
|
||||
World world,
|
||||
int blockx,
|
||||
int blocky,
|
||||
int blockz,
|
||||
int blockFace,
|
||||
double impactX,
|
||||
double impactY,
|
||||
double impactZ,
|
||||
EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Apply the effect to a single entity
|
||||
* @param stack The stack representing the spell
|
||||
* @param world The world the spell was cast in
|
||||
* @param caster The caster of the spell
|
||||
* @param target The current target of the spell
|
||||
* @return True if the effect was applied successfully to the entity
|
||||
*/
|
||||
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target);
|
||||
|
||||
/**
|
||||
* Gets the mana cost of the spell
|
||||
*/
|
||||
public float manaCost(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets the burnout of the spell
|
||||
*/
|
||||
public float burnout(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Gets any reagents that must be present in the caster's inventory in order
|
||||
* to cast the spell.
|
||||
*/
|
||||
public ItemStack[] reagents(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Spawn visual effects for the component
|
||||
* @param colorModifier The color from the color modifier. -1 if missing.
|
||||
*/
|
||||
public void spawnParticles(
|
||||
World world,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
EntityLivingBase caster,
|
||||
Entity target,
|
||||
Random rand,
|
||||
int colorModifier);
|
||||
|
||||
/**
|
||||
* Gets the affinity of the spell
|
||||
*/
|
||||
public EnumSet<Affinity> getAffinity();
|
||||
|
||||
/**
|
||||
* Gets the amount (before diminishing returns) that this component, when successfully applied,
|
||||
* shifts the caster's affinity
|
||||
* @param affinity The affinity being shifted
|
||||
*/
|
||||
public float getAffinityShift(Affinity affinity);
|
||||
}
|
||||
@@ -1,43 +1,42 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import am2.api.spell.enums.SpellModifiers;
|
||||
|
||||
public interface ISpellModifier extends ISpellPart{
|
||||
/**
|
||||
* Returns a list of the aspects of a spell that this modifier can change.
|
||||
* @return
|
||||
*/
|
||||
public EnumSet<SpellModifiers> getAspectsModified();
|
||||
|
||||
/**
|
||||
* Returns the modified value for the specified type.
|
||||
* @param type The type of value we are modifying
|
||||
* @param caster The caster
|
||||
* @param target The target (can be the same as the caster)
|
||||
* @param world The world in which the spell is being cast.
|
||||
* @param metadata Any metadata written to the spell for this modifier (obtained from getModifierMetadata)
|
||||
* @return A factor to multiply the default value by (or add, depending on the component's programming)
|
||||
*/
|
||||
public float getModifier(SpellModifiers type, EntityLivingBase caster, Entity target, World world, byte[] metadata);
|
||||
|
||||
/**
|
||||
* Gets the amount that adding this modifier to the spell alters the mana cost.
|
||||
* @param spellStack The itemstack comprising the spell (in case you want to base it on other modifiers added)
|
||||
* @param stage The stage in which this modifier has been added (if the modifier is added to multiple stages, this will be called multiple times, once per stage)
|
||||
* @param quantity The quantity of this multiplier in the specified stage.
|
||||
*/
|
||||
public float getManaCostMultiplier(ItemStack spellStack, int stage, int quantity);
|
||||
|
||||
/**
|
||||
* Gets any metadata needed by this modifier for the current spell. Used, for example, in the color modifier to determine what color was specified.
|
||||
* @param stage The stage this modifier is at
|
||||
* @param matchedRecipe The items that were added to the crafting altar which resulted in the matching of the recipe.
|
||||
*/
|
||||
public byte[] getModifierMetadata(int stage, ItemStack[] matchedRecipe);
|
||||
public interface ISpellModifier extends ISpellPart {
|
||||
/**
|
||||
* Returns a list of the aspects of a spell that this modifier can change.
|
||||
* @return
|
||||
*/
|
||||
public EnumSet<SpellModifiers> getAspectsModified();
|
||||
|
||||
/**
|
||||
* Returns the modified value for the specified type.
|
||||
* @param type The type of value we are modifying
|
||||
* @param caster The caster
|
||||
* @param target The target (can be the same as the caster)
|
||||
* @param world The world in which the spell is being cast.
|
||||
* @param metadata Any metadata written to the spell for this modifier (obtained from getModifierMetadata)
|
||||
* @return A factor to multiply the default value by (or add, depending on the component's programming)
|
||||
*/
|
||||
public float getModifier(SpellModifiers type, EntityLivingBase caster, Entity target, World world, byte[] metadata);
|
||||
|
||||
/**
|
||||
* Gets the amount that adding this modifier to the spell alters the mana cost.
|
||||
* @param spellStack The itemstack comprising the spell (in case you want to base it on other modifiers added)
|
||||
* @param stage The stage in which this modifier has been added (if the modifier is added to multiple stages, this will be called multiple times, once per stage)
|
||||
* @param quantity The quantity of this multiplier in the specified stage.
|
||||
*/
|
||||
public float getManaCostMultiplier(ItemStack spellStack, int stage, int quantity);
|
||||
|
||||
/**
|
||||
* Gets any metadata needed by this modifier for the current spell. Used, for example, in the color modifier to determine what color was specified.
|
||||
* @param stage The stage this modifier is at
|
||||
* @param matchedRecipe The items that were added to the crafting altar which resulted in the matching of the recipe.
|
||||
*/
|
||||
public byte[] getModifierMetadata(int stage, ItemStack[] matchedRecipe);
|
||||
}
|
||||
@@ -8,21 +8,21 @@ package am2.api.spell.component.interfaces;
|
||||
*/
|
||||
public interface ISpellPart extends ISkillTreeEntry {
|
||||
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
*</pre>
|
||||
*/
|
||||
public Object[] getRecipeItems();
|
||||
/**
|
||||
* recipe items, in order, that need to be thrown into the crafting altar in order to create the item.
|
||||
* <br/>
|
||||
* Use Items for items, Blocks for blocks, Strings for OreDictionary items, and E:[type flag] followed by an integer for essence amounts.
|
||||
* <br/>
|
||||
* Use itemstacks for items/blocks/oredict when meta is required. By default it is meta 0. Quantity (stack size) is ignored.
|
||||
* <br/>
|
||||
* Integer pairs represent the type (*=any, 1=neutral, 2=light, 4=dark, etc.), and the quantity of essence required. The type can be used as flags,
|
||||
* <br/>
|
||||
* For example:
|
||||
* <pre>
|
||||
* new Object[]{ "E:1|2", 1500 } //require 1500 of neutral or 1500 of light power.
|
||||
* new Object[]{ "E:*", 1500 } //require 1500 of any kind of power
|
||||
* etc.
|
||||
*</pre>
|
||||
*/
|
||||
public Object[] getRecipeItems();
|
||||
}
|
||||
@@ -1,54 +1,65 @@
|
||||
package am2.api.spell.component.interfaces;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import am2.api.spell.ItemSpellBase;
|
||||
import am2.api.spell.enums.Affinity;
|
||||
import am2.api.spell.enums.SpellCastResult;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ISpellShape extends ISpellPart {
|
||||
/**
|
||||
* Creates the target area/entity list and applies the effects to ground/mobs
|
||||
* @param item The spell being cast
|
||||
* @param stack The itemstack representing the spell
|
||||
* @param caster The caster of the spell
|
||||
* @param target The specified target of the spell. If this is not NULL, this is a forced target, and should be included with any other targets of the shape. Otherwise the default spell shape logic should apply.
|
||||
* @param world The world the spell is being cast in
|
||||
* @param x The x-coordinate of the spell's effect
|
||||
* @param y The y-coordinate of the spell's effect
|
||||
* @param z The z-coordinate of the spell's effect
|
||||
* @param side The side the spell is applied on
|
||||
* @param giveXP This is passed along to be given back to the SpellHelper where needed.
|
||||
* @param useCount The number of ticks the spell item has been in use for
|
||||
* @return The result of the spell cast.
|
||||
*/
|
||||
public SpellCastResult beginStackStage(ItemSpellBase item, ItemStack stack, EntityLivingBase caster, EntityLivingBase target, World world, double x, double y, double z, int side, boolean giveXP, int useCount);
|
||||
|
||||
/**
|
||||
* Is this shape a valid shape for a channeled/maintained spell?
|
||||
*/
|
||||
public boolean isChanneled();
|
||||
|
||||
/**
|
||||
* Allows different shapes to vary the mana cost of a spell
|
||||
* @param spellStack the itemstack representing the spell (useful if you want to vary based on added modifiers as well, for example)
|
||||
* @return
|
||||
*/
|
||||
public float manaCostMultiplier(ItemStack spellStack);
|
||||
|
||||
/**
|
||||
* Is the spell a terminus shape? Return true if this component does not continue the spell chain when proccing.
|
||||
*/
|
||||
public boolean isTerminusShape();
|
||||
|
||||
/**
|
||||
* Is the shape a principal shape? Return true if this spell requires another shape to proc (like runes and zones)
|
||||
*/
|
||||
public boolean isPrincipumShape();
|
||||
|
||||
/**
|
||||
* Play the sound for the specified affinity
|
||||
*/
|
||||
public String getSoundForAffinity(Affinity affinity, ItemStack stack, World world);
|
||||
/**
|
||||
* Creates the target area/entity list and applies the effects to ground/mobs
|
||||
* @param item The spell being cast
|
||||
* @param stack The itemstack representing the spell
|
||||
* @param caster The caster of the spell
|
||||
* @param target The specified target of the spell. If this is not NULL, this is a forced target, and should be included with any other targets of the shape. Otherwise the default spell shape logic should apply.
|
||||
* @param world The world the spell is being cast in
|
||||
* @param x The x-coordinate of the spell's effect
|
||||
* @param y The y-coordinate of the spell's effect
|
||||
* @param z The z-coordinate of the spell's effect
|
||||
* @param side The side the spell is applied on
|
||||
* @param giveXP This is passed along to be given back to the SpellHelper where needed.
|
||||
* @param useCount The number of ticks the spell item has been in use for
|
||||
* @return The result of the spell cast.
|
||||
*/
|
||||
public SpellCastResult beginStackStage(
|
||||
ItemSpellBase item,
|
||||
ItemStack stack,
|
||||
EntityLivingBase caster,
|
||||
EntityLivingBase target,
|
||||
World world,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
int side,
|
||||
boolean giveXP,
|
||||
int useCount);
|
||||
|
||||
/**
|
||||
* Is this shape a valid shape for a channeled/maintained spell?
|
||||
*/
|
||||
public boolean isChanneled();
|
||||
|
||||
/**
|
||||
* Allows different shapes to vary the mana cost of a spell
|
||||
* @param spellStack the itemstack representing the spell (useful if you want to vary based on added modifiers as well, for example)
|
||||
* @return
|
||||
*/
|
||||
public float manaCostMultiplier(ItemStack spellStack);
|
||||
|
||||
/**
|
||||
* Is the spell a terminus shape? Return true if this component does not continue the spell chain when proccing.
|
||||
*/
|
||||
public boolean isTerminusShape();
|
||||
|
||||
/**
|
||||
* Is the shape a principal shape? Return true if this spell requires another shape to proc (like runes and zones)
|
||||
*/
|
||||
public boolean isPrincipumShape();
|
||||
|
||||
/**
|
||||
* Play the sound for the specified affinity
|
||||
*/
|
||||
public String getSoundForAffinity(Affinity affinity, ItemStack stack, World world);
|
||||
}
|
||||
@@ -3,191 +3,195 @@ package am2.api.spell.enums;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public enum Affinity {
|
||||
NONE(0,
|
||||
0xFFFFFF,
|
||||
-1, //no direct opposite
|
||||
new int[] {}, //no major opposites
|
||||
new int[] {}, //no minor opposites
|
||||
new int[] {}),
|
||||
NONE(
|
||||
0,
|
||||
0xFFFFFF,
|
||||
-1, // no direct opposite
|
||||
new int[] {}, // no major opposites
|
||||
new int[] {}, // no minor opposites
|
||||
new int[] {}),
|
||||
|
||||
ARCANE(1,
|
||||
0xb935cd,
|
||||
9, //nature is direct opposite
|
||||
new int[] { 9, 4, 2, 7 }, //Major Opposites: life, earth, water, ice
|
||||
new int[] { 5, 10 }, //Minor Opposites: Air, Ender
|
||||
new int[] { 6, 3 }), //Adjacent Affinities: Lightning, Fire
|
||||
ARCANE(
|
||||
1,
|
||||
0xb935cd,
|
||||
9, // nature is direct opposite
|
||||
new int[] {9, 4, 2, 7}, // Major Opposites: life, earth, water, ice
|
||||
new int[] {5, 10}, // Minor Opposites: Air, Ender
|
||||
new int[] {6, 3}), // Adjacent Affinities: Lightning, Fire
|
||||
|
||||
WATER(2,
|
||||
0x0b5cef,
|
||||
3, //fire is direct opposite
|
||||
new int[] { 7, 4, 1, 10 }, //Major Opposites: lightning, earth, arcane, ender
|
||||
new int[] { 5, 7 }, //Minor Opposites: Air, Ice
|
||||
new int[] { 9, 8 }), //Adjacent Affinities: Life, Nature
|
||||
WATER(
|
||||
2,
|
||||
0x0b5cef,
|
||||
3, // fire is direct opposite
|
||||
new int[] {7, 4, 1, 10}, // Major Opposites: lightning, earth, arcane, ender
|
||||
new int[] {5, 7}, // Minor Opposites: Air, Ice
|
||||
new int[] {9, 8}), // Adjacent Affinities: Life, Nature
|
||||
|
||||
FIRE(3,
|
||||
0xef260b,
|
||||
2, //water is direct opposite
|
||||
new int[] { 5, 7, 8, 9 }, //Major Opposites: air, ice, nature, life
|
||||
new int[] { 4, 6 }, //Minor Opposites: Earth, Lightning
|
||||
new int[] { 10, 1 }), //Adjacent Affinities: Ender, Arcane
|
||||
FIRE(
|
||||
3,
|
||||
0xef260b,
|
||||
2, // water is direct opposite
|
||||
new int[] {5, 7, 8, 9}, // Major Opposites: air, ice, nature, life
|
||||
new int[] {4, 6}, // Minor Opposites: Earth, Lightning
|
||||
new int[] {10, 1}), // Adjacent Affinities: Ender, Arcane
|
||||
|
||||
EARTH(4,
|
||||
0x61330b,
|
||||
5, //air is direct opposite
|
||||
new int[] { 2, 1, 9, 6 }, //Major Opposites: water, arcane, life, lightning
|
||||
new int[] { 8, 3 }, //Minor Opposites: Nature, Fire
|
||||
new int[] { 7, 10 }), //Adjacent Affinities: Ice, Ender
|
||||
EARTH(
|
||||
4,
|
||||
0x61330b,
|
||||
5, // air is direct opposite
|
||||
new int[] {2, 1, 9, 6}, // Major Opposites: water, arcane, life, lightning
|
||||
new int[] {8, 3}, // Minor Opposites: Nature, Fire
|
||||
new int[] {7, 10}), // Adjacent Affinities: Ice, Ender
|
||||
|
||||
AIR(5,
|
||||
0x777777,
|
||||
4, //earth is direct opposite
|
||||
new int[] { 8, 3, 7, 10 }, //Major Opposites: nature, fire, ice, ender
|
||||
new int[] { 2, 1 }, //Minor Opposites: Water, Arcane
|
||||
new int[] { 9, 6 }), //Adjacent Affinities: Life, Lightning
|
||||
AIR(
|
||||
5,
|
||||
0x777777,
|
||||
4, // earth is direct opposite
|
||||
new int[] {8, 3, 7, 10}, // Major Opposites: nature, fire, ice, ender
|
||||
new int[] {2, 1}, // Minor Opposites: Water, Arcane
|
||||
new int[] {9, 6}), // Adjacent Affinities: Life, Lightning
|
||||
|
||||
LIGHTNING(6,
|
||||
0xdece19,
|
||||
7, //ice is direct opposite
|
||||
new int[] { 2, 10, 8, 4 }, //Major Opposites: water, ender, nature, earth
|
||||
new int[] { 9, 3 }, //Minor Opposites: Life, Fire
|
||||
new int[] { 5, 1 }), //Adjacent Affinities: Air, Arcane
|
||||
LIGHTNING(
|
||||
6,
|
||||
0xdece19,
|
||||
7, // ice is direct opposite
|
||||
new int[] {2, 10, 8, 4}, // Major Opposites: water, ender, nature, earth
|
||||
new int[] {9, 3}, // Minor Opposites: Life, Fire
|
||||
new int[] {5, 1}), // Adjacent Affinities: Air, Arcane
|
||||
|
||||
ICE(7,
|
||||
0xd3e8fc,
|
||||
6, //lightning is direct opposite
|
||||
new int[] { 9, 3, 5, 1 }, //Major Opposites: life, fire, air, arcane
|
||||
new int[] { 2, 10 }, //Minor Opposites: Water, Ender
|
||||
new int[] { 8, 4 }), //Adjacent Affinities: Nature, Earth
|
||||
ICE(
|
||||
7,
|
||||
0xd3e8fc,
|
||||
6, // lightning is direct opposite
|
||||
new int[] {9, 3, 5, 1}, // Major Opposites: life, fire, air, arcane
|
||||
new int[] {2, 10}, // Minor Opposites: Water, Ender
|
||||
new int[] {8, 4}), // Adjacent Affinities: Nature, Earth
|
||||
|
||||
NATURE(8,
|
||||
0x228718,
|
||||
6, //arcane is direct opposite
|
||||
new int[] { 5, 10, 6, 3 }, //Major Opposites: air, ender, lightning, fire
|
||||
new int[] { 9, 4 }, //Minor Opposites: Life, Earth
|
||||
new int[] { 2, 7 }), //Adjacent Affinities: Water, Ice
|
||||
NATURE(
|
||||
8,
|
||||
0x228718,
|
||||
6, // arcane is direct opposite
|
||||
new int[] {5, 10, 6, 3}, // Major Opposites: air, ender, lightning, fire
|
||||
new int[] {9, 4}, // Minor Opposites: Life, Earth
|
||||
new int[] {2, 7}), // Adjacent Affinities: Water, Ice
|
||||
|
||||
LIFE(9,
|
||||
0x34e122,
|
||||
10, //ender is direct opposite
|
||||
new int[] { 1, 7, 3, 4 }, //Major Opposites: arcane, ice, fire, earth
|
||||
new int[] { 8, 6 }, //Minor Opposites: Nature, Lightning
|
||||
new int[] { 2, 5 }), //Adjacent Affinities: Water, Air
|
||||
LIFE(
|
||||
9,
|
||||
0x34e122,
|
||||
10, // ender is direct opposite
|
||||
new int[] {1, 7, 3, 4}, // Major Opposites: arcane, ice, fire, earth
|
||||
new int[] {8, 6}, // Minor Opposites: Nature, Lightning
|
||||
new int[] {2, 5}), // Adjacent Affinities: Water, Air
|
||||
|
||||
ENDER(10,
|
||||
0x3f043d,
|
||||
9, //life is direct opposite
|
||||
new int[] { 8, 6, 2, 5 }, //Major Opposites: nature, lightning, water, air
|
||||
new int[] { 1, 7 }, //Minor Opposites: Arcane, Ice
|
||||
new int[] { 4, 3 }); //Adjacent Affinities: Earth, Fire
|
||||
ENDER(
|
||||
10,
|
||||
0x3f043d,
|
||||
9, // life is direct opposite
|
||||
new int[] {8, 6, 2, 5}, // Major Opposites: nature, lightning, water, air
|
||||
new int[] {1, 7}, // Minor Opposites: Arcane, Ice
|
||||
new int[] {4, 3}); // Adjacent Affinities: Earth, Fire
|
||||
|
||||
public int ID;
|
||||
private int directOpposingAffinity;
|
||||
private int[] majorOppositions;
|
||||
private int[] minorOppositions;
|
||||
private int[] adjacentAffinities;
|
||||
public Item representItem;
|
||||
public int representMeta;
|
||||
public final int color;
|
||||
|
||||
public int ID;
|
||||
private int directOpposingAffinity;
|
||||
private int[] majorOppositions;
|
||||
private int[] minorOppositions;
|
||||
private int[] adjacentAffinities;
|
||||
public Item representItem;
|
||||
public int representMeta;
|
||||
public final int color;
|
||||
private Affinity(
|
||||
int ID,
|
||||
int color,
|
||||
int directOppositeAffinity,
|
||||
int[] majorOppositions,
|
||||
int[] minorOppositions,
|
||||
int[] adjacentAffinities) {
|
||||
this.ID = ID;
|
||||
this.directOpposingAffinity = directOppositeAffinity;
|
||||
this.majorOppositions = majorOppositions;
|
||||
this.minorOppositions = minorOppositions;
|
||||
this.adjacentAffinities = adjacentAffinities;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
private Affinity(int ID, int color, int directOppositeAffinity, int[] majorOppositions, int[] minorOppositions, int[] adjacentAffinities){
|
||||
this.ID = ID;
|
||||
this.directOpposingAffinity = directOppositeAffinity;
|
||||
this.majorOppositions = majorOppositions;
|
||||
this.minorOppositions = minorOppositions;
|
||||
this.adjacentAffinities = adjacentAffinities;
|
||||
this.color = color;
|
||||
}
|
||||
public Affinity getOpposingAffinity() {
|
||||
if (this.directOpposingAffinity > -1) return Affinity.values()[this.directOpposingAffinity];
|
||||
return Affinity.NONE;
|
||||
}
|
||||
|
||||
public Affinity getOpposingAffinity(){
|
||||
if (this.directOpposingAffinity > -1)
|
||||
return Affinity.values()[this.directOpposingAffinity];
|
||||
return Affinity.NONE;
|
||||
}
|
||||
public Affinity[] getMajorOpposingAffinities() {
|
||||
Affinity[] opposing = new Affinity[this.majorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.majorOppositions) {
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
|
||||
public Affinity[] getMajorOpposingAffinities(){
|
||||
Affinity[] opposing = new Affinity[this.majorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.majorOppositions){
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
public Affinity[] getMinorOpposingAffinities() {
|
||||
Affinity[] opposing = new Affinity[this.minorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.minorOppositions) {
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
|
||||
public Affinity[] getMinorOpposingAffinities(){
|
||||
Affinity[] opposing = new Affinity[this.minorOppositions.length];
|
||||
int count = 0;
|
||||
for (int i : this.minorOppositions){
|
||||
opposing[count++] = Affinity.values()[i];
|
||||
}
|
||||
return opposing;
|
||||
}
|
||||
public Affinity[] getAdjacentAffinities() {
|
||||
Affinity[] adjacent = new Affinity[this.adjacentAffinities.length];
|
||||
int count = 0;
|
||||
for (int i : this.adjacentAffinities) {
|
||||
adjacent[count++] = Affinity.values()[i];
|
||||
}
|
||||
return adjacent;
|
||||
}
|
||||
|
||||
public Affinity[] getAdjacentAffinities(){
|
||||
Affinity[] adjacent = new Affinity[this.adjacentAffinities.length];
|
||||
int count = 0;
|
||||
for (int i : this.adjacentAffinities){
|
||||
adjacent[count++] = Affinity.values()[i];
|
||||
}
|
||||
return adjacent;
|
||||
}
|
||||
public void setRepresentItem(Item representItem, int meta) {
|
||||
if (this.representItem == null) {
|
||||
this.representItem = representItem;
|
||||
this.representMeta = meta;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRepresentItem(Item representItem, int meta){
|
||||
if (this.representItem == null){
|
||||
this.representItem = representItem;
|
||||
this.representMeta = meta;
|
||||
}
|
||||
}
|
||||
public static Affinity getByID(int ID) {
|
||||
for (Affinity affinity : Affinity.values()) {
|
||||
if (affinity.ID == ID) {
|
||||
return affinity;
|
||||
}
|
||||
}
|
||||
return Affinity.NONE;
|
||||
}
|
||||
|
||||
public static Affinity getByID(int ID){
|
||||
for (Affinity affinity : Affinity.values()){
|
||||
if (affinity.ID == ID){
|
||||
return affinity;
|
||||
}
|
||||
}
|
||||
return Affinity.NONE;
|
||||
}
|
||||
public static Affinity[] getOrderedAffinities() {
|
||||
return new Affinity[] {AIR, LIGHTNING, ARCANE, FIRE, ENDER, EARTH, ICE, NATURE, WATER, LIFE};
|
||||
}
|
||||
|
||||
public static Affinity[] getOrderedAffinities(){
|
||||
return new Affinity[]{
|
||||
AIR,
|
||||
LIGHTNING,
|
||||
ARCANE,
|
||||
FIRE,
|
||||
ENDER,
|
||||
EARTH,
|
||||
ICE,
|
||||
NATURE,
|
||||
WATER,
|
||||
LIFE
|
||||
};
|
||||
}
|
||||
|
||||
public int getAffinityMask(){
|
||||
switch (this){
|
||||
case AIR:
|
||||
return 0x1;
|
||||
case ARCANE:
|
||||
return 0x2;
|
||||
case EARTH:
|
||||
return 0x4;
|
||||
case ENDER:
|
||||
return 0x8;
|
||||
case FIRE:
|
||||
return 0x10;
|
||||
case ICE:
|
||||
return 0x20;
|
||||
case LIFE:
|
||||
return 0x40;
|
||||
case LIGHTNING:
|
||||
return 0x80;
|
||||
case NATURE:
|
||||
return 0x100;
|
||||
case WATER:
|
||||
return 0x200;
|
||||
case NONE:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public int getAffinityMask() {
|
||||
switch (this) {
|
||||
case AIR:
|
||||
return 0x1;
|
||||
case ARCANE:
|
||||
return 0x2;
|
||||
case EARTH:
|
||||
return 0x4;
|
||||
case ENDER:
|
||||
return 0x8;
|
||||
case FIRE:
|
||||
return 0x10;
|
||||
case ICE:
|
||||
return 0x20;
|
||||
case LIFE:
|
||||
return 0x40;
|
||||
case LIGHTNING:
|
||||
return 0x80;
|
||||
case NATURE:
|
||||
return 0x100;
|
||||
case WATER:
|
||||
return 0x200;
|
||||
case NONE:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public class BuffPowerLevel {
|
||||
public static final int Low = 0;
|
||||
public static final int Medium = 1;
|
||||
public static final int High = 2;
|
||||
public static final int Low = 0;
|
||||
public static final int Medium = 1;
|
||||
public static final int High = 2;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum ContingencyTypes {
|
||||
NONE,
|
||||
FALL,
|
||||
DAMAGE_TAKEN,
|
||||
ON_FIRE,
|
||||
HEALTH_LOW,
|
||||
DEATH
|
||||
NONE,
|
||||
FALL,
|
||||
DAMAGE_TAKEN,
|
||||
ON_FIRE,
|
||||
HEALTH_LOW,
|
||||
DEATH
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum LearnStates{
|
||||
LEARNED,
|
||||
CAN_LEARN,
|
||||
CANNOT_LEARN,
|
||||
LOCKED,
|
||||
DISABLED
|
||||
};
|
||||
public enum LearnStates {
|
||||
LEARNED,
|
||||
CAN_LEARN,
|
||||
CANNOT_LEARN,
|
||||
LOCKED,
|
||||
DISABLED
|
||||
};
|
||||
@@ -1,8 +1,8 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SkillPointTypes{
|
||||
BLUE,
|
||||
GREEN,
|
||||
RED,
|
||||
SILVER
|
||||
public enum SkillPointTypes {
|
||||
BLUE,
|
||||
GREEN,
|
||||
RED,
|
||||
SILVER
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SkillTrees {
|
||||
None,
|
||||
Offense,
|
||||
Defense,
|
||||
Utility,
|
||||
Talents,
|
||||
Familiar,
|
||||
Affinity
|
||||
None,
|
||||
Offense,
|
||||
Defense,
|
||||
Utility,
|
||||
Talents,
|
||||
Familiar,
|
||||
Affinity
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SpellCastResult {
|
||||
SUCCESS,
|
||||
NOT_ENOUGH_MANA,
|
||||
REAGENTS_MISSING,
|
||||
MALFORMED_SPELL_STACK,
|
||||
EFFECT_FAILED,
|
||||
SUCCESS_REDUCE_MANA,
|
||||
SILENCED
|
||||
SUCCESS,
|
||||
NOT_ENOUGH_MANA,
|
||||
REAGENTS_MISSING,
|
||||
MALFORMED_SPELL_STACK,
|
||||
EFFECT_FAILED,
|
||||
SUCCESS_REDUCE_MANA,
|
||||
SILENCED
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
package am2.api.spell.enums;
|
||||
|
||||
public enum SpellModifiers {
|
||||
SPEED(1.0D),
|
||||
GRAVITY(0),
|
||||
BOUNCE(0),
|
||||
DAMAGE(4.0D),
|
||||
HEALING(1.0D),
|
||||
VELOCITY_ADDED(0.0D),
|
||||
RADIUS(1.0D),
|
||||
DURATION(1.0D),
|
||||
PROCS(1),
|
||||
RANGE(8.0D),
|
||||
TARGET_NONSOLID_BLOCKS(0),
|
||||
PIERCING(2),
|
||||
COLOR(0xFFFFFF),
|
||||
MINING_POWER(1),
|
||||
FORTUNE_LEVEL(1),
|
||||
SILKTOUCH_LEVEL(1),
|
||||
DISMEMBERING_LEVEL(1),
|
||||
BUFF_POWER(1);
|
||||
SPEED(1.0D),
|
||||
GRAVITY(0),
|
||||
BOUNCE(0),
|
||||
DAMAGE(4.0D),
|
||||
HEALING(1.0D),
|
||||
VELOCITY_ADDED(0.0D),
|
||||
RADIUS(1.0D),
|
||||
DURATION(1.0D),
|
||||
PROCS(1),
|
||||
RANGE(8.0D),
|
||||
TARGET_NONSOLID_BLOCKS(0),
|
||||
PIERCING(2),
|
||||
COLOR(0xFFFFFF),
|
||||
MINING_POWER(1),
|
||||
FORTUNE_LEVEL(1),
|
||||
SILKTOUCH_LEVEL(1),
|
||||
DISMEMBERING_LEVEL(1),
|
||||
BUFF_POWER(1);
|
||||
|
||||
public double defaultValue = 0D;
|
||||
public int defaultValueInt = 0;
|
||||
public double defaultValue = 0D;
|
||||
public int defaultValueInt = 0;
|
||||
|
||||
private SpellModifiers(double defaultValue){
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValueInt = (int)defaultValue;
|
||||
}
|
||||
private SpellModifiers(double defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValueInt = (int) defaultValue;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user