User Tools

Site Tools


tutorial:projectiles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:projectiles [2022/02/09 20:42] – setVelocity haykamtutorial:projectiles [2022/02/10 15:08] – [Rendering your Projectile Entity] tianjun
Line 205: Line 205:
  snowballEntity.setItem(itemStack);  snowballEntity.setItem(itemStack);
  snowballEntity.setVelocity(user, user.pitch, user.yaw, 0.0F, 1.5F, 0F);  snowballEntity.setVelocity(user, user.pitch, user.yaw, 0.0F, 1.5F, 0F);
 +                        /*
 +                        snowballEntity.setProperties(user, user.getPitch(), user.getYaw(), 0.0F, 1.5F, 1.0F);
 +                        In 1.17,we will use setProperties instead of setVelocity.                                                        
 +                        */
  world.spawnEntity(snowballEntity); // spawns entity  world.spawnEntity(snowballEntity); // spawns entity
  }  }
Line 272: Line 276:
  byteBuf.writeUuid(e.getUuid());  byteBuf.writeUuid(e.getUuid());
  byteBuf.writeVarInt(e.getEntityId());  byteBuf.writeVarInt(e.getEntityId());
 +                
  PacketBufUtil.writeVec3d(byteBuf, e.getPos());  PacketBufUtil.writeVec3d(byteBuf, e.getPos());
  PacketBufUtil.writeAngle(byteBuf, e.pitch);  PacketBufUtil.writeAngle(byteBuf, e.pitch);
  PacketBufUtil.writeAngle(byteBuf, e.yaw);  PacketBufUtil.writeAngle(byteBuf, e.yaw);
 +                /*
 +                In 1.17,we use these.
 +                byteBuf.writeVarInt(e.getId());
 +                
 +                PacketBufUtil.writeVec3d(byteBuf, e.getPos());
 +                PacketBufUtil.writeAngle(byteBuf, e.getPitch());
 +                PacketBufUtil.writeAngle(byteBuf, e.getYaw());              
 +                */
 +
  return ServerPlayNetworking.createS2CPacket(packetID, byteBuf);  return ServerPlayNetworking.createS2CPacket(packetID, byteBuf);
  }  }
tutorial/projectiles.txt · Last modified: 2024/03/08 01:56 by netuserget