Rewrite IBindable to provide an object instead of storing 2 strings
This commit is contained in:
parent
941173dbf4
commit
2a43e53842
47 changed files with 416 additions and 510 deletions
|
@ -7,24 +7,29 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
|||
|
||||
@Cancelable
|
||||
public class ItemBindEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public String key;
|
||||
public ItemStack itemStack;
|
||||
|
||||
private final EntityPlayer player;
|
||||
private final ItemStack itemStack;
|
||||
|
||||
/**
|
||||
* This event is called whenever a player attempts to bind a
|
||||
* {@link WayofTime.bloodmagic.iface.IBindable} item.
|
||||
*
|
||||
* @param player The player doing the binding
|
||||
* @param key The UUID of the player doing the binding
|
||||
* @param itemStack The {@link ItemStack} that the player is binding
|
||||
* <p>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
*/
|
||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) {
|
||||
super();
|
||||
public ItemBindEvent(EntityPlayer player, ItemStack itemStack) {
|
||||
this.player = player;
|
||||
this.key = key;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public EntityPlayer getNewOwner() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ItemStack getBindingStack() {
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,16 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class RitualEvent extends Event {
|
||||
public final IMasterRitualStone mrs;
|
||||
public final String ownerName;
|
||||
public final UUID ownerId;
|
||||
public final Ritual ritual;
|
||||
|
||||
private RitualEvent(IMasterRitualStone mrs, String ownerName, Ritual ritual) {
|
||||
private RitualEvent(IMasterRitualStone mrs, UUID ownerId, Ritual ritual) {
|
||||
this.mrs = mrs;
|
||||
this.ownerName = ownerName;
|
||||
this.ownerId = ownerId;
|
||||
this.ritual = ritual;
|
||||
}
|
||||
|
||||
|
@ -33,8 +35,8 @@ public class RitualEvent extends Event {
|
|||
public final ItemStack crystalStack;
|
||||
public int crystalTier;
|
||||
|
||||
public RitualActivatedEvent(IMasterRitualStone mrs, String owner, Ritual ritual, EntityPlayer player, ItemStack activationCrystal, int crystalTier) {
|
||||
super(mrs, owner, ritual);
|
||||
public RitualActivatedEvent(IMasterRitualStone mrs, UUID ownerId, Ritual ritual, EntityPlayer player, ItemStack activationCrystal, int crystalTier) {
|
||||
super(mrs, ownerId, ritual);
|
||||
|
||||
this.player = player;
|
||||
this.crystalStack = activationCrystal;
|
||||
|
@ -50,8 +52,8 @@ public class RitualEvent extends Event {
|
|||
*/
|
||||
@Cancelable
|
||||
public static class RitualRunEvent extends RitualEvent {
|
||||
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual) {
|
||||
super(mrs, owner, ritual);
|
||||
public RitualRunEvent(IMasterRitualStone mrs, UUID ownerId, Ritual ritual) {
|
||||
super(mrs, ownerId, ritual);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,8 +67,8 @@ public class RitualEvent extends Event {
|
|||
|
||||
public final Ritual.BreakType method;
|
||||
|
||||
public RitualStopEvent(IMasterRitualStone mrs, String owner, Ritual ritual, Ritual.BreakType method) {
|
||||
super(mrs, owner, ritual);
|
||||
public RitualStopEvent(IMasterRitualStone mrs, UUID ownerId, Ritual ritual, Ritual.BreakType method) {
|
||||
super(mrs, ownerId, ritual);
|
||||
|
||||
this.method = method;
|
||||
}
|
||||
|
@ -76,12 +78,12 @@ public class RitualEvent extends Event {
|
|||
public static class ImperfectRitualActivatedEvent extends Event {
|
||||
|
||||
public final IImperfectRitualStone ims;
|
||||
public final String ownerName;
|
||||
public final UUID ownerId;
|
||||
public final ImperfectRitual imperfectRitual;
|
||||
|
||||
public ImperfectRitualActivatedEvent(IImperfectRitualStone ims, String ownerName, ImperfectRitual imperfectRitual) {
|
||||
public ImperfectRitualActivatedEvent(IImperfectRitualStone ims, UUID ownerId, ImperfectRitual imperfectRitual) {
|
||||
this.ims = ims;
|
||||
this.ownerName = ownerName;
|
||||
this.ownerId = ownerId;
|
||||
this.imperfectRitual = imperfectRitual;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
|||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Base event class for Soul Network related events.
|
||||
|
@ -14,17 +15,17 @@ import javax.annotation.Nullable;
|
|||
* amount of LP to be drained
|
||||
*/
|
||||
public class SoulNetworkEvent extends Event {
|
||||
public final String ownerUUID;
|
||||
public final UUID ownerUUID;
|
||||
public int syphon;
|
||||
|
||||
public SoulNetworkEvent(String ownerUUID, int syphon) {
|
||||
public SoulNetworkEvent(UUID ownerUUID, int syphon) {
|
||||
this.ownerUUID = ownerUUID;
|
||||
this.syphon = syphon;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when an
|
||||
* {@link WayofTime.bloodmagic.apibutnotreally.impl.ItemBindable} is being drained
|
||||
* {@link WayofTime.bloodmagic.iface.IBindable} is being drained
|
||||
* inside of a {@link net.minecraft.tileentity.TileEntity}.
|
||||
* <p>
|
||||
* If canceled, the drain will not be executed.
|
||||
|
@ -33,8 +34,8 @@ public class SoulNetworkEvent extends Event {
|
|||
public static class ItemDrainInContainerEvent extends SoulNetworkEvent {
|
||||
public ItemStack stack;
|
||||
|
||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon) {
|
||||
super(ownerName, syphon);
|
||||
public ItemDrainInContainerEvent(ItemStack stack, UUID ownerId, int syphon) {
|
||||
super(ownerId, syphon);
|
||||
this.stack = stack;
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +51,8 @@ public class SoulNetworkEvent extends Event {
|
|||
// If true, will damage regardless of if the network had enough inside it
|
||||
public boolean shouldDamage;
|
||||
|
||||
public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) {
|
||||
super(ownerNetwork, drainAmount);
|
||||
public PlayerDrainNetworkEvent(EntityPlayer player, UUID ownerId, int drainAmount) {
|
||||
super(ownerId, drainAmount);
|
||||
this.shouldDamage = false;
|
||||
this.player = player;
|
||||
}
|
||||
|
@ -72,12 +73,12 @@ public class SoulNetworkEvent extends Event {
|
|||
* event prevents action without penalties
|
||||
*
|
||||
* @param player Player using the item
|
||||
* @param ownerNetwork Network that the item is tied to
|
||||
* @param ownerId Network that the item is tied to
|
||||
* @param itemStack Item used
|
||||
* @param drainAmount Original drain amount - change to alter cost
|
||||
*/
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, @Nullable ItemStack itemStack, int drainAmount) {
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, UUID ownerId, @Nullable ItemStack itemStack, int drainAmount) {
|
||||
super(player, ownerId, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
this.damageAmount = (float) (drainAmount) / 100.0f;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue