Jump to content

Llama_spit ignores this.doBlockCollision. (1.11)?


Recommended Posts

Posted

My entity goes through entities by using:

if (!this.worldObj.isRemote)
        {
            this.doBlockCollisions();
        }

 

So my question is.... why does this occur? This works for everything except for the llama_spit entity.

When using the execute command to execute a summon of the .doBlockCollision entity on it.

 

The spit juts forward and makes it look like the entity summoned at it is hitting a wall, only one is summoned then it falls down.

(Using repeat and always active.)

 

Is there any information in regards to this? Is this something being considered?

 

I'm not saying this is a bug, or its good. I haven't messed with it enough. ^-^;

 

 

 

 

Posted

Its also ignoring doBlockCollision when specified on impact, which is interesting. I need to look at the vanilla fireball.

 

public class EntityNetherOrb extends EntityOrb
{
public EntityNetherOrb(World worldIn)
    {
        super(worldIn);
    }
    public EntityNetherOrb(World worldIn, EntityLivingBase throwerIn)
    {
        super(worldIn, throwerIn);
    }
    public void onUpdate()
    {
    	super.onUpdate();
    	for (int j = 0; j < 1.4; ++j)
        {
    	this.worldObj.spawnParticle(EnumParticleTypes.DRAGON_BREATH, posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posY + (worldObj.rand.nextFloat() / -1 - worldObj.rand.nextFloat()) / -1.9, posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, 0, 0, 0);
        }
	this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posY + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / -7, 0, 0, 0);
	this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posY + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / -8, 0, 0, 0);
    }
    public float getGravityVelocity()
    {
        return 0.014F;
    }
    public EntityNetherOrb(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }
    protected void onImpact(RayTraceResult result)
    {
        if (result.entityHit != null)
        {
            int i = 0;
            if (ticksExisted >= 2.6210000524 && result.entityHit instanceof EntityLivingBase)
            {
                i = 8;
            }
            if (result.entityHit instanceof EntityLlamaSpit)
            {
            	this.doBlockCollisions();
            }
            result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
            worldObj.playSound((EntityPlayer)null, posX, posY, posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.NEUTRAL, 0.5F, 1.9F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
        }
        for (int j = 0; j < 8; ++j)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.SPELL_WITCH, this.posX, this.posY, this.posZ, 0.0D, 2.0D, 0.0D, new int[0]);
        }
        for (int j = 0; j < 2; ++j)
        {
        this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, this.posY + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, this.posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) / 2, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Block.getIdFromBlock(Blocks.PORTAL)});
        }
        ++ticksExisted;
        if (this.ticksExisted >= 100)
        {
        	this.setDead();
        }
        if (!this.worldObj.isRemote)
        {
            this.doBlockCollisions();
        }
    }
}

Posted

What are you actually trying to do? If you are trying to make your entity pass through other entities, that is NOT the correct way to do it. doBlockCollisions() calls Block#onEntityCollidedWithBlock() on any block the entity is colliding with, it has nothing to do with entity-entity collisions.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.