Fixed barriers not allowing ally players in (#868)
Had to edit telekinesis because it was had errors do to syntax. See comments in forcefield class for more information Co-authored-by: WinDanesz <31292708+WinDanesz@users.noreply.github.com>
This commit is contained in:
@@ -146,7 +146,12 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
|||||||
if(EntityUtils.isLiving(target)) nudgeVelocity = 0.25;
|
if(EntityUtils.isLiving(target)) nudgeVelocity = 0.25;
|
||||||
Vec3d extraVelocity = targetRelativePos.normalize().scale(nudgeVelocity);
|
Vec3d extraVelocity = targetRelativePos.normalize().scale(nudgeVelocity);
|
||||||
|
|
||||||
|
//Moved up the check by "19" so that way allied players aren't being moved out of the forcefield because
|
||||||
|
//allied players aren't synced to client like minions. Minions are only synced because it's saved to their
|
||||||
|
//entity data which is synced in their serialize/deserialize methods
|
||||||
|
if(!world.isRemote){
|
||||||
// ...make it bounce off!
|
// ...make it bounce off!
|
||||||
|
|
||||||
target.motionX = target.motionX * -BOUNCINESS + extraVelocity.x;
|
target.motionX = target.motionX * -BOUNCINESS + extraVelocity.x;
|
||||||
target.motionY = target.motionY * -BOUNCINESS + extraVelocity.y;
|
target.motionY = target.motionY * -BOUNCINESS + extraVelocity.y;
|
||||||
target.motionZ = target.motionZ * -BOUNCINESS + extraVelocity.z;
|
target.motionZ = target.motionZ * -BOUNCINESS + extraVelocity.z;
|
||||||
@@ -162,7 +167,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
|||||||
world.playSound(target.posX, target.posY, target.posZ, WizardrySounds.ENTITY_FORCEFIELD_DEFLECT,
|
world.playSound(target.posX, target.posY, target.posZ, WizardrySounds.ENTITY_FORCEFIELD_DEFLECT,
|
||||||
WizardrySounds.SPELLS, 0.3f, 1.3f, false);
|
WizardrySounds.SPELLS, 0.3f, 1.3f, false);
|
||||||
|
|
||||||
if(!world.isRemote){
|
|
||||||
// Player motion is handled on that player's client so needs packets
|
// Player motion is handled on that player's client so needs packets
|
||||||
if(target instanceof EntityPlayerMP){
|
if(target instanceof EntityPlayerMP){
|
||||||
((EntityPlayerMP)target).connection.sendPacket(new SPacketEntityVelocity(target));
|
((EntityPlayerMP)target).connection.sendPacket(new SPacketEntityVelocity(target));
|
||||||
@@ -174,6 +179,11 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
//This is a super lazy way to make sure the visual isn't playing for players and probably won't display the visual
|
||||||
|
//for players if their velocity towards the forcefield is high. But it prevents the visual being spammed when ally player
|
||||||
|
//is in forcefield so it's fine #19
|
||||||
|
if(target instanceof EntityPlayer && target.getPositionVector().distanceTo(this.getPositionVector()) < this.getRadius()) return;
|
||||||
|
|
||||||
Vec3d relativeImpactPos = targetRelativePos.normalize().scale(radius);
|
Vec3d relativeImpactPos = targetRelativePos.normalize().scale(radius);
|
||||||
|
|
||||||
float yaw = (float)Math.atan2(relativeImpactPos.x, -relativeImpactPos.z);
|
float yaw = (float)Math.atan2(relativeImpactPos.x, -relativeImpactPos.z);
|
||||||
|
|||||||
Reference in New Issue
Block a user