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 spawnShockWave() {

	//System.out.println("Spawned");

	if (this.worldObj.getClosestVulnerablePlayerToEntity(this, 10.0D) != null) {
		EntityLivingBase entityplayer = (EntityLivingBase) this.worldObj.getClosestVulnerablePlayerToEntity(this, 10.0D);

		double x = Math.sin(entityplayer.rotationYaw * Math.PI / 180) * 1.0D;
		double z = Math.cos(entityplayer.rotationYaw * Math.PI / 180) * 1.0D;
		double y = 1.0D;

		//System.out.println(entityplayer);

		double d = Math.random();
		if (d < 0.2) {
			//System.out.println("PUSH");
			entityplayer.addVelocity(x, y, z);
		}

	}

}

 

Well this is my attempt to push the player away from a certain entity.

 

https://bitbucket.org/Dragonisser/cobaltmod/src/2a6e45c02444af95fc11af6b881cea78c633b164/cobaltmod/entity/EntityCobaltGuardian.java?at=master#cl-230

It gets called where //System.out.println("FIREBALL 2"); is written.(Old code, thats why it isnt written there ^^)

 

But nothing happens. I use the same at my windaxe:

https://bitbucket.org/Dragonisser/cobaltmod/src/2a6e45c02444af95fc11af6b881cea78c633b164/cobaltmod/items/ItemWindAxe.java?at=master#cl-119

 

I also tried to use EntityPlayer. I even get the variables like

 

- entityplayer.rotationYaw

- entityplayer

 

but nothing happens to me.

 

 

I added right now this "entityplayer.attackEntityFrom(DamageSource.cactus, 0.1F);" under .addVelocity() and suddenly i get thrown away.

 

Does someone knows why it only works when i get damaged? Or did i make a stupid mistake xD?

I had the same problem, you need to set velocityChanged to true or else it doesn't do anything.

The proud(ish) developer of Ancients

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.