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

 

 

public void onLivingUpdate(World world, int x, int y, int z)

    {

    if (!world.isRemote && this.getHealth() <= 15){

 

    EntityWolf ewolf = new EntityWolf(world);

    ewolf.setLocationAndAngles((double)x + 0.5D, (double)y + 3D, (double)z + 0.5D, 0.0F, 0.0F);

    world.spawnEntityInWorld(ewolf);

   

        }if (this.getHealth() <= 15){

        this.heal(0.5F);

    }

    super.onLivingUpdate();

    }

 

 

The title says it all

My mob has 25 health so there is no trouble with the getHealth

I have tried an other method 

.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), 30));

And it worked but not the one in the spoiler

So i'm asking if someone can help me with this problem

 

VampZ modder

  • Author

Well,

I need an another method because onLivingUpdate. World, int x, int y, int z doesn't work. I have been excepting that already

I remember that there was a method called EntityUpdateTick or something

 

 

VampZ modder

  • Author

I tried putting in the onLivingUpdate

World world, int x, int y, int z

That caused the method not to work, what i expected

 

I tried using worldObj :

 

 

EntityWerewolf entitywolf = new EntityWerewolf(worldObj);

entitywolf.copyLocationAndAnglesFrom(entitywolf);

worldObj.spawnEntityInWorld(entitywolf);

 

 

After i tested it, it still doesn't work

VampZ modder

  • Author

acuatlly it makes sense because, i want it to spawn from the entity itself so if the "Real one"spawns the "Clone" it can retreat and the "Clone" can fight back

VampZ modder

  • Author

So there's the problem i was using entity in another class and here i'm using entitywolf

but how can i set it like : entitywolf copy location from the spawner and not yourself

 

because in my other class i used entity instead of entitywolf

VampZ modder

  • Author

Okay is used this method : entitywolf.setLocationAndAngles((double)2, (double)1, (double)2, 0, 0);

and i found out that it spawns the mob at 2, 1, 2

well that's a begin

 

... is there a way that game can check how many things it can spawn the mob with this code?

VampZ modder

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.