mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 02:39:05 +00:00
Fix Remote Checks
This commit is contained in:
1 parent
feecf8d991
commit
25320f8de1
4 files changed
+8
-20
No files matched your search
@@ -90,7 +90,7 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tick == hitDelayTicks) {
|
||||
if (tick == hitDelayTicks && !caster.worldObj.isRemote) {
|
||||
// Calculate forward and right vectors from caster yaw
|
||||
float yawRad = (float) Math.toRadians(caster.rotationYaw);
|
||||
double forwardX = -Math.sin(yawRad);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
|
||||
@Override
|
||||
public void onExecute(EntityLivingBase caster, EntityLivingBase target) {
|
||||
if (!isPreview()) {
|
||||
if (!isPreview() && !caster.worldObj.isRemote) {
|
||||
// Shockwave is instant - apply effect immediately after windup
|
||||
|
||||
// Get all entities in radius
|
||||
|
||||
@@ -82,7 +82,7 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
pullComplete = false;
|
||||
ticksSincePullDamage = 0;
|
||||
|
||||
if (!isPreview()) {
|
||||
if (!isPreview() && !caster.worldObj.isRemote) {
|
||||
AxisAlignedBB box = caster.boundingBox.expand(pullRadius, pullRadius / 2, pullRadius);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<EntityLivingBase> entities = caster.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, box);
|
||||
@@ -145,6 +145,8 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
return;
|
||||
}
|
||||
|
||||
if (caster.worldObj.isRemote) return;
|
||||
|
||||
double destX = caster.posX;
|
||||
double destY = caster.posY;
|
||||
double destZ = caster.posZ;
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -548,6 +547,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
|
||||
|
||||
protected void doExplosion() {
|
||||
if (previewMode) return; // Skip explosion in preview mode
|
||||
if (worldObj.isRemote) return; // Explosions are server-side only
|
||||
float explosionRad = getExplosionRadius();
|
||||
if (Float.isNaN(explosionRad) || explosionRad <= 0) return;
|
||||
spawnExplosionRenderEntity(explosionRad);
|
||||
@@ -592,25 +592,11 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
|
||||
|
||||
/**
|
||||
* Explosion safety filter.
|
||||
* Reuses standard projectile-friendly checks and blocks passive non-player entities.
|
||||
* Reuses standard projectile-friendly checks (owner, faction, party).
|
||||
*/
|
||||
protected boolean shouldIgnoreExplosionTarget(EntityLivingBase target) {
|
||||
if (target == null) return true;
|
||||
if (shouldIgnoreEntity(target)) return true;
|
||||
return isPassiveNonPlayerEntity(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passive mobs (animals/ambient/water creatures) are never damaged by energy explosions.
|
||||
* Players and hostile mobs remain valid unless other friendly-fire checks reject them.
|
||||
*/
|
||||
protected boolean isPassiveNonPlayerEntity(EntityLivingBase target) {
|
||||
if (target instanceof EntityPlayer) return false;
|
||||
if (target instanceof EntityNPCInterface) return false;
|
||||
if (target.isCreatureType(EnumCreatureType.monster, false)) return false;
|
||||
return target.isCreatureType(EnumCreatureType.creature, false)
|
||||
|| target.isCreatureType(EnumCreatureType.ambient, false)
|
||||
|| target.isCreatureType(EnumCreatureType.waterCreature, false);
|
||||
return shouldIgnoreEntity(target);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user