Merge apibutnotreally with the main packages
Do not consider anything outside of the true API safe to use. And even then, I'm changing things. Just wait. Please I beg you.
This commit is contained in:
parent
616c08094b
commit
2fecb427fd
399 changed files with 958 additions and 977 deletions
|
@ -0,0 +1,26 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class AddToNetworkEvent extends Event {
|
||||
public final String ownerNetwork;
|
||||
public int addedAmount;
|
||||
public int maximum;
|
||||
|
||||
/**
|
||||
* This event is called whenever the network is added to. If cancelled, no
|
||||
* LP will be drained from the source. If result is set to Result.DENY, the
|
||||
* LP will still be drained but the soul network will not be added to.
|
||||
*
|
||||
* @param ownerNetwork Key used for the soul network
|
||||
* @param addedAmount Amount added
|
||||
* @param maximum Ceiling that the network can add to
|
||||
*/
|
||||
public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) {
|
||||
this.ownerNetwork = ownerNetwork;
|
||||
this.addedAmount = addedAmount;
|
||||
this.maximum = maximum;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import WayofTime.bloodmagic.core.registry.AltarRecipeRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Fired whenever a craft is completed in a BloodAltar.
|
||||
* <p>
|
||||
* It is not cancelable, however you can modify the output stack.
|
||||
*/
|
||||
public class AltarCraftedEvent extends Event {
|
||||
|
||||
private final AltarRecipeRegistry.AltarRecipe altarRecipe;
|
||||
private final ItemStack output;
|
||||
|
||||
/**
|
||||
* @param altarRecipe - The recipe that was crafted.
|
||||
* @param output - The item obtained from the recipe
|
||||
*/
|
||||
public AltarCraftedEvent(AltarRecipeRegistry.AltarRecipe altarRecipe, ItemStack output) {
|
||||
this.altarRecipe = altarRecipe;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public AltarRecipeRegistry.AltarRecipe getAltarRecipe() {
|
||||
return altarRecipe;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
50
src/main/java/WayofTime/bloodmagic/event/BoundToolEvent.java
Normal file
50
src/main/java/WayofTime/bloodmagic/event/BoundToolEvent.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class BoundToolEvent extends Event {
|
||||
public EntityPlayer player;
|
||||
|
||||
public BoundToolEvent(EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a
|
||||
* {@link WayofTime.bloodmagic.item.ItemBoundTool} is being charged.
|
||||
* <p>
|
||||
* If canceled, will result in the charging being canceled.
|
||||
*/
|
||||
|
||||
@Cancelable
|
||||
public static class Charge extends BoundToolEvent {
|
||||
public ItemStack result;
|
||||
|
||||
public Charge(EntityPlayer player, ItemStack result) {
|
||||
super(player);
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a
|
||||
* {@link WayofTime.bloodmagic.item.ItemBoundTool}'s charge is released.
|
||||
* <p>
|
||||
* If canceled, will result in the charge not being released.
|
||||
*/
|
||||
|
||||
@Cancelable
|
||||
public static class Release extends BoundToolEvent {
|
||||
public final ItemStack boundTool;
|
||||
public int charge;
|
||||
|
||||
public Release(EntityPlayer player, ItemStack boundTool, int charge) {
|
||||
super(player);
|
||||
this.boundTool = boundTool;
|
||||
this.charge = charge;
|
||||
}
|
||||
}
|
||||
}
|
30
src/main/java/WayofTime/bloodmagic/event/ItemBindEvent.java
Normal file
30
src/main/java/WayofTime/bloodmagic/event/ItemBindEvent.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ItemBindEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public String key;
|
||||
public 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();
|
||||
this.player = player;
|
||||
this.key = key;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
}
|
88
src/main/java/WayofTime/bloodmagic/event/RitualEvent.java
Normal file
88
src/main/java/WayofTime/bloodmagic/event/RitualEvent.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import WayofTime.bloodmagic.ritual.data.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.ritual.data.Ritual;
|
||||
import WayofTime.bloodmagic.ritual.data.imperfect.IImperfectRitualStone;
|
||||
import WayofTime.bloodmagic.ritual.data.imperfect.ImperfectRitual;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class RitualEvent extends Event {
|
||||
public final IMasterRitualStone mrs;
|
||||
public final String ownerName;
|
||||
public final Ritual ritual;
|
||||
|
||||
private RitualEvent(IMasterRitualStone mrs, String ownerName, Ritual ritual) {
|
||||
this.mrs = mrs;
|
||||
this.ownerName = ownerName;
|
||||
this.ritual = ritual;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a ritual is activated. If cancelled, it will
|
||||
* not activate.
|
||||
* <p>
|
||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#activateRitual(ItemStack, EntityPlayer, Ritual)}
|
||||
*/
|
||||
@Cancelable
|
||||
public static class RitualActivatedEvent extends RitualEvent {
|
||||
public final EntityPlayer player;
|
||||
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);
|
||||
|
||||
this.player = player;
|
||||
this.crystalStack = activationCrystal;
|
||||
this.crystalTier = crystalTier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a Ritual effect is performed. If cancelled, the
|
||||
* effect will not happen.
|
||||
* <p>
|
||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#performRitual(World, net.minecraft.util.math.BlockPos)}
|
||||
*/
|
||||
@Cancelable
|
||||
public static class RitualRunEvent extends RitualEvent {
|
||||
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual) {
|
||||
super(mrs, owner, ritual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a Ritual is stopped by a
|
||||
* {@link Ritual.BreakType}.
|
||||
* <p>
|
||||
* {@link WayofTime.bloodmagic.tile.TileMasterRitualStone#stopRitual(Ritual.BreakType)}
|
||||
*/
|
||||
public static class RitualStopEvent extends RitualEvent {
|
||||
|
||||
public final Ritual.BreakType method;
|
||||
|
||||
public RitualStopEvent(IMasterRitualStone mrs, String owner, Ritual ritual, Ritual.BreakType method) {
|
||||
super(mrs, owner, ritual);
|
||||
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class ImperfectRitualActivatedEvent extends Event {
|
||||
|
||||
public final IImperfectRitualStone ims;
|
||||
public final String ownerName;
|
||||
public final ImperfectRitual imperfectRitual;
|
||||
|
||||
public ImperfectRitualActivatedEvent(IImperfectRitualStone ims, String ownerName, ImperfectRitual imperfectRitual) {
|
||||
this.ims = ims;
|
||||
this.ownerName = ownerName;
|
||||
this.imperfectRitual = imperfectRitual;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class SacrificeKnifeUsedEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public final int healthDrained;
|
||||
public int lpAdded;
|
||||
public boolean shouldDrainHealth;
|
||||
public boolean shouldFillAltar;
|
||||
|
||||
/**
|
||||
* This event is called whenever a player attempts to use a
|
||||
* {@link WayofTime.bloodmagic.item.ItemSacrificialDagger} to self-sacrifice
|
||||
* near an altar.
|
||||
*
|
||||
* @param player The player doing the sacrificing
|
||||
* @param shouldDrainHealth Determines whether or not health is lost
|
||||
* @param shouldFillAltar Determines whether or not an altar should be filled
|
||||
* @param hp Amount of health lost
|
||||
* @param lpAdded Amount of LP added to the altar
|
||||
* <p>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
*/
|
||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp, int lpAdded) {
|
||||
this.player = player;
|
||||
this.shouldDrainHealth = shouldDrainHealth;
|
||||
this.shouldFillAltar = shouldFillAltar;
|
||||
this.healthDrained = hp;
|
||||
this.lpAdded = lpAdded;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.
|
||||
* <p>
|
||||
* {@link #ownerUUID} contains the owner's UUID {@link #syphon} contains the
|
||||
* amount of LP to be drained
|
||||
*/
|
||||
public class SoulNetworkEvent extends Event {
|
||||
public final String ownerUUID;
|
||||
public int syphon;
|
||||
|
||||
public SoulNetworkEvent(String ownerUUID, int syphon) {
|
||||
this.ownerUUID = ownerUUID;
|
||||
this.syphon = syphon;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when an
|
||||
* {@link WayofTime.bloodmagic.apibutnotreally.impl.ItemBindable} is being drained
|
||||
* inside of a {@link net.minecraft.tileentity.TileEntity}.
|
||||
* <p>
|
||||
* If canceled, the drain will not be executed.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class ItemDrainInContainerEvent extends SoulNetworkEvent {
|
||||
public ItemStack stack;
|
||||
|
||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon) {
|
||||
super(ownerName, syphon);
|
||||
this.stack = stack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is called when a {@link EntityPlayer} drains the Soul Network
|
||||
* <p>
|
||||
* If canceled, the drain will not be executed.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent {
|
||||
public final EntityPlayer player;
|
||||
// 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);
|
||||
this.shouldDamage = false;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent {
|
||||
@Nullable
|
||||
public final ItemStack itemStack;
|
||||
/**
|
||||
* Amount of damage that would incur if the network could not drain
|
||||
* properly
|
||||
*/
|
||||
public float damageAmount;
|
||||
|
||||
/**
|
||||
* Set result to deny the action i.e. damage/drain anyways. Cancelling
|
||||
* event prevents action without penalties
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, @Nullable ItemStack itemStack, int drainAmount) {
|
||||
super(player, ownerNetwork, drainAmount);
|
||||
this.itemStack = itemStack;
|
||||
this.damageAmount = (float) (drainAmount) / 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
78
src/main/java/WayofTime/bloodmagic/event/TeleposeEvent.java
Normal file
78
src/main/java/WayofTime/bloodmagic/event/TeleposeEvent.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package WayofTime.bloodmagic.event;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Fired when a teleposer attempts to transpose two blocks. Use this to perform
|
||||
* special cleanup or compensation, or cancel it entirely to prevent the
|
||||
* transposition.
|
||||
*/
|
||||
@Cancelable
|
||||
public class TeleposeEvent extends Event {
|
||||
public final World initalWorld;
|
||||
public final BlockPos initialBlockPos;
|
||||
public final IBlockState initialState;
|
||||
|
||||
public final World finalWorld;
|
||||
public final BlockPos finalBlockPos;
|
||||
public final IBlockState finalState;
|
||||
|
||||
public TeleposeEvent(World initialWorld, BlockPos initialBlockPos, World finalWorld, BlockPos finalBlockPos) {
|
||||
this.initalWorld = initialWorld;
|
||||
this.initialBlockPos = initialBlockPos;
|
||||
this.initialState = initialWorld.getBlockState(initialBlockPos);
|
||||
|
||||
this.finalWorld = finalWorld;
|
||||
this.finalBlockPos = finalBlockPos;
|
||||
this.finalState = finalWorld.getBlockState(finalBlockPos);
|
||||
}
|
||||
|
||||
public TileEntity getInitialTile() {
|
||||
return initalWorld.getTileEntity(initialBlockPos);
|
||||
}
|
||||
|
||||
public TileEntity getFinalTile() {
|
||||
return finalWorld.getTileEntity(finalBlockPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a Teleposer attempts to move an Entity between locations. Can
|
||||
* be cancelled to stop transposition.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class Ent extends TeleposeEvent {
|
||||
public final Entity entity;
|
||||
|
||||
public Ent(Entity entity, World initialWorld, BlockPos initialBlockPos, World finalWorld, BlockPos finalBlockPos) {
|
||||
super(initialWorld, initialBlockPos, finalWorld, finalBlockPos);
|
||||
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getInitialTile() throws IllegalArgumentException {
|
||||
throw new IllegalArgumentException("Attempted to get a TileEntity from an Entity Telepose Event.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getFinalTile() throws IllegalArgumentException {
|
||||
throw new IllegalArgumentException("Attempted to get a TileEntity from an Entity Telepose Event.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the entity has been transposed.
|
||||
*/
|
||||
public static class Post extends Ent {
|
||||
|
||||
public Post(Entity entity, World initialWorld, BlockPos initialBlockPos, World finalWorld, BlockPos finalBlockPos) {
|
||||
super(entity, initialWorld, initialBlockPos, finalWorld, finalBlockPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue