Posted December 27, 201410 yr 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 ?
December 27, 201410 yr 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.