Jump to content

Thornack

Members
  • Posts

    629
  • Joined

  • Last visited

Everything posted by Thornack

  1. Im not sure how to move the box, if I lower the min yCoord then I get an illegal stance exception. I know how to move the rendering up, I do that with my model but even when I move the rendering of the model using yOffset in my renderer I still get the model turning black and that weird halo effect.
  2. The min position of the bounding box seems to be set at the height of the (+) targeting cursor. That isnt the main issue though, I can deal with the box not displaying properly because the collisions seem to work out so that I can still walk through holes that are only 1 block in size. The biggest issue is the model turning dark and the weird black oval haze texture that renders if my player is too low to the ground. if (ySize > 1.4849999F) then model is dark and that weird black oval halo texture around the sides of the screen shows up. but if (ySize < 1.4849999F) model is normal and that oval texture doesnt show. I need my ySize to be at 2.75 as this makes walking under the 1 block in height gaps possible. (if you dont have it set that high then the players head goes through the blocks and not under it resulting in a black screen for the player)
  3. how would you move it down by 1? if I take the maxY bounding box coord and move that down by 1 I get collision problems. I think the bounding box is actually set by height and width somehow.
  4. If there is any way to stop the rendering that causes the model to go black and the weird black halo crop effect that surrounds the screen then this technique would be pretty cool since hit mechanics work perfectly (just re resized to work with the smaller shorter player. And, if replacing the player model one can simply change the models yOffset and it will render perfectly on top of the ground. (just need to stop it from going black). Its pretty awesome because you can see normally when you go underneath a 1 block high space. (you can fit inside a 1 block sized hole with the above code). Here are a few screenshots of the view resizing when I go underneath the 1 block high bridge I built. The player travelled Left in the order of 4->3->2->1
  5. Ok So I played around with this and this is what I got. public void playerTick(PlayerTickEvent event) { event.player.width = 0.9F; event.player.height =0.9F; event.player.ySize = 2.75F; event.player.eyeHeight = (float) 0.43; event.player.boundingBox.setBB(AxisAlignedBB.getBoundingBox((double)event.player.boundingBox.minX, (double)event.player.boundingBox.minY, (double)event.player.boundingBox.minZ, (double)event.player.boundingBox.minX + 0.9D,(double) event.player.boundingBox.minY + 0.9D,(double) event.player.boundingBox.minZ + 0.9D)); } Everything is great except what you see in the following image: The model goes dark and I get this weird halo effect around the entity. I dont want this. Does anyone know why it happens and where so I can disable it?? As a note, I figured out that if I change the ySize variable and make it positive it moves the players camera view down. But I guess if the player camera view goes below a certain value (ySize > 1.4849999F) then your player model will go dark and that round halo effect gets rendered. I want to turn this off. Also if you give ySize a negative value your game displays an illegal stance exception
  6. This seems to work but there is the problem where if I do this I break the aiming mechanics and the player can walk through a 1x1 block empty space but he takes damage when he does walk through it. @SubscribeEvent public void playerTick(PlayerTickEvent event) { event.player.width = 0.9F; event.player.height = 0.9F; event.player.eyeHeight = (float) 0.52; event.player.boundingBox.setBB(AxisAlignedBB.getBoundingBox((double)event.player.boundingBox.minX, (double)event.player.boundingBox.minY, (double)event.player.boundingBox.minZ, (double)event.player.boundingBox.minX + 0.9D,(double) event.player.boundingBox.minY + 0.9D,(double) event.player.boundingBox.minZ + 0.9D)); } 9/code] [EDIT] Also Why is my players hitbox on his head??
  7. Do I need to do the resizing every player tick or is it good enough to just do it once on server and client when lets say the player gets right clicked. Would that work, would his bounding box change. Also the set setEntityBoundingBox method does not exist in 1.7.10
  8. So far I have tried the following (called server side only) this.player.boundingBox.setBB(morphEntity.boundingBox); where I set my entities size to be this.setSize(0.5F, 0.5F); // hitbox size? and the box doesnt get resized. Then I tried sending a packet to the client sided player containing the min and max values of the morphEntities bounding box and setting the players client side bounding box to be the newly created bounding box (that I created fromt he sent min/max values) also didnt work. public class PacketUpdateBoundingBox extends AbstractMessageToClient<PacketUpdateBoundingBox> { public double minX; public double minY; public double minZ; public double maxX; public double maxY; public double maxZ; public PacketUpdateBoundingBox() {} //the parameter here is the passed in bounding box of the entity you are morphing into public PacketUpdateBoundingBox(AxisAlignedBB boundingBox) { this.minX = boundingBox.minX; this.minY = boundingBox.minY; this.minZ = boundingBox.minZ; this.maxX = boundingBox.maxX; this.maxY = boundingBox.maxY; this.maxZ = boundingBox.maxZ; } @Override protected void read(PacketBuffer buffer) throws IOException { minX = buffer.readDouble(); minY = buffer.readDouble(); minZ = buffer.readDouble(); maxX = buffer.readDouble(); maxY = buffer.readDouble(); maxZ = buffer.readDouble(); } @Override protected void write(PacketBuffer buffer) throws IOException { buffer.writeDouble(minX); buffer.writeDouble(minY); buffer.writeDouble(minZ); buffer.writeDouble(maxX); buffer.writeDouble(maxY); buffer.writeDouble(maxZ); } @Override public void process(EntityPlayer player, Side side) { player.boundingBox.setBB(AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ)); } } and I am stuck. No idea what to try next
  9. Hi everyone, I was wondering if anyone has messed around with resizing the players hitbox/collision box. As you all know I have a systemf or morphing into a players party members. Currently on Morph the party members model is switched with the players but I dont resize the players hitbox/collision box. Does anyone know how to achieve this? If so could you point me in the direction as to where to begin, Ive been looking at it and dont really know how to achieve this.
  10. does anyone know whether or not I need to send a packet to apply a slowness potion effect to an entity? I cant see any other reason why this shouldnt work. I know movement speed needs to be applied client side so does that mean I need to send a packet notifying the client that the movement speed of the entity changed?
  11. If I do if(attackType == This.SlowDownAtt){ hitEntity.addPotionEffect(new PotionEffect(Potion.poison.id, 500,4)); } Then the hit mob does in fact get poisoned but the mobs movement speed doesnt slow down if I try the slowness potion??
  12. If I do if(attackType == This.SlowDownAtt){ //Doesnt seem to work atm System.out.println("CALLED"); hitEntity.addPotionEffect(new PotionEffect(Potion.invisibility.id, 500,4)); } Then the hit mob turns invisible but why doesnt it slow down if I try the slowness potion??
  13. I have an attack that basically is a flamethrower. I want it to impart a potion effect that will slow down the entity that this effect hits. Currently the following doesnt work. It gets called, the hitEntity is there and I see the potion particles above the hit entity but the entity doesnt slow down for some reason. anyone know why? if(attackType == This.SlowDownAtt){ //Doesnt seem to work atm System.out.println("CALLED"); hitEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 70, 70)); } This method is called server side only btw
  14. Hi everyone, I need to do this on Server Side only and get an equivalent version of it MovingObjectPosition mop = player.rayTrace(15, 1F); if (mop != null && !player.worldObj.isAirBlock(mop.blockX, mop.blockY, mop.blockZ) && (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK || mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)) { PacketOverlord.sendToServer(new PacketUpdateOnUsingTickTargetCoord(mop.blockX, mop.blockY, mop.blockZ)); } For some targeting code I am writing. But I am pretty bad with vectors, does anyone know of a way to get an equivalent result to the above but on server side only? I need to get the same coordinates as are sent in the packet but get those coordinates somehow via a serverside only raytrace type method
  15. does anyone know why an entities look vecter gets set to (-1.2246468525851679E-16, 0.0, 1.0) after it changes its facing direction???
  16. That doesnt really work. I think I have to write my own custom AI to update the server look position rather than the client look position.
  17. I am trying to calculate the lookVector of the head by approximation at this point because I have no idea how else to do it. private double lookX, lookY, lookZ; lookX = Math.cos(pokemon.rotationPitch)*Math.sin(pokemon.rotationYawHead); lookY = Math.sin(pokemon.rotationPitch); lookZ = Math.cos(pokemon.rotationPitch)*Math.cos(pokemon.rotationYawHead); Vec3 vec3 = Vec3.createVectorHelper(lookX, lookY, lookZ); And my attack particles now go in random directions but not in line with the head of my entity
  18. The above results I obtained from my model classes render method public void render(Entity entity, float rotationTime, float legRotationAmplitude, float noIdeaWhatThisDoesOrIsUsedFor, float rotationYaw, float rotationPitch, float scale) { super.render(entity, rotationTime, legRotationAmplitude, noIdeaWhatThisDoesOrIsUsedFor, rotationYaw, rotationPitch, scale); System.out.println("pitch "+rotationPitch); System.out.println("yaw "+rotationYaw); } and the super.render() bit here is from ModelBase and the onLivingUpdate method inside my entities class @Override public void onLivingUpdate(){ super.onLivingUpdate(); /////////////////////////////////// System.out.println("pitch "+ this.rotationPitch); System.out.println("yaw "+ this.rotationYaw); } and no I am not setting the values anywhere yet these are straight from the Entity super classes
  19. I mean look at this: If I print out inside my models render method pitch and yaw and print out inside my entities onLiving update pitch and yaw this is what I get I mean Yaw seems to be this.rotationPitch and pitch seems to be this.rotationYaw inside the onLivingUpdate method inside the entity class. (based on how the entity actually rotates in place if you define yaw as rotating around an axis that is in line with gravity and points from the floor to the ceiling) and define pitch as rotating around an axis that is located along the x/z plane (perpendicular to gravity)... Furthermore The client side values seem to be updated by the ai for the renderer whereas the server side values and the entity values arent i dont think. can someone explain this?[
  20. Hi everyone, So I have a question. It seems that entity AI changes the rotation of the client side model for custom entities, but never actually changes the server side values. but only for yaw. Pitch seems to change on server. No idea why. How would you synch them without breaking AI code? send packet onLivingUpdate? I want a less expensive solution to this issue. Here are some print lines of what I have found. inside my entity class the yaw is always 0.0 but inside the model class it changes as the ai moves around. What is weird is pitch seems to be more or less synched up with both of these yaw is never synched at all between the models rotationYaw and the entity rotationYaw- further it never changes from being 0 for the entity but does change for the model render value This is the outprint for System.out.println("yaw"+rotationYaw); inside my model class public void render(Entity entity, float rotationTime, float legRotationAmplitude, float noIdeaWhatThisDoesOrIsUsedFor, float rotationYaw, float rotationPitch, float scale) { super.render(entity, rotationTime, legRotationAmplitude, noIdeaWhatThisDoesOrIsUsedFor, rotationYaw, rotationPitch, scale); System.out.println("pitch "+rotationPitch); } Pitch changes between the models rotationPitch and the entity rotationPitch but they arent synched (almost never anyways and when they are its a coincidence i think) Further the pitch variable seems to be the yaw variable as rotationPitch only seems to change whenever the entity is yawing (rotating about an axis that would run parallell with gravity in minecraft where this axis would be stuck in the ground and point to the sky) This is the outprint for System.out.println("pitch "+rotationPitch); and in entity client and server pitch is a bit weird also pitch seems to be a change in yaw for some reason This is the outprint for System.out.println("pitch "+rotationPitch); and yaw seems to be 0.0 all the time....What is going on here?? This is the outprint for System.out.println("pitch "+rotationPitch); Anyone know why and what is going on here this is messed up
  21. Check out some of my threads, as I do this in a few of them What you are trying to accomplish isnt too difficult, Basically the order should go 1)Your Entity should have some sort of stats that set its base HP to be 100 (set this properly using shared attributes, look at #SharedMonsterAttributes.maxHealth) and use @Override public void writeEntityToNBT(NBTTagCompound nbt) { } and @Override public void readEntityFromNBT(NBTTagCompound nbt) {} to save all of that stuff properly etc etc -> 2)then when your throwable item hits the entity (use) @Override protected void onImpact(MovingObjectPosition movingItemPosition) {} store the entities NBT data in the Itemstacks NBT and set the entity to dead in the world, -> 3) then inside the onItemRightClick method for your item create a dummy instance of your entity EntityWhatever whatever = null; and read the nbt data from your itemstack and "give that data" to your entity before spawning it in world. whatever.readFromNBT(itemStack.stackTagCompound.getCompoundTag("caughtWhatever")); whatever.setPosition(x,y+1.5,z); whatever.isDead = false; if(!world.isRemote){ world.spawnEntityInWorld(whatever); } - pretty simple really. (Thank you Btn is) ---> that way ish do all of your appropriate logic checks and all of that, and thats it.
  22. I cant seem to just be able to use the entities look vector coordinates directly to determine my attack coordinates since the look vector coordinates are all really really small values like X is -1.2246468525851679E-16 Y is 0.0 Z is 1.0 That is the output I get from inside my onUsingTick method System.out.println(" X is "+customEntity.getLookVec().xCoord + " Y is "+ customEntity.getLookVec().yCoord + " Z is "+customEntity.getLookVec().zCoord)
  23. Currently i got my entity to "use the attack item" this works, it spawns a stream of particles infront of it and anything within the calculated radius of effect (directly in front of my entity) will take damage. that is working. But when my mob rotates the "aiming" for the attack is incorrect. currently the particles are spawned along one set direction and the attack happens in that direction only. Im looking for a way to get my attack to follow the entities rotation. Just like for my player, if my player rotates the attack follows his look vector and the particles get spawned along that vector. Currently this is what I am trying to fix. I am going to implement a targeting AI later that will determine the ttack frequency and all of that. but for now I just made it so the attack pulses as so. @Override public void onLivingUpdate(){ super.onLivingUpdate(); ////////////////////////The pulsing code/////////////////////////////////////////////////// if(!this.worldObj.isRemote){ if(attackInUse == null && this.ticksExisted % 20 == 0){ Attack att = (Attack) attacks[0].getItem(); att.onItemRightClick( attacks[0], this.worldObj, this); } else { if(this.ticksExisted % 20 == 0){ attackInUse = null; } } } /////////////////////////////////////////////////////////////////////////// if (this.attackInUse != null) { ItemStack itemstack = this.getCurrentAttack(); if (itemstack == this.attackInUse) { if (attackInUseCount <= 0) { this.onAttackUseFinish(); } else { if(attackInUse.getItem() instanceof PWItem){ PWItem attack = (PWItem) attackInUse.getItem(); attack.onUsingTick(attackInUse, this, attackInUseCount); } if (--this.attackInUseCount == 0 && !this.worldObj.isRemote) { this.onAttackUseFinish(); } } } else { this.clearAttackInUse(); } } /////////////////////////////////////+ This bit of code is the part I need to change since my method never gets called on client if(customEntity.worldObj.isRemote){ System.out.println("NEVER CALLED"); MovingObjectPosition mop = customEntity.rayTrace(15, 1F); if (mop != null && !customEntity.worldObj.isAirBlock(mop.blockX, mop.blockY, mop.blockZ) && (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK || mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)) { PacketOverlord.sendToServer(new PacketUpdateOnUsingTickTargetCoord(mop.blockX, mop.blockY, mop.blockZ)); } } it is located inside my onUsingTick method. Basically I need the look vector of the entities model so that when the model rotates inside its collision box the attack also rotates accordingly.
  24. One of the main reasons really is so I dont have to rewrite a ton of logic that works currently if it is called client and server side for the player. My attacks recalculate an effective distance based on a ray trace (that bit isnt shown but ray trace needs to be client side only), they can "affect blocks" ie set blocks on fire, or spawn ice blocks to freeze things... etc etc and they also have a few visual effects. The aiming code works for me atm I like the ray trace since it lets me control the max distance, etc etc... But out of curiosity in case I do feel like rewriting a bunch of stuff how would you suggest I do the aiming bit
  25. Its not just the aiming however but ok ill try youre suggestion and maybe see if i can only use server side values
×
×
  • Create New...

Important Information

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