Posted May 17, 20169 yr i'm using 1.9 and i cant seem to find the code for the actual function of the elytra. the ItemElytra just has basic defining features, seemingly nothing to make it move and function when worn. anyone know where this code would be? I want to make different wings in the game. ayyyyyyyyy
May 17, 20169 yr Likely the EntityLivingBase class. Possibly EntityPlayer. Find it in the Items list (that is, Items.elytra , really any reference to this variable is sufficient), right click on it and go to "References" and then "Find in Workspace." Assuming that Vanilla does some kind of getArmorInSlot(x).getItem() == Items.elytra then you'll be able to locate the code you're interested. Note: it may also use an InstanceOf check, in which case, do the same thing on the ItemElytra class. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 17, 20169 yr Author hoooooh. well it seems there's a lot of convoluted code that is hardcoded into the game. any suggestions on how to get a custom one? the code is in EntityLivingBase ayyyyyyyyy
May 18, 20169 yr Does it use == or instance of? If the former: not easily (you will have to use events and basically duplicate all that code) If the latter: just extend ItemElytra Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 19, 20169 yr I randomly found out about this: It uses itemstack.getItem() == Items.elytra . Oh well, no need to extend ItemElytra. Here is the code which is run when flying with an elytra: if (this.motionY > -0.5D) { this.fallDistance = 1.0F; } Vec3d vec3d = this.getLookVec(); float f = this.rotationPitch * 0.017453292F; double d6 = Math.sqrt(vec3d.xCoord * vec3d.xCoord + vec3d.zCoord * vec3d.zCoord); double d8 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); double d1 = vec3d.lengthVector(); float f4 = MathHelper.cos(f); f4 = (float)((double)f4 * (double)f4 * Math.min(1.0D, d1 / 0.4D)); this.motionY += -0.08D + (double)f4 * 0.06D; if (this.motionY < 0.0D && d6 > 0.0D) { double d2 = this.motionY * -0.1D * (double)f4; this.motionY += d2; this.motionX += vec3d.xCoord * d2 / d6; this.motionZ += vec3d.zCoord * d2 / d6; } if (f < 0.0F) { double d9 = d8 * (double)(-MathHelper.sin(f)) * 0.04D; this.motionY += d9 * 3.2D; this.motionX -= vec3d.xCoord * d9 / d6; this.motionZ -= vec3d.zCoord * d9 / d6; } if (d6 > 0.0D) { this.motionX += (vec3d.xCoord / d6 * d8 - this.motionX) * 0.1D; this.motionZ += (vec3d.zCoord / d6 * d8 - this.motionZ) * 0.1D; } this.motionX *= 0.9900000095367432D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9900000095367432D; this.moveEntity(this.motionX, this.motionY, this.motionZ); if (this.isCollidedHorizontally && !this.worldObj.isRemote) { double d10 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); double d3 = d8 - d10; float f5 = (float)(d3 * 10.0D - 3.0D); if (f5 > 0.0F) { this.playSound(this.getFallSound((int)f5), 1.0F, 1.0F); this.attackEntityFrom(DamageSource.flyIntoWall, f5); } } if (this.onGround && !this.worldObj.isRemote) { this.setFlag(7, false); //Disables elytra flight }
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.