Added the framework for a ritual that grants downgrades (instead of the potion method)
This commit is contained in:
parent
43f86abc58
commit
ed8427c04e
|
@ -8,6 +8,7 @@ Version 2.1.0-66
|
||||||
- Added a Repairing Living Armour Upgrade (trained by damaging the chestplate of the Living Armour while you have a full set on - it repairs all of your armour pieces over time)
|
- Added a Repairing Living Armour Upgrade (trained by damaging the chestplate of the Living Armour while you have a full set on - it repairs all of your armour pieces over time)
|
||||||
- Modified the Dwarven Might skill to better change the mining speed when mining.
|
- Modified the Dwarven Might skill to better change the mining speed when mining.
|
||||||
- Added a Dig Slowdown armour downgrade called "Weakened Pick", trained by having weakness on while mining.
|
- Added a Dig Slowdown armour downgrade called "Weakened Pick", trained by having weakness on while mining.
|
||||||
|
- Added the framework for a ritual that grants downgrades (instead of the potion method).
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Version 2.1.0-65
|
Version 2.1.0-65
|
||||||
|
|
|
@ -79,6 +79,8 @@ public class ConfigHandler
|
||||||
public static boolean pumpRitual;
|
public static boolean pumpRitual;
|
||||||
public static boolean altarBuilderRitual;
|
public static boolean altarBuilderRitual;
|
||||||
public static boolean portalRitual;
|
public static boolean portalRitual;
|
||||||
|
public static boolean meteorRitual;
|
||||||
|
public static boolean downgradeRitual;
|
||||||
|
|
||||||
// Imperfect Rituals
|
// Imperfect Rituals
|
||||||
public static boolean imperfectRitualNight;
|
public static boolean imperfectRitualNight;
|
||||||
|
@ -293,6 +295,8 @@ public class ConfigHandler
|
||||||
pumpRitual = config.get(category, "ritualPump", true).getBoolean();
|
pumpRitual = config.get(category, "ritualPump", true).getBoolean();
|
||||||
altarBuilderRitual = config.get(category, "ritualAltarBuilder", true).getBoolean();
|
altarBuilderRitual = config.get(category, "ritualAltarBuilder", true).getBoolean();
|
||||||
portalRitual = config.get(category, "ritualPortal", true).getBoolean();
|
portalRitual = config.get(category, "ritualPortal", true).getBoolean();
|
||||||
|
meteorRitual = config.get(category, "ritualMeteor", true).getBoolean();
|
||||||
|
downgradeRitual = config.get(category, "ritualDowngrade", true).getBoolean();
|
||||||
|
|
||||||
category = "Rituals.Imperfect";
|
category = "Rituals.Imperfect";
|
||||||
imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean();
|
imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean();
|
||||||
|
@ -372,7 +376,8 @@ public class ConfigHandler
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onConfigChanged(ConfigChangedEvent event)
|
public void onConfigChanged(ConfigChangedEvent event)
|
||||||
{
|
{
|
||||||
if (event.getModID().equals(Constants.Mod.MODID)) {
|
if (event.getModID().equals(Constants.Mod.MODID))
|
||||||
|
{
|
||||||
syncConfig();
|
syncConfig();
|
||||||
MeteorConfigHandler.handleMeteors(false);
|
MeteorConfigHandler.handleMeteors(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.livingArmour;
|
package WayofTime.bloodmagic.api.livingArmour;
|
||||||
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -16,6 +17,8 @@ public interface ILivingArmour
|
||||||
{
|
{
|
||||||
Multimap<String, AttributeModifier> getAttributeModifiers();
|
Multimap<String, AttributeModifier> getAttributeModifiers();
|
||||||
|
|
||||||
|
boolean canApplyUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
|
||||||
|
|
||||||
boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade);
|
boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade);
|
||||||
|
|
||||||
boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
|
boolean removeUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
package WayofTime.bloodmagic.api.recipe;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
|
||||||
|
public class LivingArmourDowngradeRecipe
|
||||||
|
{
|
||||||
|
protected LivingArmourUpgrade upgrade = null;
|
||||||
|
protected ItemStack keyStack = null;
|
||||||
|
protected ArrayList<Object> input = new ArrayList<Object>();
|
||||||
|
|
||||||
|
public LivingArmourDowngradeRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe)
|
||||||
|
{
|
||||||
|
this.upgrade = upgrade;
|
||||||
|
this.keyStack = keyStack;
|
||||||
|
for (Object in : recipe)
|
||||||
|
{
|
||||||
|
if (in instanceof ItemStack)
|
||||||
|
{
|
||||||
|
input.add(((ItemStack) in).copy());
|
||||||
|
} else if (in instanceof Item)
|
||||||
|
{
|
||||||
|
input.add(new ItemStack((Item) in));
|
||||||
|
} else if (in instanceof Block)
|
||||||
|
{
|
||||||
|
input.add(new ItemStack((Block) in));
|
||||||
|
} else if (in instanceof String)
|
||||||
|
{
|
||||||
|
input.add(OreDictionary.getOres((String) in));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
String ret = "Invalid living armour downgrade recipe: ";
|
||||||
|
for (Object tmp : recipe)
|
||||||
|
{
|
||||||
|
ret += tmp + ", ";
|
||||||
|
}
|
||||||
|
ret += upgrade.toString();
|
||||||
|
throw new RuntimeException(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the size of the recipe area
|
||||||
|
*/
|
||||||
|
public int getRecipeSize()
|
||||||
|
{
|
||||||
|
return input.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LivingArmourUpgrade getRecipeOutput()
|
||||||
|
{
|
||||||
|
return upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to check if a recipe matches current crafting inventory. World and
|
||||||
|
* BlockPos are for future-proofing
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public boolean matches(ItemStack key, List<ItemStack> checkedList, World world, BlockPos pos)
|
||||||
|
{
|
||||||
|
if (!OreDictionary.itemMatches(keyStack, key, false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Object> required = new ArrayList<Object>(input);
|
||||||
|
|
||||||
|
for (int x = 0; x < checkedList.size(); x++)
|
||||||
|
{
|
||||||
|
ItemStack slot = checkedList.get(x);
|
||||||
|
|
||||||
|
if (slot != null)
|
||||||
|
{
|
||||||
|
boolean inRecipe = false;
|
||||||
|
Iterator<Object> req = required.iterator();
|
||||||
|
|
||||||
|
while (req.hasNext())
|
||||||
|
{
|
||||||
|
boolean match = false;
|
||||||
|
|
||||||
|
Object next = req.next();
|
||||||
|
|
||||||
|
if (next instanceof ItemStack)
|
||||||
|
{
|
||||||
|
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
|
||||||
|
} else if (next instanceof List)
|
||||||
|
{
|
||||||
|
Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator();
|
||||||
|
while (itr.hasNext() && !match)
|
||||||
|
{
|
||||||
|
match = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match)
|
||||||
|
{
|
||||||
|
inRecipe = true;
|
||||||
|
required.remove(next);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inRecipe)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return required.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the input for this recipe, any mod accessing this value should
|
||||||
|
* never manipulate the values in this array as it will effect the recipe
|
||||||
|
* itself.
|
||||||
|
*
|
||||||
|
* @return The recipes input vales.
|
||||||
|
*/
|
||||||
|
public ArrayList<Object> getInput()
|
||||||
|
{
|
||||||
|
return this.input;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package WayofTime.bloodmagic.api.registry;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
|
||||||
|
|
||||||
|
public class LivingArmourDowngradeRecipeRegistry
|
||||||
|
{
|
||||||
|
private static List<LivingArmourDowngradeRecipe> recipeList = new ArrayList<LivingArmourDowngradeRecipe>();
|
||||||
|
private static Map<ItemStack, Map<Integer, List<ITextComponent>>> dialogueMap = new HashMap<ItemStack, Map<Integer, List<ITextComponent>>>();
|
||||||
|
|
||||||
|
public static void registerRecipe(LivingArmourDowngradeRecipe recipe)
|
||||||
|
{
|
||||||
|
recipeList.add(recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerDialog(ItemStack keyStack, Map<Integer, List<ITextComponent>> map)
|
||||||
|
{
|
||||||
|
dialogueMap.put(keyStack, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ITextComponent> getDialogForProcessTick(ItemStack keyStack, int tick)
|
||||||
|
{
|
||||||
|
for (Entry<ItemStack, Map<Integer, List<ITextComponent>>> entry : dialogueMap.entrySet())
|
||||||
|
{
|
||||||
|
ItemStack key = entry.getKey();
|
||||||
|
if (OreDictionary.itemMatches(key, keyStack, false))
|
||||||
|
{
|
||||||
|
Map<Integer, List<ITextComponent>> map = entry.getValue();
|
||||||
|
if (map.containsKey(tick))
|
||||||
|
{
|
||||||
|
return map.get(tick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe)
|
||||||
|
{
|
||||||
|
registerRecipe(new LivingArmourDowngradeRecipe(upgrade, keyStack, recipe));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LivingArmourDowngradeRecipe getMatchingRecipe(ItemStack keyStack, List<ItemStack> itemList, World world, BlockPos pos)
|
||||||
|
{
|
||||||
|
for (LivingArmourDowngradeRecipe recipe : recipeList)
|
||||||
|
{
|
||||||
|
if (recipe.matches(keyStack, itemList, world, pos))
|
||||||
|
{
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<LivingArmourDowngradeRecipe> getRecipeList()
|
||||||
|
{
|
||||||
|
return new ArrayList<LivingArmourDowngradeRecipe>(recipeList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -109,7 +109,7 @@ public class LivingArmour implements ILivingArmour
|
||||||
if (nextLevel > currentLevel)
|
if (nextLevel > currentLevel)
|
||||||
{
|
{
|
||||||
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
|
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
|
||||||
if (Math.abs(upgradePointDifference) >= 0 && totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
|
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
|
||||||
{
|
{
|
||||||
upgradeMap.put(key, upgrade);
|
upgradeMap.put(key, upgrade);
|
||||||
totalUpgradePoints += upgradePointDifference;
|
totalUpgradePoints += upgradePointDifference;
|
||||||
|
@ -142,6 +142,36 @@ public class LivingArmour implements ILivingArmour
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canApplyUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||||
|
{
|
||||||
|
String key = upgrade.getUniqueIdentifier();
|
||||||
|
if (upgradeMap.containsKey(key))
|
||||||
|
{
|
||||||
|
//Check if this is a higher level than the previous upgrade
|
||||||
|
int nextLevel = upgrade.getUpgradeLevel();
|
||||||
|
int currentLevel = upgradeMap.get(key).getUpgradeLevel();
|
||||||
|
|
||||||
|
if (nextLevel > currentLevel)
|
||||||
|
{
|
||||||
|
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
|
||||||
|
if (totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
int upgradePoints = upgrade.getCostOfUpgrade();
|
||||||
|
if (totalUpgradePoints + upgradePoints <= maxUpgradePoints)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package WayofTime.bloodmagic.livingArmour.downgrade;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
|
||||||
|
public class LivingArmourUpgradeStormTrooper extends LivingArmourUpgrade
|
||||||
|
{
|
||||||
|
public static final int[] costs = new int[] { -150 };
|
||||||
|
public static final float[] inaccuracy = new float[] { 0.04f, 0.08f, 0.12f, 0.16f, 0.2f };
|
||||||
|
|
||||||
|
public LivingArmourUpgradeStormTrooper(int level)
|
||||||
|
{
|
||||||
|
super(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getArrowJiggle(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inaccuracy[this.level];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUniqueIdentifier()
|
||||||
|
{
|
||||||
|
return Constants.Mod.MODID + ".upgrade.stormTrooper";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxTier()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCostOfUpgrade()
|
||||||
|
{
|
||||||
|
return costs[this.level];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName()
|
||||||
|
{
|
||||||
|
return tooltipBase + "stormTrooper";
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeMeleeDecre
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlippery;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlippery;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowness;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowness;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerCriticalStrike;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerCriticalStrike;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerDigging;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerDigging;
|
||||||
|
@ -121,5 +122,6 @@ public class ModArmourTrackers
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeMeleeDecrease(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeMeleeDecrease(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDisoriented(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDisoriented(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigSlowdown(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigSlowdown(0));
|
||||||
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeStormTrooper(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
@ -10,12 +13,17 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import net.minecraftforge.oredict.RecipeSorter;
|
import net.minecraftforge.oredict.RecipeSorter;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor;
|
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor;
|
||||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
|
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
|
||||||
|
@ -31,6 +39,7 @@ import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
|
||||||
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
||||||
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
||||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.registry.LivingArmourDowngradeRecipeRegistry;
|
||||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||||
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
||||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||||
|
@ -47,6 +56,7 @@ import WayofTime.bloodmagic.item.ItemDemonCrystal;
|
||||||
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
|
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
|
||||||
import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade;
|
import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade;
|
||||||
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
|
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper;
|
||||||
import WayofTime.bloodmagic.potion.BMPotionUtils;
|
import WayofTime.bloodmagic.potion.BMPotionUtils;
|
||||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableDyeableRecipe;
|
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableDyeableRecipe;
|
||||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionRecipe;
|
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionRecipe;
|
||||||
|
@ -72,6 +82,7 @@ public class ModRecipes
|
||||||
addAlchemyTableRecipes();
|
addAlchemyTableRecipes();
|
||||||
addOreDoublingAlchemyRecipes();
|
addOreDoublingAlchemyRecipes();
|
||||||
addPotionRecipes();
|
addPotionRecipes();
|
||||||
|
addLivingArmourDowngradeRecipes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initOreDict()
|
public static void initOreDict()
|
||||||
|
@ -465,4 +476,32 @@ public class ModRecipes
|
||||||
powerList.add(mundanePowerStack);
|
powerList.add(mundanePowerStack);
|
||||||
AlchemyTableRecipeRegistry.registerRecipe(BMPotionUtils.getPowerAugmentRecipe(lpDrained, 100, tier, powerList, baseEffect, 1));
|
AlchemyTableRecipeRegistry.registerRecipe(BMPotionUtils.getPowerAugmentRecipe(lpDrained, 100, tier, powerList, baseEffect, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addLivingArmourDowngradeRecipes()
|
||||||
|
{
|
||||||
|
String messageBase = "ritual.BloodMagic.downgradeRitual.dialogue.";
|
||||||
|
|
||||||
|
ItemStack bowStack = new ItemStack(Items.BOW);
|
||||||
|
|
||||||
|
Map<ItemStack, Pair<String, int[]>> dialogueMap = new HashMap<ItemStack, Pair<String, int[]>>();
|
||||||
|
dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 200, 400, 600 }));
|
||||||
|
|
||||||
|
for (Entry<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet())
|
||||||
|
{
|
||||||
|
ItemStack keyStack = entry.getKey();
|
||||||
|
String str = entry.getValue().getKey();
|
||||||
|
Map<Integer, List<ITextComponent>> textMap = new HashMap<Integer, List<ITextComponent>>();
|
||||||
|
for (int tick : entry.getValue().getValue())
|
||||||
|
{
|
||||||
|
List<ITextComponent> textList = new ArrayList<ITextComponent>();
|
||||||
|
textList.add(new TextComponentTranslation(messageBase + str + "." + tick));
|
||||||
|
textMap.put(tick, textList);
|
||||||
|
}
|
||||||
|
|
||||||
|
LivingArmourDowngradeRecipeRegistry.registerDialog(keyStack, textMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(0), bowStack, "gemDiamond");
|
||||||
|
// LivingArmourDowngradeRecipeRegistry.registerDialog(bowStack, bowMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import WayofTime.bloodmagic.ritual.RitualHarvest;
|
||||||
import WayofTime.bloodmagic.ritual.RitualInterdiction;
|
import WayofTime.bloodmagic.ritual.RitualInterdiction;
|
||||||
import WayofTime.bloodmagic.ritual.RitualJumping;
|
import WayofTime.bloodmagic.ritual.RitualJumping;
|
||||||
import WayofTime.bloodmagic.ritual.RitualLava;
|
import WayofTime.bloodmagic.ritual.RitualLava;
|
||||||
|
import WayofTime.bloodmagic.ritual.RitualLivingArmourDowngrade;
|
||||||
import WayofTime.bloodmagic.ritual.RitualMagnetic;
|
import WayofTime.bloodmagic.ritual.RitualMagnetic;
|
||||||
import WayofTime.bloodmagic.ritual.RitualMeteor;
|
import WayofTime.bloodmagic.ritual.RitualMeteor;
|
||||||
import WayofTime.bloodmagic.ritual.RitualPlacer;
|
import WayofTime.bloodmagic.ritual.RitualPlacer;
|
||||||
|
@ -79,6 +80,8 @@ public class ModRituals
|
||||||
|
|
||||||
public static Ritual meteorRitual;
|
public static Ritual meteorRitual;
|
||||||
|
|
||||||
|
public static Ritual downgradeRitual;
|
||||||
|
|
||||||
public static ImperfectRitual imperfectNight;
|
public static ImperfectRitual imperfectNight;
|
||||||
public static ImperfectRitual imperfectRain;
|
public static ImperfectRitual imperfectRain;
|
||||||
public static ImperfectRitual imperfectResistance;
|
public static ImperfectRitual imperfectResistance;
|
||||||
|
@ -145,7 +148,10 @@ public class ModRituals
|
||||||
portalRitual = new RitualPortal();
|
portalRitual = new RitualPortal();
|
||||||
RitualRegistry.registerRitual(portalRitual, ConfigHandler.portalRitual);
|
RitualRegistry.registerRitual(portalRitual, ConfigHandler.portalRitual);
|
||||||
meteorRitual = new RitualMeteor();
|
meteorRitual = new RitualMeteor();
|
||||||
RitualRegistry.registerRitual(meteorRitual, true);
|
RitualRegistry.registerRitual(meteorRitual, ConfigHandler.meteorRitual);
|
||||||
|
|
||||||
|
downgradeRitual = new RitualLivingArmourDowngrade();
|
||||||
|
RitualRegistry.registerRitual(downgradeRitual, ConfigHandler.downgradeRitual);
|
||||||
|
|
||||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 250, 0.5);
|
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 250, 0.5);
|
||||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 25, 0.05);
|
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 25, 0.05);
|
||||||
|
|
|
@ -0,0 +1,253 @@
|
||||||
|
package WayofTime.bloodmagic.ritual;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||||
|
import net.minecraft.entity.item.EntityItemFrame;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
|
||||||
|
import WayofTime.bloodmagic.api.registry.LivingArmourDowngradeRecipeRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||||
|
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||||
|
import WayofTime.bloodmagic.util.ChatUtil;
|
||||||
|
import WayofTime.bloodmagic.util.Utils;
|
||||||
|
|
||||||
|
public class RitualLivingArmourDowngrade extends Ritual
|
||||||
|
{
|
||||||
|
public static final String DOWNGRADE_RANGE = "containmentRange";
|
||||||
|
private int internalTimer = 0;
|
||||||
|
|
||||||
|
public RitualLivingArmourDowngrade()
|
||||||
|
{
|
||||||
|
super("ritualDowngrade", 0, 10000, "ritual." + Constants.Mod.MODID + ".downgradeRitual");
|
||||||
|
addBlockRange(DOWNGRADE_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 0, -3), 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||||
|
{
|
||||||
|
World world = masterRitualStone.getWorldObj();
|
||||||
|
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||||
|
int currentEssence = network.getCurrentEssence();
|
||||||
|
|
||||||
|
if (currentEssence < getRefreshCost())
|
||||||
|
{
|
||||||
|
network.causeNausea();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||||
|
|
||||||
|
AreaDescriptor downgradeRange = getBlockRange(DOWNGRADE_RANGE);
|
||||||
|
|
||||||
|
boolean isActivatorPresent = false;
|
||||||
|
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, downgradeRange.getAABB(masterRitualStone.getBlockPos())))
|
||||||
|
{
|
||||||
|
if (player.getUniqueID().toString().equals(masterRitualStone.getOwner()))
|
||||||
|
{
|
||||||
|
isActivatorPresent = true;
|
||||||
|
ItemStack keyStack = getStackFromItemFrame(world, masterPos, masterRitualStone.getDirection());
|
||||||
|
if (keyStack == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ITextComponent> textList = LivingArmourDowngradeRecipeRegistry.getDialogForProcessTick(keyStack, internalTimer);
|
||||||
|
if (textList != null)
|
||||||
|
{
|
||||||
|
ChatUtil.sendChat(player, textList.toArray(new ITextComponent[textList.size()]));
|
||||||
|
}
|
||||||
|
|
||||||
|
internalTimer++;
|
||||||
|
|
||||||
|
if (player.isSneaking())
|
||||||
|
{
|
||||||
|
//TODO: Check if you are kneeling on top of it.
|
||||||
|
|
||||||
|
BlockPos chestPos = masterPos.offset(masterRitualStone.getDirection(), 2).offset(EnumFacing.UP);
|
||||||
|
TileEntity tile = world.getTileEntity(chestPos);
|
||||||
|
if (tile == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IItemHandler inv = Utils.getInventory(tile, null);
|
||||||
|
if (inv != null)
|
||||||
|
{
|
||||||
|
List<ItemStack> recipeList = new ArrayList<ItemStack>();
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++)
|
||||||
|
{
|
||||||
|
ItemStack invStack = inv.getStackInSlot(i);
|
||||||
|
if (invStack != null)
|
||||||
|
{
|
||||||
|
recipeList.add(invStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LivingArmourDowngradeRecipe recipe = LivingArmourDowngradeRecipeRegistry.getMatchingRecipe(keyStack, recipeList, world, masterPos);
|
||||||
|
if (recipe != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
LivingArmourUpgrade upgrade = recipe.getRecipeOutput();
|
||||||
|
if (LivingArmour.hasFullSet(player))
|
||||||
|
{
|
||||||
|
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||||
|
if (armour != null)
|
||||||
|
{
|
||||||
|
if (armour.canApplyUpgrade(player, upgrade))
|
||||||
|
{
|
||||||
|
if (armour.upgradeArmour(player, upgrade))
|
||||||
|
{
|
||||||
|
ItemLivingArmour.setLivingArmour(chestStack, armour);
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++)
|
||||||
|
{
|
||||||
|
ItemStack invStack = inv.getStackInSlot(i);
|
||||||
|
if (invStack != null)
|
||||||
|
{
|
||||||
|
inv.extractItem(i, invStack.stackSize, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityLightningBolt lightning = new EntityLightningBolt(world, chestPos.getX(), chestPos.getY(), chestPos.getZ(), true);
|
||||||
|
world.spawnEntityInWorld(lightning);
|
||||||
|
|
||||||
|
masterRitualStone.setActive(false);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//TODO: You are not able to receive my blessing...
|
||||||
|
//TODO: Need to add a timer that will stop it from working.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isActivatorPresent)
|
||||||
|
{
|
||||||
|
internalTimer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
super.readFromNBT(tag);
|
||||||
|
|
||||||
|
this.internalTimer = tag.getInteger("internalTimer");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
super.writeToNBT(tag);
|
||||||
|
|
||||||
|
tag.setInteger("internalTimer", internalTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStackFromItemFrame(World world, BlockPos masterPos, EnumFacing direction)
|
||||||
|
{
|
||||||
|
BlockPos offsetPos = new BlockPos(0, 3, 0);
|
||||||
|
offsetPos = offsetPos.offset(direction, 2);
|
||||||
|
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(masterPos.add(offsetPos));
|
||||||
|
List<EntityItemFrame> frames = world.getEntitiesWithinAABB(EntityItemFrame.class, bb);
|
||||||
|
for (EntityItemFrame frame : frames)
|
||||||
|
{
|
||||||
|
if (frame.getDisplayedItem() != null)
|
||||||
|
{
|
||||||
|
return frame.getDisplayedItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRefreshTime()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRefreshCost()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<RitualComponent> getComponents()
|
||||||
|
{
|
||||||
|
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||||
|
|
||||||
|
this.addRune(components, 0, 0, -1, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, 0, 0, -2, EnumRuneType.DUSK);
|
||||||
|
this.addRune(components, 0, 1, -3, EnumRuneType.DUSK);
|
||||||
|
this.addRune(components, 0, 2, -3, EnumRuneType.BLANK);
|
||||||
|
this.addRune(components, 0, 3, -3, EnumRuneType.BLANK);
|
||||||
|
this.addRune(components, 0, 1, -4, EnumRuneType.FIRE);
|
||||||
|
|
||||||
|
for (int i = 1; i <= 3; i++)
|
||||||
|
this.addRune(components, 0, 0, i, EnumRuneType.AIR);
|
||||||
|
|
||||||
|
for (int sgn = -1; sgn <= 1; sgn += 2)
|
||||||
|
{
|
||||||
|
this.addRune(components, sgn, 0, 4, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 2, 0, 2, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 3, 0, 2, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 3, 0, 3, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 1, 0, 0, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 0, 1, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 2, 0, -1, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 2, 0, -2, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 3, 0, -2, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 3, 0, -3, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 3, 0, -4, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 1, 1, -1, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 1, 1, -2, EnumRuneType.AIR);
|
||||||
|
this.addRune(components, sgn * 1, 1, -4, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 2, 1, -4, EnumRuneType.FIRE);
|
||||||
|
this.addRune(components, sgn * 1, 0, -3, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 0, -4, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 0, -5, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 1, -5, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 2, -5, EnumRuneType.EARTH);
|
||||||
|
this.addRune(components, sgn * 1, 3, -5, EnumRuneType.EARTH);
|
||||||
|
|
||||||
|
this.addRune(components, sgn * 1, 3, -4, EnumRuneType.EARTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
return components;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ritual getNewCopy()
|
||||||
|
{
|
||||||
|
return new RitualLivingArmourDowngrade();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.projectile.EntityArrow;
|
import net.minecraft.entity.projectile.EntityArrow;
|
||||||
|
import net.minecraft.entity.projectile.EntityThrowable;
|
||||||
import net.minecraft.init.Enchantments;
|
import net.minecraft.init.Enchantments;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
@ -11,6 +13,7 @@ import net.minecraft.item.ItemArrow;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
|
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||||
|
@ -27,6 +30,7 @@ import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
||||||
|
@ -65,6 +69,44 @@ public class LivingArmourHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies: Storm Trooper
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityJoinedWorld(EntityJoinWorldEvent event)
|
||||||
|
{
|
||||||
|
Entity owner = null;
|
||||||
|
if (event.getEntity() instanceof EntityArrow)
|
||||||
|
{
|
||||||
|
owner = ((EntityArrow) event.getEntity()).shootingEntity;
|
||||||
|
} else if (event.getEntity() instanceof EntityThrowable)
|
||||||
|
{
|
||||||
|
owner = ((EntityThrowable) event.getEntity()).getThrower();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
Entity projectile = event.getEntity();
|
||||||
|
EntityPlayer player = (EntityPlayer) owner;
|
||||||
|
if (LivingArmour.hasFullSet(player))
|
||||||
|
{
|
||||||
|
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||||
|
if (armour != null)
|
||||||
|
{
|
||||||
|
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.stormTrooper", chestStack);
|
||||||
|
|
||||||
|
if (upgrade instanceof LivingArmourUpgradeStormTrooper)
|
||||||
|
{
|
||||||
|
float velocityModifier = (float) (((LivingArmourUpgradeStormTrooper) upgrade).getArrowJiggle(player) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ));
|
||||||
|
|
||||||
|
projectile.motionX += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
|
||||||
|
projectile.motionY += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
|
||||||
|
projectile.motionZ += 2 * (event.getWorld().rand.nextDouble() - 0.5) * velocityModifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onFinishedItem(LivingEntityUseItemEvent.Finish event)
|
public void onFinishedItem(LivingEntityUseItemEvent.Finish event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -594,7 +594,7 @@ ritual.BloodMagic.fellingRitual=Crash of the Timberman
|
||||||
ritual.BloodMagic.pumpRitual=Hymn of Siphoning
|
ritual.BloodMagic.pumpRitual=Hymn of Siphoning
|
||||||
ritual.BloodMagic.altarBuilderRitual=The Assembly of the High Altar
|
ritual.BloodMagic.altarBuilderRitual=The Assembly of the High Altar
|
||||||
ritual.BloodMagic.portalRitual=The Gate of the Fold
|
ritual.BloodMagic.portalRitual=The Gate of the Fold
|
||||||
|
ritual.BloodMagic.downgradeRitual=Downgrade Ritual
|
||||||
|
|
||||||
ritual.BloodMagic.waterRitual.info=Generates a source of water from the master ritual stone.
|
ritual.BloodMagic.waterRitual.info=Generates a source of water from the master ritual stone.
|
||||||
ritual.BloodMagic.lavaRitual.info=Generates a source of lava from the master ritual stone.
|
ritual.BloodMagic.lavaRitual.info=Generates a source of lava from the master ritual stone.
|
||||||
|
@ -668,6 +668,11 @@ ritual.BloodMagic.fellingRitual.fellingRange.info=(Cutting) The range that the r
|
||||||
ritual.BloodMagic.fellingRitual.chest.info=(Chest) The location of the inventory that the ritual will place the results into.
|
ritual.BloodMagic.fellingRitual.chest.info=(Chest) The location of the inventory that the ritual will place the results into.
|
||||||
ritual.BloodMagic.pumpRitual.pumpRange.info=(Pump) The region that the ritual will look for fluids to grab from the world.
|
ritual.BloodMagic.pumpRitual.pumpRange.info=(Pump) The region that the ritual will look for fluids to grab from the world.
|
||||||
|
|
||||||
|
ritual.BloodMagic.downgradeRitual.dialogue.bow.1=So, Mortal, you wish to gain more power...
|
||||||
|
ritual.BloodMagic.downgradeRitual.dialogue.bow.200=By kneeling at this altar, you may gain further strength, however you will have to give up something as recompense...
|
||||||
|
ritual.BloodMagic.downgradeRitual.dialogue.bow.400=All it takes is a little sacrifice. By forfeighting your aim with a bow, you may attain further heights in other aspects.
|
||||||
|
ritual.BloodMagic.downgradeRitual.dialogue.bow.600=What will you choose...
|
||||||
|
|
||||||
# Chat
|
# Chat
|
||||||
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
|
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
|
||||||
chat.BloodMagic.altarMaker.building=Building a Tier %d Altar
|
chat.BloodMagic.altarMaker.building=Building a Tier %d Altar
|
||||||
|
|
Loading…
Reference in a new issue