Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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. ^-^;

 

 

 

 

  • Author

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();
        }
    }
}

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.