Implemented most of the framework required for training specific Living Armour Upgrades.
This commit is contained in:
parent
01d4bdffa2
commit
64efaf854b
|
@ -195,7 +195,8 @@ public class Constants
|
||||||
SIGIL_WHIRLWIND("ItemSigilWhirlwind"),
|
SIGIL_WHIRLWIND("ItemSigilWhirlwind"),
|
||||||
SLATE("ItemSlate"),
|
SLATE("ItemSlate"),
|
||||||
TELEPOSITION_FOCUS("ItemTelepositionFocus"),
|
TELEPOSITION_FOCUS("ItemTelepositionFocus"),
|
||||||
UPGRADE_TOME("ItemUpgradeTome");
|
UPGRADE_TOME("ItemUpgradeTome"),
|
||||||
|
UPGRADE_TRAINER("ItemUpgradeTrainer");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final String regName;
|
private final String regName;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface is used for items intended to train specific upgrades while
|
||||||
|
* held in the player's inventory.
|
||||||
|
*/
|
||||||
|
public interface IUpgradeTrainer
|
||||||
|
{
|
||||||
|
public List<String> getTrainedUpgrades(ItemStack stack);
|
||||||
|
|
||||||
|
public boolean setTrainedUpgrades(ItemStack stack, List<String> keys);
|
||||||
|
}
|
|
@ -53,4 +53,6 @@ public abstract class StatTracker
|
||||||
{
|
{
|
||||||
this.isDirty = false;
|
this.isDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract boolean providesUpgrade(String key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,4 +88,10 @@ public class StatTrackerThaumRunicShielding extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.thaumRunicShielding");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ItemUpgradeTome extends Item
|
||||||
{
|
{
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
LivingArmourUpgrade upgrade = this.getUpgrade(stack);
|
LivingArmourUpgrade upgrade = ItemUpgradeTome.getUpgrade(stack);
|
||||||
if (upgrade == null)
|
if (upgrade == null)
|
||||||
{
|
{
|
||||||
return stack;
|
return stack;
|
||||||
|
@ -83,7 +83,7 @@ public class ItemUpgradeTome extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LivingArmourUpgrade getUpgrade(ItemStack stack)
|
public static LivingArmourUpgrade getUpgrade(ItemStack stack)
|
||||||
{
|
{
|
||||||
String key = getKey(stack);
|
String key = getKey(stack);
|
||||||
int level = getLevel(stack);
|
int level = getLevel(stack);
|
||||||
|
@ -91,7 +91,7 @@ public class ItemUpgradeTome extends Item
|
||||||
return LivingArmourHandler.generateUpgradeFromKey(key, level);
|
return LivingArmourHandler.generateUpgradeFromKey(key, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(ItemStack stack, String key)
|
public static void setKey(ItemStack stack, String key)
|
||||||
{
|
{
|
||||||
NBTHelper.checkNBT(stack);
|
NBTHelper.checkNBT(stack);
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
@ -99,7 +99,7 @@ public class ItemUpgradeTome extends Item
|
||||||
tag.setString("key", key);
|
tag.setString("key", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey(ItemStack stack)
|
public static String getKey(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTHelper.checkNBT(stack);
|
NBTHelper.checkNBT(stack);
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
@ -107,7 +107,7 @@ public class ItemUpgradeTome extends Item
|
||||||
return tag.getString("key");
|
return tag.getString("key");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLevel(ItemStack stack, int level)
|
public static void setLevel(ItemStack stack, int level)
|
||||||
{
|
{
|
||||||
NBTHelper.checkNBT(stack);
|
NBTHelper.checkNBT(stack);
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
@ -115,7 +115,7 @@ public class ItemUpgradeTome extends Item
|
||||||
tag.setInteger("level", level);
|
tag.setInteger("level", level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLevel(ItemStack stack)
|
public static int getLevel(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTHelper.checkNBT(stack);
|
NBTHelper.checkNBT(stack);
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
@ -128,7 +128,7 @@ public class ItemUpgradeTome extends Item
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
{
|
{
|
||||||
// tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour"))));
|
// tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour"))));
|
||||||
LivingArmourUpgrade upgrade = this.getUpgrade(stack);
|
LivingArmourUpgrade upgrade = ItemUpgradeTome.getUpgrade(stack);
|
||||||
if (upgrade != null)
|
if (upgrade != null)
|
||||||
{
|
{
|
||||||
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), upgrade.getUpgradeLevel() + 1));
|
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), upgrade.getUpgradeLevel() + 1));
|
||||||
|
|
110
src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java
Normal file
110
src/main/java/WayofTime/bloodmagic/item/ItemUpgradeTrainer.java
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
package WayofTime.bloodmagic.item;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
|
public class ItemUpgradeTrainer extends Item implements IUpgradeTrainer
|
||||||
|
{
|
||||||
|
public ItemUpgradeTrainer()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
setCreativeTab(BloodMagic.tabUpgradeTome);
|
||||||
|
setUnlocalizedName(Constants.Mod.MODID + ".upgradeTrainer");
|
||||||
|
setRegistryName(Constants.BloodMagicItem.UPGRADE_TRAINER.getRegName());
|
||||||
|
setHasSubtypes(true);
|
||||||
|
setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||||||
|
{
|
||||||
|
list.add(new ItemStack(this));
|
||||||
|
for (Entry<String, Integer> entry : LivingArmourHandler.upgradeMaxLevelMap.entrySet())
|
||||||
|
{
|
||||||
|
String key = entry.getKey();
|
||||||
|
ItemStack stack = new ItemStack(this);
|
||||||
|
setKey(stack, key);
|
||||||
|
list.add(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LivingArmourUpgrade getUpgrade(ItemStack stack)
|
||||||
|
{
|
||||||
|
String key = getKey(stack);
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
|
return LivingArmourHandler.generateUpgradeFromKey(key, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setKey(ItemStack stack, String key)
|
||||||
|
{
|
||||||
|
NBTHelper.checkNBT(stack);
|
||||||
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
|
||||||
|
tag.setString("key", key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getKey(ItemStack stack)
|
||||||
|
{
|
||||||
|
NBTHelper.checkNBT(stack);
|
||||||
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
|
||||||
|
return tag.getString("key");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
{
|
||||||
|
// tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour"))));
|
||||||
|
LivingArmourUpgrade upgrade = ItemUpgradeTrainer.getUpgrade(stack);
|
||||||
|
if (upgrade != null)
|
||||||
|
{
|
||||||
|
tooltip.add(TextHelper.localize(upgrade.getUnlocalizedName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTrainedUpgrades(ItemStack stack)
|
||||||
|
{
|
||||||
|
List<String> keyList = new ArrayList<String>();
|
||||||
|
String key = getKey(stack);
|
||||||
|
|
||||||
|
if (!key.isEmpty())
|
||||||
|
{
|
||||||
|
keyList.add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTrainedUpgrades(ItemStack stack, List<String> keys)
|
||||||
|
{
|
||||||
|
if (keys.isEmpty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setKey(stack, keys.get(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,21 +1,23 @@
|
||||||
package WayofTime.bloodmagic.livingArmour;
|
package WayofTime.bloodmagic.livingArmour;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
|
||||||
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.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||||
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
import WayofTime.bloodmagic.util.ChatUtil;
|
import WayofTime.bloodmagic.util.ChatUtil;
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
|
@ -122,6 +124,19 @@ public class LivingArmour implements ILivingArmour
|
||||||
upgrade.onTick(world, player, this);
|
upgrade.onTick(world, player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> allowedUpgradesList = new ArrayList<String>();
|
||||||
|
for (ItemStack stack : player.inventory.mainInventory)
|
||||||
|
{
|
||||||
|
if (stack != null && stack.getItem() instanceof IUpgradeTrainer)
|
||||||
|
{
|
||||||
|
List<String> keyList = ((IUpgradeTrainer) stack.getItem()).getTrainedUpgrades(stack);
|
||||||
|
if (!keyList.isEmpty())
|
||||||
|
{
|
||||||
|
allowedUpgradesList.addAll(keyList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
|
||||||
{
|
{
|
||||||
StatTracker tracker = entry.getValue();
|
StatTracker tracker = entry.getValue();
|
||||||
|
@ -131,6 +146,25 @@ public class LivingArmour implements ILivingArmour
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!allowedUpgradesList.isEmpty())
|
||||||
|
{
|
||||||
|
boolean allowed = false;
|
||||||
|
|
||||||
|
for (String key : allowedUpgradesList)
|
||||||
|
{
|
||||||
|
if (tracker.providesUpgrade(key))
|
||||||
|
{
|
||||||
|
allowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allowed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tracker.onTick(world, player, this))
|
if (tracker.onTick(world, player, this))
|
||||||
{
|
{
|
||||||
List<LivingArmourUpgrade> upgradeList = tracker.getUpgrades();
|
List<LivingArmourUpgrade> upgradeList = tracker.getUpgrades();
|
||||||
|
@ -140,6 +174,7 @@ public class LivingArmour implements ILivingArmour
|
||||||
upgradeArmour(player, upgrade);
|
upgradeArmour(player, upgrade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerArrowShot extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.arrowShot");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerDigging extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.digging");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,4 +87,10 @@ public class StatTrackerFood extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.knockback");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,4 +92,10 @@ public class StatTrackerGrimReaperSprint extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.grimReaper");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerHealthboost extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.health");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerMeleeDamage extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.meleeDamage");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,4 +98,10 @@ public class StatTrackerMovement extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.movement");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerPhysicalProtect extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.physicalProtect");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,10 @@ public class StatTrackerPoison extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.poisonResist");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,4 +86,10 @@ public class StatTrackerSelfSacrifice extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.selfSacrifice");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,4 +85,10 @@ public class StatTrackerSolarPowered extends StatTracker
|
||||||
|
|
||||||
return upgradeList;
|
return upgradeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean providesUpgrade(String key)
|
||||||
|
{
|
||||||
|
return key.equals(Constants.Mod.MODID + ".upgrade.solarPowered");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
|
@ -11,6 +9,7 @@ import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
||||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||||
|
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||||
import WayofTime.bloodmagic.item.ItemActivationCrystal;
|
import WayofTime.bloodmagic.item.ItemActivationCrystal;
|
||||||
import WayofTime.bloodmagic.item.ItemAltarMaker;
|
import WayofTime.bloodmagic.item.ItemAltarMaker;
|
||||||
import WayofTime.bloodmagic.item.ItemArcaneAshes;
|
import WayofTime.bloodmagic.item.ItemArcaneAshes;
|
||||||
|
@ -30,6 +29,7 @@ import WayofTime.bloodmagic.item.ItemSacrificialDagger;
|
||||||
import WayofTime.bloodmagic.item.ItemSlate;
|
import WayofTime.bloodmagic.item.ItemSlate;
|
||||||
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||||
import WayofTime.bloodmagic.item.ItemUpgradeTome;
|
import WayofTime.bloodmagic.item.ItemUpgradeTome;
|
||||||
|
import WayofTime.bloodmagic.item.ItemUpgradeTrainer;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
|
||||||
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
|
||||||
|
@ -60,6 +60,7 @@ import WayofTime.bloodmagic.item.soul.ItemSentientSword;
|
||||||
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
|
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
|
||||||
import WayofTime.bloodmagic.item.soul.ItemSoulSnare;
|
import WayofTime.bloodmagic.item.soul.ItemSoulSnare;
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||||
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
||||||
|
|
||||||
public class ModItems
|
public class ModItems
|
||||||
{
|
{
|
||||||
|
@ -125,6 +126,7 @@ public class ModItems
|
||||||
|
|
||||||
public static Item altarMaker;
|
public static Item altarMaker;
|
||||||
public static Item upgradeTome;
|
public static Item upgradeTome;
|
||||||
|
public static Item upgradeTrainer;
|
||||||
|
|
||||||
public static Item arcaneAshes;
|
public static Item arcaneAshes;
|
||||||
public static Item monsterSoul;
|
public static Item monsterSoul;
|
||||||
|
@ -213,6 +215,7 @@ public class ModItems
|
||||||
|
|
||||||
altarMaker = registerItem(new ItemAltarMaker());
|
altarMaker = registerItem(new ItemAltarMaker());
|
||||||
upgradeTome = registerItem(new ItemUpgradeTome());
|
upgradeTome = registerItem(new ItemUpgradeTome());
|
||||||
|
upgradeTrainer = registerItem(new ItemUpgradeTrainer());
|
||||||
|
|
||||||
arcaneAshes = registerItem(new ItemArcaneAshes());
|
arcaneAshes = registerItem(new ItemArcaneAshes());
|
||||||
monsterSoul = registerItem(new ItemMonsterSoul());
|
monsterSoul = registerItem(new ItemMonsterSoul());
|
||||||
|
@ -234,6 +237,7 @@ public class ModItems
|
||||||
|
|
||||||
renderHelperV2.registerRender(altarMaker, "altarMaker");
|
renderHelperV2.registerRender(altarMaker, "altarMaker");
|
||||||
renderHelperV2.registerRender(upgradeTome, "upgradeTome");
|
renderHelperV2.registerRender(upgradeTome, "upgradeTome");
|
||||||
|
renderHelperV2.registerRender(upgradeTrainer, "upgradeTrainer");
|
||||||
|
|
||||||
renderHelperV2.registerRender(arcaneAshes, "arcaneAshes");
|
renderHelperV2.registerRender(arcaneAshes, "arcaneAshes");
|
||||||
renderHelperV2.registerRender(monsterSoul, "monsterSoul");
|
renderHelperV2.registerRender(monsterSoul, "monsterSoul");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.util.handler;
|
package WayofTime.bloodmagic.util.handler;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ import WayofTime.bloodmagic.api.event.ItemBindEvent;
|
||||||
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
||||||
import WayofTime.bloodmagic.api.event.TeleposeEvent;
|
import WayofTime.bloodmagic.api.event.TeleposeEvent;
|
||||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||||
|
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
|
||||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
import WayofTime.bloodmagic.api.soul.IDemonWill;
|
||||||
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
import WayofTime.bloodmagic.api.soul.IDemonWillWeapon;
|
||||||
|
@ -185,11 +187,54 @@ public class EventHandler
|
||||||
{
|
{
|
||||||
ItemStack output = new ItemStack(ModItems.upgradeTome);
|
ItemStack output = new ItemStack(ModItems.upgradeTome);
|
||||||
output = NBTHelper.checkNBT(output);
|
output = NBTHelper.checkNBT(output);
|
||||||
((ItemUpgradeTome) output.getItem()).setKey(output, Constants.Mod.MODID + ".upgrade.revealing");
|
ItemUpgradeTome.setKey(output, Constants.Mod.MODID + ".upgrade.revealing");
|
||||||
((ItemUpgradeTome) output.getItem()).setLevel(output, 1);
|
ItemUpgradeTome.setLevel(output, 1);
|
||||||
event.cost = 1;
|
event.cost = 1;
|
||||||
|
|
||||||
event.output = output;
|
event.output = output;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.left.getItem() == ModItems.upgradeTome && event.right.getItem() == ModItems.upgradeTome)
|
||||||
|
{
|
||||||
|
LivingArmourUpgrade leftUpgrade = ItemUpgradeTome.getUpgrade(event.left);
|
||||||
|
if (leftUpgrade != null && ItemUpgradeTome.getKey(event.left).equals(ItemUpgradeTome.getKey(event.right)))
|
||||||
|
{
|
||||||
|
int leftLevel = ItemUpgradeTome.getLevel(event.left);
|
||||||
|
int rightLevel = ItemUpgradeTome.getLevel(event.right);
|
||||||
|
|
||||||
|
if (leftLevel == rightLevel && leftLevel < leftUpgrade.getMaxTier() - 1)
|
||||||
|
{
|
||||||
|
ItemStack outputStack = event.left.copy();
|
||||||
|
ItemUpgradeTome.setLevel(outputStack, leftLevel + 1);
|
||||||
|
event.cost = leftLevel + 2;
|
||||||
|
|
||||||
|
event.output = outputStack;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.left.getItem() instanceof IUpgradeTrainer && event.right.getItem() == ModItems.upgradeTome)
|
||||||
|
{
|
||||||
|
LivingArmourUpgrade rightUpgrade = ItemUpgradeTome.getUpgrade(event.right);
|
||||||
|
if (rightUpgrade != null)
|
||||||
|
{
|
||||||
|
String key = ItemUpgradeTome.getKey(event.right);
|
||||||
|
ItemStack outputStack = event.left.copy();
|
||||||
|
List<String> keyList = new ArrayList<String>();
|
||||||
|
keyList.add(key);
|
||||||
|
if (((IUpgradeTrainer) event.left.getItem()).setTrainedUpgrades(outputStack, keyList))
|
||||||
|
{
|
||||||
|
event.cost = 1;
|
||||||
|
|
||||||
|
event.output = outputStack;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "builtin/generated",
|
||||||
|
"transform": "forge:default-item"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"type": {
|
||||||
|
"upgradetrainer": {
|
||||||
|
"textures": {
|
||||||
|
"layer0": "bloodmagic:items/UpgradeTrainer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -121,6 +121,7 @@ item.BloodMagic.ritualDivinerdawn.name=Ritual Diviner [Dawn]
|
||||||
|
|
||||||
item.BloodMagic.arcaneAshes.name=Arcane Ashes
|
item.BloodMagic.arcaneAshes.name=Arcane Ashes
|
||||||
item.BloodMagic.upgradeTome.name=Living Armour Upgrade Tome
|
item.BloodMagic.upgradeTome.name=Living Armour Upgrade Tome
|
||||||
|
item.BloodMagic.upgradeTrainer.name=Living Armour Training Bracelet
|
||||||
|
|
||||||
item.BloodMagic.sentientSword.name=Sentient Sword
|
item.BloodMagic.sentientSword.name=Sentient Sword
|
||||||
item.BloodMagic.soulGem.petty.name=Petty Tartaric Gem
|
item.BloodMagic.soulGem.petty.name=Petty Tartaric Gem
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent":"bloodmagic:item/ItemModelBase",
|
||||||
|
"textures": {
|
||||||
|
"layer0":"bloodmagic:items/UpgradeTrainer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 544 B |
Loading…
Reference in a new issue