Fixed API referencing the main mod.
This commit is contained in:
parent
3980c0fc6c
commit
1a7ae8d99c
|
@ -0,0 +1,46 @@
|
|||
package WayofTime.bloodmagic.api.livingArmour;
|
||||
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
/**
|
||||
* An interface this is used purely for internal implementation.
|
||||
*
|
||||
* @author WayofTime
|
||||
*
|
||||
*/
|
||||
public interface ILivingArmour
|
||||
{
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers();
|
||||
|
||||
public boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade);
|
||||
|
||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade);
|
||||
|
||||
/**
|
||||
* Ticks the upgrades and stat trackers, passing in the world and player as
|
||||
* well as the LivingArmour
|
||||
*
|
||||
* @param world
|
||||
* @param player
|
||||
*/
|
||||
public void onTick(World world, EntityPlayer player);
|
||||
|
||||
public void readFromNBT(NBTTagCompound tag);
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag, boolean forceWrite);
|
||||
|
||||
/**
|
||||
* Writes the LivingArmour to the NBTTag. This will only write the trackers
|
||||
* that are dirty.
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
public void writeDirtyToNBT(NBTTagCompound tag);
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag);
|
||||
}
|
|
@ -4,7 +4,6 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
@ -49,7 +48,7 @@ public abstract class LivingArmourUpgrade
|
|||
|
||||
public abstract int getCostOfUpgrade();
|
||||
|
||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
|
@ -19,7 +20,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
|
|||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public class LivingArmour
|
||||
public class LivingArmour implements ILivingArmour
|
||||
{
|
||||
public static String chatBase = "chat.BloodMagic.livingArmour.";
|
||||
public HashMap<String, StatTracker> trackerMap = new HashMap<String, StatTracker>();
|
||||
|
@ -28,6 +29,7 @@ public class LivingArmour
|
|||
public int maxUpgradePoints = 100;
|
||||
public int totalUpgradePoints = 0;
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||
{
|
||||
HashMultimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||
|
@ -45,6 +47,7 @@ public class LivingArmour
|
|||
return modifierMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean upgradeArmour(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
String key = upgrade.getUniqueIdentifier();
|
||||
|
@ -78,6 +81,7 @@ public class LivingArmour
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
ChatUtil.sendChat(user, TextHelper.localize(chatBase + "newUpgrade"));
|
||||
|
@ -90,6 +94,7 @@ public class LivingArmour
|
|||
* @param world
|
||||
* @param player
|
||||
*/
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player)
|
||||
{
|
||||
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
|
||||
|
@ -125,6 +130,7 @@ public class LivingArmour
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
NBTTagList upgradeTags = tag.getTagList("upgrades", 10);
|
||||
|
@ -170,6 +176,7 @@ public class LivingArmour
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag, boolean forceWrite)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
|
@ -220,11 +227,13 @@ public class LivingArmour
|
|||
*
|
||||
* @param tag
|
||||
*/
|
||||
@Override
|
||||
public void writeDirtyToNBT(NBTTagCompound tag)
|
||||
{
|
||||
writeToNBT(tag, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
writeToNBT(tag, true);
|
||||
|
|
|
@ -8,11 +8,12 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
public class LivingArmourUpgradeDigging extends LivingArmourUpgrade
|
||||
{
|
||||
public static HashMap<LivingArmour, Boolean> changeMap = new HashMap<LivingArmour, Boolean>();
|
||||
public static HashMap<ILivingArmour, Boolean> changeMap = new HashMap<ILivingArmour, Boolean>();
|
||||
|
||||
public static final int[] costs = new int[] { 5, 10, 18, 35, 65, 100, 160 };
|
||||
public static final int[] digHasteTime = new int[] { 20, 40, 60, 100, 100, 100 };
|
||||
|
@ -31,7 +32,7 @@ public class LivingArmourUpgradeDigging extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (changeMap.containsKey(livingArmour) && changeMap.get(livingArmour))
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
@ -24,7 +25,7 @@ public class LivingArmourUpgradePoisonResist extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isPotionActive(Potion.poison) && poisonCooldown <= 0)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
@ -30,7 +31,7 @@ public class LivingArmourUpgradeSpeed extends LivingArmourUpgrade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||
{
|
||||
if (player.isSprinting())
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ public class StatTrackerDigging extends StatTracker
|
|||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (totalBlocksDug < blocksRequired[i])
|
||||
if (totalBlocksDug >= blocksRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeDigging(i));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue