2015-11-02 20:39:44 +00:00
|
|
|
package WayofTime.bloodmagic.api.event;
|
2014-11-07 02:25:53 +00:00
|
|
|
|
2015-10-30 03:22:14 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
2015-07-29 12:23:01 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
|
|
|
|
2015-10-30 03:22:14 +00:00
|
|
|
public class SoulNetworkEvent extends Event {
|
2014-11-07 02:25:53 +00:00
|
|
|
|
2015-11-22 21:43:15 +00:00
|
|
|
public final String ownerName;
|
2015-10-30 03:22:14 +00:00
|
|
|
public int syphon;
|
|
|
|
|
|
|
|
public SoulNetworkEvent(String ownerName, int syphon) {
|
|
|
|
this.ownerName = ownerName;
|
|
|
|
this.syphon = syphon;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
public static class ItemDrainInContainerEvent extends SoulNetworkEvent {
|
|
|
|
|
|
|
|
public ItemStack stack;
|
|
|
|
|
|
|
|
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon) {
|
|
|
|
super(ownerName, syphon);
|
|
|
|
this.stack = stack;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent {
|
|
|
|
|
|
|
|
public final EntityPlayer player;
|
2015-11-02 17:51:11 +00:00
|
|
|
public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it
|
2015-10-30 03:22:14 +00:00
|
|
|
|
|
|
|
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) {
|
|
|
|
super(ownerNetwork, drainAmount);
|
2015-11-02 17:51:11 +00:00
|
|
|
this.shouldDamage = false;
|
2015-10-30 03:22:14 +00:00
|
|
|
this.player = player;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent {
|
|
|
|
|
|
|
|
public final ItemStack itemStack;
|
|
|
|
public float damageAmount; //Amount of damage that would incur if the network could not drain properly
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties
|
|
|
|
*
|
2015-11-29 02:25:46 +00:00
|
|
|
* @param player Player using the item
|
|
|
|
* @param ownerNetwork Network that the item is tied to
|
|
|
|
* @param itemStack Item used
|
|
|
|
* @param drainAmount Original drain amount - change to alter cost
|
2015-10-30 03:22:14 +00:00
|
|
|
*/
|
|
|
|
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) {
|
|
|
|
super(player, ownerNetwork, drainAmount);
|
|
|
|
this.itemStack = itemStack;
|
2015-11-29 02:25:46 +00:00
|
|
|
this.damageAmount = (float) (drainAmount) / 100.0f;
|
2015-10-30 03:22:14 +00:00
|
|
|
}
|
|
|
|
}
|
2014-11-07 02:25:53 +00:00
|
|
|
}
|