Skip to content
Permalink
Browse files

Fixed some issues with trilobites.

  • Loading branch information...
Ri5ux committed Mar 14, 2019
1 parent 8d6f852 commit 5395ce1b0023eb2028cb3629e4c4aa2f196998e6
@@ -10,7 +10,6 @@
import com.asx.mdx.lib.client.util.models.Model;
import com.asx.mdx.lib.util.Game;

import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.EntityLivingBase;

@@ -857,16 +856,6 @@ public void render(EntityTrilobite trilobite)

if (this.isRiding)
{
if (trilobite.getRidingEntity() != null)
{
EntityLivingBase riding = (EntityLivingBase) trilobite.getRidingEntity();

if (riding instanceof EntityPlayerSP)
{
// OpenGL.rotate(32F, 0, 1, 0);
}
}

OpenGL.rotate(180F, 0, 1, 0);
OpenGL.translate(0F, 0F, 0.25F);

@@ -16,7 +16,6 @@
import org.avp.world.capabilities.IOrganism.Provider;

import com.asx.mdx.MDX;
import com.asx.mdx.core.network.server.PacketAnimationPause;
import com.asx.mdx.lib.world.entity.Entities;
import com.asx.mdx.lib.world.entity.animations.Animation;
import com.asx.mdx.lib.world.entity.animations.AnimationHandler;
@@ -49,6 +48,7 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

@@ -124,7 +124,7 @@ public boolean apply(EntityLivingBase potentialTarget)
public EntityTrilobite(World world)
{
super(world);
this.setSize(2.5F, 1.98F);
this.setSize(3F, 1.98F);
this.experienceValue = 32;
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(3, new EntityAICustomAttackOnCollide(this, 0.800000011920929D, true));
@@ -189,11 +189,10 @@ public void onUpdate()

if (this.collidedHorizontally)
{
// this.motionY += 0.25F;
this.motionY += 0.25F;
}

this.fallDistance = 0F;

this.jumpMovementFactor = 1.0F;
if (this.world.getWorldTime() % 20 == 0)
{
if (isFertile())
@@ -225,26 +224,41 @@ public void onUpdate()
{
EntityLiving living = (EntityLiving) this.getRidingEntity();

living.rotationYawHead = 0;
living.rotationYaw = 0;
living.prevRotationYawHead = 0;
living.prevRotationYaw = 0;

this.rotationYawHead = 0;
this.rotationYaw = 0;
this.prevRotationYawHead = 0;
this.prevRotationYaw = 0;

EntityMoveHelper newMoveHelper = new EntityMoveHelper(living) {
public void onUpdateMoveHelper()
{
;
}
};
MDX.access().setMoveHelper(living, newMoveHelper);
MDX.access().setMoveHelper(this, newMoveHelper);

EntityLookHelper newLookHelper = new EntityLookHelper(living) {
public void setLookPosition(double x, double y, double z, float deltaYaw, float deltaPitch)
{
;
}
public void setLookPositionWithEntity(Entity entityIn, float deltaYaw, float deltaPitch)
{
;
}
public float updateRotation(float x, float y, float z)
{
return 0F;
}
};
MDX.access().setLookHelper(living, newLookHelper);

this.rotationYawHead = living.rotationYawHead;
this.rotationYaw = living.rotationYaw;
this.prevRotationYawHead = living.prevRotationYawHead;
this.prevRotationYaw = living.prevRotationYaw;
MDX.access().setLookHelper(this, newLookHelper);
}
}

@@ -265,36 +279,28 @@ public float updateRotation(float x, float y, float z)
this.detachFromHost();
}
}

if (this.getAttackTarget() != null)
{
if (this.getActiveAnimation() == ANIMATION_HUG_WALL)
{
if (this.getAnimationTick() > ANIMATION_HUG_WALL.getDuration() / 2)
{
// if (this.world.getWorldTime() % 10 == 0)
// AliensVsPredator.network().sendToServer(new PacketAnimationPause(this.getEntityId(), true));
}
// this.playAnimation();
// System.out.println(this.getAnimationTick());
// System.out.println(this.world.isRemote);

Entity entityIn = this.getAttackTarget();
float angle = (float) (MathHelper.atan2(entityIn.posZ - this.posZ, entityIn.posX - this.posX) * (180D / Math.PI)) - 90.0F;
angle = MathHelper.floor((angle / 90) + 0.5) * 90F;
this.rotationYaw = angle;
this.moveRelative(0F, 0F, 0.03F, 0.1F);
}

if ((this.collidedHorizontally) && this.getActiveAnimation() == NO_ANIMATION)

double distanceX = this.prevPosX - this.posX;
double distanceZ = this.prevPosZ - this.posZ;

double motion = distanceX * distanceZ;

if ((this.collidedHorizontally) && this.getActiveAnimation() == NO_ANIMATION && Math.abs(motion) < 0.3D && Math.abs(motion) > 0.0D)
{
AnimationHandler.INSTANCE.sendAnimationMessage(this, ANIMATION_HUG_WALL);
}
}

if (this.getRidingEntity() != null)
this.getRidingEntity().setDead();

if (this.getRidingEntity() == null && this.getActiveAnimation() == IMPREGNATION_ANIMATION)
{
this.setActiveAnimation(NO_ANIMATION);
@@ -362,7 +368,7 @@ protected boolean canTriggerWalking()
@Override
public boolean isOnLadder()
{
return false;
return this.motionY > 1.0099999997764826D;
}

public boolean isClimbing()

0 comments on commit 5395ce1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.