Add entity- and tileentity-sensitive versions of Spell#canBeCastByNPCs and Spell#canBeCastByDispensers

This commit is contained in:
Electroblob77
2020-01-27 16:42:28 +00:00
parent b682740751
commit 3052e56d03
42 changed files with 160 additions and 96 deletions
@@ -14,6 +14,7 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@@ -32,9 +33,9 @@ import java.util.function.Function;
* <p></p>
* Properties added by this type of spell: {@link SpellMinion#MINION_LIFETIME}
* <p></p>
* By default, this type of spell can be cast by NPCs. {@link Spell#canBeCastByNPCs()}
* By default, this type of spell can be cast by NPCs. {@link Spell#canBeCastBy(EntityLiving, boolean)}
* <p></p>
* By default, this type of spell can be cast by dispensers. {@link Spell#canBeCastByDispensers()}
* By default, this type of spell can be cast by dispensers. {@link Spell#canBeCastBy(TileEntityDispenser)}
* <p></p>
* By default, this type of spell does not require a packet to be sent. {@link Spell#requiresPacket()}
*
@@ -80,9 +81,9 @@ public class SpellMinion<T extends EntityLiving & ISummonedCreature> extends Spe
@Override public boolean requiresPacket(){ return false; }
@Override public boolean canBeCastByNPCs(){ return true; }
@Override public boolean canBeCastBy(EntityLiving npc, boolean override){ return true; }
@Override public boolean canBeCastByDispensers() { return true; }
@Override public boolean canBeCastBy(TileEntityDispenser dispenser) { return true; }
@Override
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){