Skip to content
Permalink
Browse files

APC Improvements. Still de-syncs

  • Loading branch information
Ri5ux committed Mar 25, 2020
1 parent ee2e0b2 commit e7c0071fc216158c15a3d652d41f7ecfce9d996d
@@ -143,7 +143,6 @@ protected ResourceLocation getEntityTexture(EntityAPC entityIn)
public void doRender(EntityAPC apc, double posX, double posY, double posZ, float yaw, float partialTicks)
{
float scale = 1F;
float curVelocity = (float) Math.sqrt(apc.motionX * apc.motionX + apc.motionZ * apc.motionZ);
float tireRotation = apc.getTireRotation();
float time = (float) apc.getTimeSinceHit() - partialTicks;
float damage = apc.getDamageTaken() - partialTicks;
@@ -194,8 +193,6 @@ else if (model.getPart("Mesh114_APCSdDr1_Model") == p
|| model.getPart("Mesh221_APCHndPt1_Model") == p)
{
OpenGL.pushMatrix();
float doorProgress = (float) (-1.25 * Game.minecraft().world.getTotalWorldTime() % 315 / 100);
// OpenGL.translate(Math.sin(doorProgress), 0, 0);
p.draw();
OpenGL.popMatrix();
} else if (isPartATire(p))
@@ -13,6 +13,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
@@ -53,7 +54,6 @@ public EntityAPC(World worldIn)
this.setSize(3F, 2F);
this.ignoreFrustumCheck = true;
this.stepHeight = 1.0F;
this.updateBlocked = false;
}

@Override
@@ -418,7 +418,7 @@ else if (driver.moveStrafing < 0)
// this.motionY = 0;
// this.motionZ = 0;
// }

this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.65D;
this.motionY *= 0.94D;
@@ -501,7 +501,7 @@ public void updateRidden()
@Override
public float getCollisionBorderSize()
{
return 9F;
return 0F;
}

@Override
@@ -1,22 +1,16 @@
package org.avp.item;

import java.util.List;

import org.avp.entities.EntityAPC;

import com.asx.mdx.lib.util.Game;
import com.asx.mdx.lib.world.item.HookedItem;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -29,11 +23,11 @@ public ItemAPC()
this.maxStackSize = 1;
this.setCreativeTab(CreativeTabs.TRANSPORTATION);
}

@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
{
float partialTicks = 1.0F;
float partialTicks = Game.partialTicks();
float pitch = playerIn.prevRotationPitch + (playerIn.rotationPitch - playerIn.prevRotationPitch) * partialTicks;
float yaw = playerIn.prevRotationYaw + (playerIn.rotationYaw - playerIn.prevRotationYaw) * partialTicks;
double dX = playerIn.prevPosX + (playerIn.posX - playerIn.prevPosX) * (double) partialTicks;
@@ -54,79 +48,21 @@ public ItemAPC()
{
return new ActionResult<ItemStack>(EnumActionResult.FAIL, playerIn.getActiveItemStack());
}
else
else if (result.typeOfHit == RayTraceResult.Type.BLOCK)
{
Vec3d look = playerIn.getLook(partialTicks);
boolean flag = false;
float f9 = 1.0F;
List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().expand(look.x * range, look.y * range, look.z * range).expand((double) f9, (double) f9, (double) f9));

for (int idx = 0; idx < list.size(); ++idx)
{
Entity entity = (Entity) list.get(idx);
int hitX = (int) result.hitVec.x;
int hitY = (int) result.hitVec.y;
int hitZ = (int) result.hitVec.z;

if (entity.canBeCollidedWith())
{
float f10 = entity.getCollisionBorderSize();
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expand((double) f10, (double) f10, (double) f10);
EntityAPC entityapc = new EntityAPC(worldIn, (double) ((float) hitX + 0.5F), (double) ((float) hitY + 1.0F), (double) ((float) hitZ + 0.5F));
entityapc.rotationYaw = (float) (((MathHelper.floor((double) (playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90);

if (axisalignedbb.contains(vec1))
{
flag = true;
}
}
}

if (flag)
{
return new ActionResult<ItemStack>(EnumActionResult.FAIL, playerIn.getActiveItemStack());
}
else
if (!worldIn.isRemote)
{
if (result.typeOfHit == RayTraceResult.Type.BLOCK)
{
int hitX = (int) result.hitVec.x;
int hitY = (int) result.hitVec.y;
int hitZ = (int) result.hitVec.z;

if (worldIn.getBlockState(new BlockPos(hitX, hitY, hitZ)).getBlock() == Blocks.SNOW_LAYER)
{
--hitY;
}

EntityAPC entityapc = new EntityAPC(worldIn, (double) ((float) hitX + 0.5F), (double) ((float) hitY + 1.0F), (double) ((float) hitZ + 0.5F));
entityapc.rotationYaw = (float) (((MathHelper.floor((double) (playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90);

if (!worldIn.getCollisionBoxes(entityapc, entityapc.getEntityBoundingBox().expand(-0.1D, -0.1D, -0.1D)).isEmpty())
{
List<Entity> e = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, entityapc.getEntityBoundingBox());
for (Entity entityIn : e)
{
if (entityIn instanceof EntityLivingBase)
{
EntityLivingBase entity = (EntityLivingBase) entityIn;
entity.setHealth(0);
}
else
{
entityIn.setDead();
}
}
}

if (!worldIn.isRemote)
{
worldIn.spawnEntity(entityapc);
}

if (!playerIn.capabilities.isCreativeMode)
{
playerIn.getActiveItemStack().shrink(1);
}
}

return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getActiveItemStack());
worldIn.spawnEntity(entityapc);
}
}

return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getActiveItemStack());
}
}

0 comments on commit e7c0071

Please sign in to comment.
You can’t perform that action at this time.