Fix various problems caused by armour stands being a subclass of EntityLivingBase
This commit is contained in:
@@ -24,6 +24,7 @@ import net.minecraft.client.renderer.VertexBuffer;
|
|||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -219,7 +220,7 @@ public final class WizardryClientEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Target selection pointer
|
// Target selection pointer
|
||||||
if(mc.player.isSneaking() && wand.getItem() instanceof ItemWand && rayTrace != null && rayTrace.entityHit instanceof EntityLivingBase
|
if(mc.player.isSneaking() && wand.getItem() instanceof ItemWand && rayTrace != null && !(event.getEntity() instanceof EntityArmorStand)
|
||||||
&& rayTrace.entityHit == event.getEntity() && properties != null && properties.selectedMinion != null){
|
&& rayTrace.entityHit == event.getEntity() && properties != null && properties.selectedMinion != null){
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
@@ -302,7 +303,7 @@ public final class WizardryClientEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sixth sense
|
// Sixth sense
|
||||||
if(mc.player.isPotionActive(WizardryPotions.sixth_sense) && event.getEntity() != mc.player
|
if(mc.player.isPotionActive(WizardryPotions.sixth_sense) && !(event.getEntity() instanceof EntityArmorStand) && event.getEntity() != mc.player
|
||||||
&& mc.player.getActivePotionEffect(WizardryPotions.sixth_sense) != null && event.getEntity().getDistanceToEntity(mc.player) < 20
|
&& mc.player.getActivePotionEffect(WizardryPotions.sixth_sense) != null && event.getEntity().getDistanceToEntity(mc.player) < 20
|
||||||
* (1 + mc.player.getActivePotionEffect(WizardryPotions.sixth_sense).getAmplifier() * Constants.RANGE_INCREASE_PER_LEVEL)){
|
* (1 + mc.player.getActivePotionEffect(WizardryPotions.sixth_sense).getAmplifier() * Constants.RANGE_INCREASE_PER_LEVEL)){
|
||||||
|
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ public class ItemWand extends Item {
|
|||||||
|
|
||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, player, 16);
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, player, 16);
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Arc extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
8 * modifiers.get(WizardryItems.range_upgrade), 4.0f);
|
8 * modifiers.get(WizardryItems.range_upgrade), 4.0f);
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
Entity target = rayTrace.entityHit;
|
Entity target = rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public class ArcaneJammer extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||||
if(entity instanceof EntityWizard) caster.addStat(WizardryAchievements.jam_wizard);
|
if(entity instanceof EntityWizard) caster.addStat(WizardryAchievements.jam_wizard);
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class Banish extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
// Left as EntityLivingBase, since it's reasonable to teleport armour stands around.
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && rayTrace.entityHit instanceof EntityLivingBase){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ public class Bubble extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
entity.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.MAGIC),
|
entity.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.MAGIC),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import electroblob.wizardry.util.WizardryParticleType;
|
|||||||
import electroblob.wizardry.util.WizardryUtilities;
|
import electroblob.wizardry.util.WizardryUtilities;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumAction;
|
import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -43,7 +44,7 @@ public class ChainLightning extends Spell {
|
|||||||
|
|
||||||
// Anything can be attacked with the initial arc, because the player has control over where it goes. If they
|
// Anything can be attacked with the initial arc, because the player has control over where it goes. If they
|
||||||
// hit a minion or an ally, it's their problem!
|
// hit a minion or an ally, it's their problem!
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
Entity target = rayTrace.entityHit;
|
Entity target = rayTrace.entityHit;
|
||||||
|
|
||||||
@@ -79,6 +80,8 @@ public class ChainLightning extends Spell {
|
|||||||
|
|
||||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
||||||
target.posX, target.posY + target.height / 2, target.posZ, world);
|
target.posX, target.posY + target.height / 2, target.posZ, world);
|
||||||
|
|
||||||
|
secondaryTargets.removeIf(e -> e instanceof EntityArmorStand);
|
||||||
|
|
||||||
for(int i = 0; i < Math.min(secondaryTargets.size(), 5); i++){
|
for(int i = 0; i < Math.min(secondaryTargets.size(), 5); i++){
|
||||||
|
|
||||||
@@ -122,6 +125,8 @@ public class ChainLightning extends Spell {
|
|||||||
List<EntityLivingBase> tertiaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
List<EntityLivingBase> tertiaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
||||||
secondaryTarget.posX, secondaryTarget.posY + secondaryTarget.height / 2,
|
secondaryTarget.posX, secondaryTarget.posY + secondaryTarget.height / 2,
|
||||||
secondaryTarget.posZ, world);
|
secondaryTarget.posZ, world);
|
||||||
|
|
||||||
|
tertiaryTargets.removeIf(e -> e instanceof EntityArmorStand);
|
||||||
|
|
||||||
for(int j = 0; j < Math.min(tertiaryTargets.size(), 2); j++){
|
for(int j = 0; j < Math.min(tertiaryTargets.size(), 2); j++){
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class CurseOfSoulbinding extends Spell {
|
|||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase && WizardData.get(caster) != null){
|
&& WizardryUtilities.isLiving(rayTrace.entityHit) && WizardData.get(caster) != null){
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
if(!WizardData.get(caster).soulbind(target)) return false;
|
if(!WizardData.get(caster).soulbind(target)) return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ public class Entrapment extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase entity = (EntityLivingBase)rayTrace.entityHit;
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
entity.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.MAGIC),
|
entity.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.MAGIC),
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class Firestorm extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
// Fire can damage armour stands.
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && rayTrace.entityHit instanceof EntityLivingBase){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class FlameRay extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
// Fire can damage armour stands
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && rayTrace.entityHit instanceof EntityLivingBase){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ public class Freeze extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ public class FrostRay extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class HealAlly extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade), 8.0f);
|
10 * modifiers.get(WizardryItems.range_upgrade), 8.0f);
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
if(target.getHealth() < target.getMaxHealth()){
|
if(target.getHealth() < target.getMaxHealth()){
|
||||||
target.heal((int)(5 * modifiers.get(SpellModifiers.DAMAGE)));
|
target.heal((int)(5 * modifiers.get(SpellModifiers.DAMAGE)));
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class Ignite extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
// Fire can damage armour stands
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && rayTrace.entityHit instanceof EntityLivingBase){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class LifeDrain extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class LightningRay extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade), 2.0f);
|
10 * modifiers.get(WizardryItems.range_upgrade), 2.0f);
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
Entity target = rayTrace.entityHit;
|
Entity target = rayTrace.entityHit;
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
// This statement means the arc only spawns every other tick.
|
// This statement means the arc only spawns every other tick.
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ public class LightningWeb extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade), 2.0f);
|
10 * modifiers.get(WizardryItems.range_upgrade), 2.0f);
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
Entity target = rayTrace.entityHit;
|
Entity target = rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import electroblob.wizardry.util.WizardryParticleType;
|
|||||||
import electroblob.wizardry.util.WizardryUtilities;
|
import electroblob.wizardry.util.WizardryUtilities;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.monster.EntityCaveSpider;
|
import net.minecraft.entity.monster.EntityCaveSpider;
|
||||||
import net.minecraft.entity.monster.EntityMagmaCube;
|
import net.minecraft.entity.monster.EntityMagmaCube;
|
||||||
import net.minecraft.entity.monster.EntityPigZombie;
|
import net.minecraft.entity.monster.EntityPigZombie;
|
||||||
@@ -45,7 +44,7 @@ public class Metamorphosis extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
Entity entityHit = rayTrace.entityHit;
|
Entity entityHit = rayTrace.entityHit;
|
||||||
double xPos = entityHit.posX;
|
double xPos = entityHit.posX;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import net.minecraft.entity.EntityLiving;
|
|||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.INpc;
|
import net.minecraft.entity.INpc;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumAction;
|
import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -50,7 +51,7 @@ public class MindControl extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
8 * modifiers.get(WizardryItems.range_upgrade));
|
8 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
@@ -165,6 +166,7 @@ public class MindControl extends Spell {
|
|||||||
target.posX, target.posY, target.posZ, world);
|
target.posX, target.posY, target.posZ, world);
|
||||||
|
|
||||||
possibleTargets.remove(target);
|
possibleTargets.remove(target);
|
||||||
|
possibleTargets.removeIf(e -> e instanceof EntityArmorStand);
|
||||||
|
|
||||||
EntityLivingBase newAITarget = null;
|
EntityLivingBase newAITarget = null;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class MindTrick extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
8 * modifiers.get(WizardryItems.range_upgrade));
|
8 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ public class Poison extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
// Has no effect on undead or spiders.
|
// Has no effect on undead or spiders.
|
||||||
if(MagicDamage.isEntityImmune(DamageType.POISON, target)){
|
if(MagicDamage.isEntityImmune(DamageType.POISON, target)){
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class Slime extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
8 * modifiers.get(WizardryItems.range_upgrade));
|
8 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.entityHit != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit != null && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class Whirlwind extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
|
// Left as EntityLivingBase because why not be able to move armour stands around?
|
||||||
if(rayTrace != null && rayTrace.entityHit instanceof EntityLivingBase){
|
if(rayTrace != null && rayTrace.entityHit instanceof EntityLivingBase){
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ public class Wither extends Spell {
|
|||||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(world, caster,
|
||||||
10 * modifiers.get(WizardryItems.range_upgrade));
|
10 * modifiers.get(WizardryItems.range_upgrade));
|
||||||
|
|
||||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY
|
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.ENTITY && WizardryUtilities.isLiving(rayTrace.entityHit)){
|
||||||
&& rayTrace.entityHit instanceof EntityLivingBase){
|
|
||||||
|
|
||||||
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
EntityLivingBase target = (EntityLivingBase)rayTrace.entityHit;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import net.minecraft.block.state.IBlockState;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
import net.minecraft.entity.monster.EntityCreeper;
|
import net.minecraft.entity.monster.EntityCreeper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
@@ -485,6 +486,19 @@ public final class WizardryUtilities {
|
|||||||
public static boolean isPlayerOp(EntityPlayer player, MinecraftServer server){
|
public static boolean isPlayerOp(EntityPlayer player, MinecraftServer server){
|
||||||
return server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null;
|
return server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given entity is an EntityLivingBase and not an armour stand; makes the code a bit neater.
|
||||||
|
* This was added because armour stands are a subclass of EntityLivingBase, but shouldn't necessarily be treated
|
||||||
|
* as living entities - this depends on the situation. <i>The given entity can safely be cast to EntityLivingBase
|
||||||
|
* if this method returns true.</i>
|
||||||
|
*/
|
||||||
|
// In my opinion, it's a bad design choice to have armour stands extend EntityLivingBase directly - it would be
|
||||||
|
// better to make a parent class which is extended by both armour stands and EntityLivingBase and contains only
|
||||||
|
// the code required by both.
|
||||||
|
public static boolean isLiving(Entity entity){
|
||||||
|
return entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns the given creeper into a charged creeper. In 1.10, this requires reflection since the DataManager keys are
|
* Turns the given creeper into a charged creeper. In 1.10, this requires reflection since the DataManager keys are
|
||||||
|
|||||||
Reference in New Issue
Block a user