Base work for ticket based syphoning

To be used for providing a history. This commit breaks any usage of the
network events.

Heads up @TeamDMan @Arcaratus
This commit is contained in:
Nicholas Ignoffo 2018-06-28 18:24:17 -07:00
parent c8e42e3288
commit 47b88b95b0
5 changed files with 203 additions and 104 deletions

View file

@ -1,8 +1,9 @@
package WayofTime.bloodmagic.util.helper;
import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.iface.IBindable;
import WayofTime.bloodmagic.core.data.SoulTicket;
import WayofTime.bloodmagic.event.SoulNetworkEvent;
import WayofTime.bloodmagic.iface.IBindable;
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
@ -97,7 +98,7 @@ public class NetworkHelper {
* @param user - User of the item.
* @param toSyphon - Amount of LP to syphon
* @return - Whether the action should be performed.
* @deprecated Use {@link #getSoulNetwork(EntityPlayer)} and {@link SoulNetwork#syphonAndDamage(EntityPlayer, int)}
* @deprecated Use {@link #getSoulNetwork(EntityPlayer)} and {@link SoulNetwork#syphonAndDamage(EntityPlayer, SoulTicket)}
*/
@Deprecated
public static boolean syphonAndDamage(SoulNetwork soulNetwork, EntityPlayer user, int toSyphon) {
@ -128,9 +129,9 @@ public class NetworkHelper {
return false;
SoulNetwork network = getSoulNetwork(binding);
SoulNetworkEvent.ItemDrainInContainerEvent event = new SoulNetworkEvent.ItemDrainInContainerEvent(stack, binding.getOwnerId(), toSyphon);
SoulNetworkEvent.Syphon.Item event = new SoulNetworkEvent.Syphon.Item(network, new SoulTicket(toSyphon), stack);
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.syphon) >= toSyphon;
return !MinecraftForge.EVENT_BUS.post(event) && network.syphon(event.getTicket(), true) >= toSyphon;
}
/**