Pushed a beta release
This commit is contained in:
parent
b30d6de13c
commit
f08363b74a
9 changed files with 123 additions and 29 deletions
|
@ -5,22 +5,26 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData
|
||||
{
|
||||
public int currentEssence;
|
||||
public int maxOrb;
|
||||
|
||||
public LifeEssenceNetwork(String par1Str)
|
||||
{
|
||||
super(par1Str);
|
||||
currentEssence = 0;
|
||||
maxOrb = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
currentEssence = nbttagcompound.getInteger("currentEssence");
|
||||
maxOrb = nbttagcompound.getInteger("maxOrb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setInteger("currentEssence", currentEssence);
|
||||
nbttagcompound.setInteger("maxOrb", maxOrb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,66 @@ public class SoulNetworkHandler
|
|||
|
||||
return syphonFromNetwork(event.ownerNetwork, event.drainAmount) >= damageToBeDone;
|
||||
}
|
||||
|
||||
public static int getCurrentMaxOrb(String ownerName)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
return data.maxOrb;
|
||||
}
|
||||
|
||||
public static void setMaxOrbToMax(String ownerName, int maxOrb)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
World world = MinecraftServer.getServer().worldServers[0];
|
||||
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new LifeEssenceNetwork(ownerName);
|
||||
world.setItemData(ownerName, data);
|
||||
}
|
||||
|
||||
data.maxOrb = Math.max(maxOrb, data.maxOrb);
|
||||
data.markDirty();
|
||||
}
|
||||
|
||||
public static int getMaximumForOrbTier(int maxOrb)
|
||||
{
|
||||
switch(maxOrb)
|
||||
{
|
||||
case 1:
|
||||
return 5000;
|
||||
case 2:
|
||||
return 25000;
|
||||
case 3:
|
||||
return 150000;
|
||||
case 4:
|
||||
return 1000000;
|
||||
case 5:
|
||||
return 10000000;
|
||||
case 6:
|
||||
return 30000000;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,23 @@ public class APISpellHelper
|
|||
data.setInteger("BM:StoredLP", amount);
|
||||
}
|
||||
|
||||
public static int getPlayerMaxLPTag(EntityPlayer player)
|
||||
{
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
if(data.hasKey("BM:MaxStoredLP"))
|
||||
{
|
||||
return data.getInteger("BM:MaxStoredLP");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setPlayerMaxLPTag(EntityPlayer player, int amount)
|
||||
{
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
data.setInteger("BM:MaxStoredLP", amount);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range)
|
||||
{
|
||||
float f = 1.0F;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue