Merge branch '1.9-NetworkChange' into 1.9
This commit is contained in:
commit
7b653a4bb6
|
@ -527,7 +527,7 @@ public class BloodAltar implements IFluidHandler
|
|||
{
|
||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||
|
||||
int drain = NetworkHelper.getSoulNetwork(ownerUUID).addLifeEssence(liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
|
||||
int drain = NetworkHelper.getSoulNetwork(ownerUUID).add(liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
|
||||
|
||||
fluid.amount = fluid.amount - drain;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Base event class for Soul Network related events.
|
||||
*
|
||||
|
@ -64,6 +66,7 @@ public class SoulNetworkEvent extends Event
|
|||
@Cancelable
|
||||
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
||||
{
|
||||
@Nullable
|
||||
public final ItemStack itemStack;
|
||||
/**
|
||||
* Amount of damage that would incur if the network could not drain
|
||||
|
@ -84,7 +87,7 @@ public class SoulNetworkEvent extends Event
|
|||
* @param drainAmount
|
||||
* Original drain amount - change to alter cost
|
||||
*/
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount)
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, @Nullable ItemStack itemStack, int drainAmount)
|
||||
{
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package WayofTime.bloodmagic.api.saving;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class BMWorldSavedData extends WorldSavedData
|
||||
{
|
||||
public static final String ID = "BloodMagic-SoulNetworks";
|
||||
|
||||
private Map<UUID, SoulNetwork> soulNetworks = new HashMap<UUID, SoulNetwork>();
|
||||
|
||||
public BMWorldSavedData(String id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
public BMWorldSavedData()
|
||||
{
|
||||
this(ID);
|
||||
}
|
||||
|
||||
public SoulNetwork getNetwork(EntityPlayer player)
|
||||
{
|
||||
return getNetwork(PlayerHelper.getUUIDFromPlayer(player));
|
||||
}
|
||||
|
||||
public SoulNetwork getNetwork(UUID playerId)
|
||||
{
|
||||
if (!soulNetworks.containsKey(playerId))
|
||||
soulNetworks.put(playerId, SoulNetwork.newEmpty(playerId).setParent(this));
|
||||
return soulNetworks.get(playerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
NBTTagList networkData = tagCompound.getTagList("networkData", 10);
|
||||
|
||||
for (int i = 0; i < networkData.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound data = networkData.getCompoundTagAt(i);
|
||||
SoulNetwork network = SoulNetwork.fromNBT(data);
|
||||
network.setParent(this);
|
||||
soulNetworks.put(network.getPlayerId(), network);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
NBTTagList networkData = new NBTTagList();
|
||||
for (SoulNetwork soulNetwork : soulNetworks.values())
|
||||
networkData.appendTag(soulNetwork.serializeNBT());
|
||||
|
||||
tagCompound.setTag("networkData", networkData);
|
||||
|
||||
return tagCompound;
|
||||
}
|
||||
}
|
220
src/main/java/WayofTime/bloodmagic/api/saving/SoulNetwork.java
Normal file
220
src/main/java/WayofTime/bloodmagic/api/saving/SoulNetwork.java
Normal file
|
@ -0,0 +1,220 @@
|
|||
package WayofTime.bloodmagic.api.saving;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.event.AddToNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.event.SoulNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import com.google.common.base.Strings;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
public class SoulNetwork implements INBTSerializable<NBTTagCompound>
|
||||
{
|
||||
private BMWorldSavedData parent;
|
||||
private EntityPlayer cachedPlayer;
|
||||
private UUID playerId;
|
||||
private int currentEssence;
|
||||
private int orbTier;
|
||||
|
||||
private SoulNetwork()
|
||||
{
|
||||
// No-op - For creation via NBT only
|
||||
}
|
||||
|
||||
public int add(int toAdd, int maximum)
|
||||
{
|
||||
AddToNetworkEvent event = new AddToNetworkEvent(playerId.toString(), toAdd, maximum);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return 0;
|
||||
|
||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
|
||||
return 0;
|
||||
|
||||
int currEss = getCurrentEssence();
|
||||
|
||||
if (currEss >= event.maximum)
|
||||
return 0;
|
||||
|
||||
int newEss = Math.min(event.maximum, currEss + event.addedAmount);
|
||||
if (event.getResult() != Event.Result.DENY)
|
||||
setCurrentEssence(newEss);
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - Please use {@link #add(int, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public int addLifeEssence(int toAdd, int maximum)
|
||||
{
|
||||
return add(toAdd, maximum);
|
||||
}
|
||||
|
||||
public int syphon(int syphon)
|
||||
{
|
||||
if (getCurrentEssence() >= syphon)
|
||||
{
|
||||
setCurrentEssence(getCurrentEssence() - syphon);
|
||||
return syphon;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean syphonAndDamage(EntityPlayer user, int toSyphon)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
if (user.worldObj.isRemote)
|
||||
return false;
|
||||
|
||||
if (!Strings.isNullOrEmpty(playerId.toString()))
|
||||
{
|
||||
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(user, playerId.toString(), null, toSyphon);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return false;
|
||||
|
||||
int drainAmount = syphon(event.syphon);
|
||||
|
||||
if (drainAmount <= 0 || event.shouldDamage)
|
||||
hurtPlayer(user, event.syphon);
|
||||
|
||||
return event.getResult() != Event.Result.DENY;
|
||||
}
|
||||
|
||||
int amount = syphon(toSyphon);
|
||||
hurtPlayer(user, toSyphon - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void causeNausea()
|
||||
{
|
||||
if (getPlayer() != null)
|
||||
getPlayer().addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 99));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - Please use {@link #causeNausea()}
|
||||
*/
|
||||
@Deprecated
|
||||
public void causeNauseaToPlayer()
|
||||
{
|
||||
causeNausea();
|
||||
}
|
||||
|
||||
public void hurtPlayer(EntityPlayer user, float syphon)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
if (syphon < 100 && syphon > 0)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.hurtResistantTime = 0;
|
||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||
}
|
||||
|
||||
} else if (syphon >= 100)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int i = 0; i < ((syphon + 99) / 100); i++)
|
||||
{
|
||||
user.hurtResistantTime = 0;
|
||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void markDirty()
|
||||
{
|
||||
if (getParent() != null)
|
||||
getParent().markDirty();
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("A SoulNetwork was created, but a parent was not set to allow saving.");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
if (cachedPlayer == null)
|
||||
cachedPlayer = PlayerHelper.getPlayerFromUUID(playerId);
|
||||
|
||||
return cachedPlayer;
|
||||
}
|
||||
|
||||
public SoulNetwork setCurrentEssence(int currentEssence)
|
||||
{
|
||||
this.currentEssence = currentEssence;
|
||||
markDirty();
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoulNetwork setOrbTier(int orbTier)
|
||||
{
|
||||
this.orbTier = orbTier;
|
||||
markDirty();
|
||||
return this;
|
||||
}
|
||||
|
||||
public SoulNetwork setParent(BMWorldSavedData parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
markDirty();
|
||||
return this;
|
||||
}
|
||||
|
||||
// INBTSerializable
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT()
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setString("playerId", getPlayerId().toString());
|
||||
tagCompound.setInteger("currentEssence", getCurrentEssence());
|
||||
tagCompound.setInteger("orbTier", getOrbTier());
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound nbt)
|
||||
{
|
||||
this.playerId = UUID.fromString(nbt.getString("playerId"));
|
||||
this.currentEssence = nbt.getInteger("currentEssence");
|
||||
this.orbTier = nbt.getInteger("orbTier");
|
||||
}
|
||||
|
||||
public static SoulNetwork fromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
SoulNetwork soulNetwork = new SoulNetwork();
|
||||
soulNetwork.deserializeNBT(tagCompound);
|
||||
return soulNetwork;
|
||||
}
|
||||
|
||||
public static SoulNetwork newEmpty(UUID uuid)
|
||||
{
|
||||
SoulNetwork network = new SoulNetwork();
|
||||
network.playerId = uuid;
|
||||
return network;
|
||||
}
|
||||
}
|
|
@ -1,19 +1,17 @@
|
|||
package WayofTime.bloodmagic.api.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.event.AddToNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.event.SoulNetworkEvent;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||
import WayofTime.bloodmagic.api.saving.BMWorldSavedData;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -33,20 +31,18 @@ public class NetworkHelper
|
|||
public static SoulNetwork getSoulNetwork(String uuid)
|
||||
{
|
||||
World world = DimensionManager.getWorld(0);
|
||||
if (world == null || world.getMapStorage() == null) //Hack-ish way to fix the lava crystal.
|
||||
if (world == null || world.getMapStorage() == null) //Hack-ish way to fix the lava crystal.
|
||||
return new BMWorldSavedData().getNetwork(UUID.fromString(uuid));
|
||||
|
||||
BMWorldSavedData saveData = (BMWorldSavedData) world.getMapStorage().getOrLoadData(BMWorldSavedData.class, BMWorldSavedData.ID);
|
||||
|
||||
if (saveData == null)
|
||||
{
|
||||
return new SoulNetwork(uuid);
|
||||
saveData = new BMWorldSavedData();
|
||||
world.getMapStorage().setData(BMWorldSavedData.ID, saveData);
|
||||
}
|
||||
|
||||
SoulNetwork network = (SoulNetwork) world.getMapStorage().getOrLoadData(SoulNetwork.class, uuid);
|
||||
|
||||
if (network == null)
|
||||
{
|
||||
network = new SoulNetwork(uuid);
|
||||
world.getMapStorage().setData(uuid, network);
|
||||
}
|
||||
|
||||
return network;
|
||||
return saveData.getNetwork(UUID.fromString(uuid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,208 +184,5 @@ public class NetworkHelper
|
|||
public static void setMaxOrb(SoulNetwork soulNetwork, int maxOrb)
|
||||
{
|
||||
soulNetwork.setOrbTier(Math.max(maxOrb, soulNetwork.getOrbTier()));
|
||||
soulNetwork.markDirty();
|
||||
}
|
||||
|
||||
// TODO - Remove everything below. It is deprecated and should not be used.
|
||||
|
||||
/**
|
||||
* Master method used to syphon from the player's network, and will damage
|
||||
* them accordingly if they do not have enough LP. Does not drain on the
|
||||
* client side.
|
||||
*
|
||||
* @param stack
|
||||
* Owned itemStack
|
||||
* @param player
|
||||
* Player using the item
|
||||
*
|
||||
* @return True if the action should be executed and false if it should not.
|
||||
* Always returns false if client-sided.
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean syphonAndDamageFromNetwork(ItemStack stack, EntityPlayer player, int syphon)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
return false;
|
||||
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||
|
||||
if (!Strings.isNullOrEmpty(ownerName))
|
||||
{
|
||||
SoulNetworkEvent.ItemDrainNetworkEvent event = new SoulNetworkEvent.ItemDrainNetworkEvent(player, ownerName, stack, syphon);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return false;
|
||||
|
||||
int drainAmount = syphonFromNetwork(event.ownerUUID, event.syphon);
|
||||
|
||||
if (drainAmount == 0 || event.shouldDamage)
|
||||
hurtPlayer(player, event.syphon);
|
||||
|
||||
// The event has been told to prevent the action but allow all
|
||||
// repercussions of using the item.
|
||||
return event.getResult() != Event.Result.DENY;
|
||||
}
|
||||
|
||||
int amount = NetworkHelper.syphonFromNetwork(stack, syphon);
|
||||
|
||||
hurtPlayer(player, syphon - amount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean syphonFromNetworkWhileInContainer(ItemStack stack, int syphon)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||
|
||||
if (Strings.isNullOrEmpty(ownerName))
|
||||
return false;
|
||||
|
||||
SoulNetworkEvent.ItemDrainInContainerEvent event = new SoulNetworkEvent.ItemDrainInContainerEvent(stack, ownerName, syphon);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY)
|
||||
return false;
|
||||
|
||||
return syphonFromNetwork(event.ownerUUID, event.syphon) >= syphon;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int syphonFromNetwork(ItemStack stack, int syphon)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
String ownerName = stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
||||
if (!Strings.isNullOrEmpty(ownerName))
|
||||
return syphonFromNetwork(ownerName, syphon);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int syphonFromNetwork(String ownerName, int syphon)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
|
||||
return 0;
|
||||
|
||||
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
|
||||
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
||||
|
||||
if (network == null)
|
||||
{
|
||||
network = new SoulNetwork(ownerName);
|
||||
world.setItemData(ownerName, network);
|
||||
}
|
||||
|
||||
if (network.getCurrentEssence() >= syphon)
|
||||
{
|
||||
network.setCurrentEssence(network.getCurrentEssence() - syphon);
|
||||
network.markDirty();
|
||||
return syphon;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Add
|
||||
|
||||
/**
|
||||
* A method to add to an owner's network up to a maximum value.
|
||||
*
|
||||
* @return amount added to the network
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
|
||||
{
|
||||
AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return 0;
|
||||
|
||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
|
||||
return 0;
|
||||
|
||||
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
|
||||
SoulNetwork data = (SoulNetwork) world.loadItemData(SoulNetwork.class, event.ownerNetwork);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = new SoulNetwork(event.ownerNetwork);
|
||||
world.setItemData(event.ownerNetwork, data);
|
||||
}
|
||||
|
||||
int currEss = data.getCurrentEssence();
|
||||
|
||||
if (currEss >= event.maximum)
|
||||
return 0;
|
||||
|
||||
int newEss = Math.min(event.maximum, currEss + event.addedAmount);
|
||||
if (event.getResult() != Event.Result.DENY)
|
||||
data.setCurrentEssence(newEss);
|
||||
|
||||
return newEss - currEss;
|
||||
}
|
||||
|
||||
// Get
|
||||
|
||||
@Deprecated
|
||||
public static int getCurrentEssence(String ownerName)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null)
|
||||
return 0;
|
||||
|
||||
World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
|
||||
SoulNetwork network = (SoulNetwork) world.loadItemData(SoulNetwork.class, ownerName);
|
||||
|
||||
if (network == null)
|
||||
{
|
||||
network = new SoulNetwork(ownerName);
|
||||
world.setItemData(ownerName, network);
|
||||
}
|
||||
|
||||
return network.getCurrentEssence();
|
||||
}
|
||||
|
||||
// Do damage
|
||||
|
||||
@Deprecated
|
||||
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
|
||||
{
|
||||
if (energySyphoned < 100 && energySyphoned > 0)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
||||
}
|
||||
} else if (energySyphoned >= 100)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
|
||||
{
|
||||
user.setHealth((user.getHealth() - 1));
|
||||
|
||||
if (user.getHealth() <= 0.0005f)
|
||||
{
|
||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void hurtPlayer(EntityPlayer user, float damage)
|
||||
{
|
||||
if (!user.capabilities.isCreativeMode)
|
||||
{
|
||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 0F);
|
||||
user.setHealth((user.getHealth() - damage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package WayofTime.bloodmagic.command.sub;
|
||||
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
@ -112,7 +112,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
int maxOrb = NetworkHelper.getMaximumForTier(network.getOrbTier());
|
||||
displaySuccessString(sender, "commands.network.add.success", network.addLifeEssence(amount, maxOrb), player.getDisplayName().getFormattedText());
|
||||
displaySuccessString(sender, "commands.network.add.success", network.add(amount, maxOrb), player.getDisplayName().getFormattedText());
|
||||
} else
|
||||
{
|
||||
displayErrorString(sender, "commands.error.arg.invalid");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package WayofTime.bloodmagic.command.sub;
|
||||
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.command.SubCommandBase;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb, IBindab
|
|||
if (getOwnerUUID(stack).equals(PlayerHelper.getUsernameFromPlayer(player)))
|
||||
NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(getOwnerUUID(stack)), getOrbLevel(stack.getItemDamage()));
|
||||
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).add(200, getMaxEssence(stack.getItemDamage()));
|
||||
NetworkHelper.getSoulNetwork(player).hurtPlayer(player, 200);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
|
|
|
@ -5,7 +5,7 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.altar.AltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
|
@ -55,7 +55,7 @@ public class RitualAltarBuilder extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -32,7 +32,7 @@ public class RitualAnimalGrowth extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.item.ItemComponent;
|
||||
|
@ -36,7 +36,7 @@ public class RitualCobblestone extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
|
@ -32,7 +32,7 @@ public class RitualContainment extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -46,7 +45,7 @@ public class RitualCrushing extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -38,7 +38,7 @@ public class RitualCrystalHarvest extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -49,7 +49,7 @@ public class RitualExpulsion extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
|
@ -43,7 +43,7 @@ public class RitualFeatheredKnife extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
@ -53,7 +53,7 @@ public class RitualFelling extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -89,7 +89,7 @@ public class RitualForsakenSoul extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -91,7 +91,7 @@ public class RitualFullStomach extends Ritual
|
|||
|
||||
if (totalEffects >= maxEffects)
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package WayofTime.bloodmagic.ritual;
|
|||
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -35,7 +35,7 @@ public class RitualGreenGrove extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package WayofTime.bloodmagic.ritual;
|
|||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IHarvestHandler;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.registry.HarvestRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
|
@ -43,7 +43,7 @@ public class RitualHarvest extends Ritual
|
|||
|
||||
if (network.getCurrentEssence() < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
|
@ -32,7 +32,7 @@ public class RitualInterdiction extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -34,7 +33,7 @@ public class RitualJumping extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -30,7 +30,7 @@ public class RitualLava extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ package WayofTime.bloodmagic.ritual;
|
|||
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -79,7 +79,7 @@ public class RitualMagnetic extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -44,7 +44,7 @@ public class RitualPlacer extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
|
@ -45,7 +45,7 @@ public class RitualPump extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -41,7 +41,7 @@ public class RitualRegeneration extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -37,7 +37,7 @@ public class RitualSpeed extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
|
@ -36,7 +36,7 @@ public class RitualSuppression extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -30,7 +30,7 @@ public class RitualWater extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package WayofTime.bloodmagic.ritual;
|
|||
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
|
@ -45,7 +45,7 @@ public class RitualWellOfSuffering extends Ritual
|
|||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
@ -45,7 +45,7 @@ public class RitualZephyr extends Ritual
|
|||
{
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
network.causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package WayofTime.bloodmagic.ritual.portal;
|
||||
|
||||
import WayofTime.bloodmagic.api.event.TeleposeEvent;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.teleport.Teleport;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleporterBloodMagic;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.event.RitualEvent;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
|
|
|
@ -31,7 +31,7 @@ import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
|||
import WayofTime.bloodmagic.api.event.TeleposeEvent;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.util.helper.*;
|
||||
import WayofTime.bloodmagic.block.BlockAltar;
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package WayofTime.bloodmagic.util.handler.event;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.annot.Handler;
|
||||
import WayofTime.bloodmagic.api.saving.BMWorldSavedData;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
// Migrates from the old data storage system to the cleaner new one
|
||||
@Handler
|
||||
public class MigrateNetworkDataHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerJoin(EntityJoinWorldEvent event) {
|
||||
if (!event.getWorld().isRemote && event.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntity();
|
||||
UUID playerId = PlayerHelper.getUUIDFromPlayer(player);
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
|
||||
if (event.getWorld().getMapStorage() == null)
|
||||
return;
|
||||
|
||||
BMWorldSavedData saveData = (BMWorldSavedData) event.getWorld().getMapStorage().getOrLoadData(BMWorldSavedData.class, BMWorldSavedData.ID);
|
||||
WayofTime.bloodmagic.api.network.SoulNetwork oldData = (WayofTime.bloodmagic.api.network.SoulNetwork) event.getWorld().getMapStorage().getOrLoadData(WayofTime.bloodmagic.api.network.SoulNetwork.class, playerId.toString());
|
||||
|
||||
if (saveData == null)
|
||||
{
|
||||
saveData = new BMWorldSavedData();
|
||||
event.getWorld().getMapStorage().setData(BMWorldSavedData.ID, saveData);
|
||||
}
|
||||
|
||||
if (oldData == null)
|
||||
return;
|
||||
|
||||
SoulNetwork network = saveData.getNetwork(playerId);
|
||||
if (oldData.getOrbTier() > network.getOrbTier())
|
||||
network.setOrbTier(oldData.getOrbTier());
|
||||
if (oldData.getCurrentEssence() > network.getCurrentEssence())
|
||||
network.setCurrentEssence(oldData.getCurrentEssence());
|
||||
|
||||
File oldDataFile = event.getWorld().getSaveHandler().getMapFileFromName(playerId.toString());
|
||||
try
|
||||
{
|
||||
FileUtils.forceDelete(oldDataFile);
|
||||
} catch (IOException e)
|
||||
{
|
||||
BloodMagic.instance.getLogger().error("Error deleting data file {}.", oldDataFile);
|
||||
BloodMagic.instance.getLogger().error(e.getLocalizedMessage());
|
||||
}
|
||||
stopwatch.stop();
|
||||
BloodMagic.instance.getLogger().info("Migration completed for {} ({}) in {}.", player.getDisplayNameString(), playerId, stopwatch);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue