Miscellaneous setup

This commit is contained in:
Electroblob
2018-01-30 16:02:13 +00:00
parent da6b007a3a
commit 2af7329478
59 changed files with 1833 additions and 13509 deletions
@@ -7,10 +7,9 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* [NYI] DiscoverSpellEvent is fired when a player discovers a spell by any method.<br>
* DiscoverSpellEvent is fired when a player discovers a spell by any method.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the spell is not discovered.<br>
* This event is {@link Cancelable}. If this event is canceled, the spell is not discovered.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
@@ -21,15 +20,30 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
*/
public class DiscoverSpellEvent extends PlayerEvent {
private final Spell spell;
private final Source source;
public DiscoverSpellEvent(EntityPlayer player, Spell spell, Source source) {
super(player);
this.spell = spell;
this.source = source;
}
/** Returns the spell that is being discovered. */
public Spell getSpell(){
return spell;
}
/** Returns the method used to discover the spell. */
public Source getSource(){
return source;
}
public enum Source {
/** Signifies that the spell was discovered by trying to cast it. */ CASTING,
/** Signifies that the spell was discovered using a scroll of identification. */ IDENTIFICATION_SCROLL,
/** Signifies that the spell was discovered using commands. */ COMMAND,
/** Signifies that the spell was discovered by some other means (. */ OTHER
/** Signifies that the spell was discovered by some other means. */ OTHER
}
}
}
@@ -1,16 +1,18 @@
package electroblob.wizardry.event;
import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
/**
* [NYI] SpellBindEvent is fired when a player presses the apply button in the arcane workbench.<br>
* SpellBindEvent is fired when a player presses the apply button in the arcane workbench. <i>Note that this
* event is only fired on the server side.</i><br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, no further processing takes place: spells are not bound, upgrades are not applied and
* crystals are not consumed.<br>
* This event is {@link Cancelable}. If this event is canceled, no further processing takes place: spells are not bound,
* upgrades are not applied and crystals are not consumed.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
@@ -19,10 +21,11 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
* @author Electroblob
* @since Wizardry 2.1
*/
public class SpellBindEvent extends PlayerEvent {
@Cancelable
public class SpellBindEvent extends PlayerContainerEvent {
public SpellBindEvent(EntityPlayer player) {
super(player);
public SpellBindEvent(EntityPlayer player, ContainerArcaneWorkbench container) {
super(player, container);
}
}
}
@@ -1,12 +1,17 @@
package electroblob.wizardry.event;
import electroblob.wizardry.entity.living.ISpellCaster;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.SpellModifiers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* [NYI] SpellCastEvent is the parent event class for all spell casting events.<br>
* SpellCastEvent is the parent event class for all spell casting events. Methods which subscribe to this event
* will receive all three child events (it is recommended that you use {@link SpellCastEvent.Pre},
* {@link SpellCastEvent.Post} or {@link SpellCastEvent.Tick}, depending on the application).<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*
@@ -14,9 +19,121 @@ import net.minecraftforge.event.entity.living.LivingEvent;
* @since Wizardry 2.1
*/
public abstract class SpellCastEvent extends LivingEvent {
private final Spell spell;
private final SpellModifiers modifiers;
private final Source source;
public SpellCastEvent(EntityLivingBase entity, Spell spell) {
super(entity);
public SpellCastEvent(EntityLivingBase caster, Spell spell, SpellModifiers modifiers, Source source) {
super(caster);
this.spell = spell;
this.modifiers = modifiers;
this.source = source;
}
/** Returns the spell being cast. */
public Spell getSpell(){
return spell;
}
/** Returns the modifiers for the spell being cast. */
public SpellModifiers getModifiers(){
return modifiers;
}
/** Returns the source of the spell being cast. */
public Source getSource(){
return source;
}
public enum Source {
/** Signifies that the spell was cast using a wand. */ WAND,
/** Signifies that the spell was cast using a scroll. */ SCROLL,
/** Signifies that the spell was cast using commands. */ COMMAND,
/** Signifies that the spell was cast by an {@link ISpellCaster}. */ NPC,
/** Signifies that the spell was cast by some other means. */ OTHER
}
/**
* SpellCastEvent.Pre is fired just before a spell is cast. Use this event to change the spell modifiers and
* generally alter the behaviour of the spell, or stop it from being cast entirely. For example, wizardry uses this
* event to cancel spells cast by entities that have the arcane jammer effect. Note that for wands, this is called
* <i>before</i> mana, tier and cooldowns are checked. Also note that this event is only fired once for continuous
* spells, when they start casting.<br>
* <br>
* This event is {@link Cancelable}. If this event is canceled, the spell is not cast, mana is not consumed, and the
* right-click action that caused it (if any) returns a result of FAIL, meaning that the right-click is passed to
* the block/entity in front of the player, if any.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*
* @author Electroblob
* @since Wizardry 2.1
*/
@Cancelable
public static class Pre extends SpellCastEvent {
public Pre(EntityLivingBase caster, Spell spell, SpellModifiers modifiers, Source source) {
super(caster, spell, modifiers, source);
}
}
/**
* SpellCastEvent.Post is fired just after a spell is cast. Use this event for any processing which depends
* on whether the spell succeeds, and does not affect the spell itself. For example, wizardry uses this event
* to keep track of spellcasting stats. Note that although this event is fired from both sides, it is not fired from
* common code; rather, both sides fire it separately, so timing is not guaranteed. Also note that this event is
* only fired once for continuous spells, after the first casting tick.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*
* @author Electroblob
* @since Wizardry 2.1
*/
public static class Post extends SpellCastEvent {
public Post(EntityLivingBase caster, Spell spell, SpellModifiers modifiers, Source source) {
super(caster, spell, modifiers, source);
}
}
/**
* SpellCastEvent.Tick is fired each tick while a continuous spell is being cast.<br>
* <br>
* This event is {@link Cancelable}. If this event is canceled, the spell is not cast, mana is not consumed, and the
* spell casting is interrupted. Cancelling this event on the client side will stop particles being spawned, but
* will not interrupt spell casting.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
*
* @author Electroblob
* @since Wizardry 2.1
*/
@Cancelable
public static class Tick extends SpellCastEvent {
private final int count;
public Tick(EntityLivingBase caster, Spell spell, SpellModifiers modifiers, Source source, int count) {
super(caster, spell, modifiers, source);
this.count = count;
}
/** Returns the number of ticks this (continuous) spell has already been cast for. */
public int getCount(){
return count;
}
}
}