synchronization rotation fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
b37ee6c45f
commit
d41f3f2b16
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Fri Aug 16 16:31:44 EDT 2024
|
||||
buildNumber=256
|
||||
#Fri Aug 16 18:09:29 EDT 2024
|
||||
buildNumber=257
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
Script engine ability to spawn entities
|
||||
|
||||
+ rearchitecture
|
||||
Netconf file that pre-populates address, ip, username, password
|
||||
Quad tree implementation to support grass placement and eventually chunk LOD management
|
||||
|
||||
+ fix the vibes
|
||||
@ -21,7 +20,6 @@
|
||||
Fix AI tracking deleted entity
|
||||
Fix server ground movement tree playing animation over falling animation
|
||||
Fix F2 menu not regaining controls when Xing menu instead of hitting F2 to close
|
||||
Fix rotation not sending correctly on initialization of creatures on client
|
||||
Fix empty item slot not showing underneath dragged item
|
||||
Fix grass rendering distance
|
||||
|
||||
|
||||
@ -599,6 +599,7 @@ Fix AI components not resetting on turning off ai manager
|
||||
Fix broken rendering pipeline when creating new level
|
||||
Fix ui alignment for item panels in inventory menus (ie dont have to place in corner)
|
||||
Netconfig file support
|
||||
Fix rotation not sending correctly on initialization of creatures on client
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
@ -191,7 +191,11 @@
|
||||
"creatureTemplate",
|
||||
"positionX",
|
||||
"positionY",
|
||||
"positionZ"
|
||||
"positionZ",
|
||||
"rotationX",
|
||||
"rotationY",
|
||||
"rotationZ",
|
||||
"rotationW"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -202,7 +206,11 @@
|
||||
"creatureTemplate",
|
||||
"positionX",
|
||||
"positionY",
|
||||
"positionZ"
|
||||
"positionZ",
|
||||
"rotationX",
|
||||
"rotationY",
|
||||
"rotationZ",
|
||||
"rotationW"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -213,7 +221,11 @@
|
||||
"creatureTemplate",
|
||||
"positionX",
|
||||
"positionY",
|
||||
"positionZ"
|
||||
"positionZ",
|
||||
"rotationX",
|
||||
"rotationY",
|
||||
"rotationZ",
|
||||
"rotationW"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -236,7 +248,7 @@
|
||||
},
|
||||
{
|
||||
"messageName" : "attackUpdate",
|
||||
"description" : "Updates the client on the status of a given attack",
|
||||
"description" : "(Deprecated) Updates the client on the status of a given attack",
|
||||
"data" : [
|
||||
"entityID",
|
||||
"time",
|
||||
@ -298,7 +310,11 @@
|
||||
"foliageSeed",
|
||||
"positionX",
|
||||
"positionY",
|
||||
"positionZ"
|
||||
"positionZ",
|
||||
"rotationX",
|
||||
"rotationY",
|
||||
"rotationZ",
|
||||
"rotationW"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.client.fluid.cells;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3i;
|
||||
import org.ode4j.ode.DBody;
|
||||
@ -68,7 +69,7 @@ public class FluidCell {
|
||||
|
||||
modelEntity = FluidChunk.clientCreateFluidChunkEntity(weights);
|
||||
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, getRealPos());
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, getRealPos(), new Quaterniond());
|
||||
}
|
||||
|
||||
protected Vector3d getRealPos(){
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.client.terrain.cells;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3i;
|
||||
import org.ode4j.ode.DBody;
|
||||
@ -81,7 +82,7 @@ public class DrawCell {
|
||||
|
||||
}
|
||||
modelEntity = TerrainChunk.clientCreateTerrainChunkEntity(chunkData, lod, atlas);
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, getRealPos());
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, getRealPos(), new Quaterniond());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.entity;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||
@ -16,9 +17,9 @@ public class ClientEntityUtils {
|
||||
* @param entity
|
||||
* @param position
|
||||
*/
|
||||
public static void initiallyPositionEntity(Entity entity, Vector3d position){
|
||||
public static void initiallyPositionEntity(Entity entity, Vector3d position, Quaterniond rotation){
|
||||
//reposition entity
|
||||
CollisionObjUtils.clientPositionCharacter(entity, position);
|
||||
CollisionObjUtils.clientPositionCharacter(entity, position, rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -280,7 +280,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
||||
}
|
||||
//we want to always update the server facing vector with where the client says they're facing
|
||||
EntityUtils.getRotation(parent).set(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW());
|
||||
CollisionObjUtils.clientPositionCharacter(parent, position);
|
||||
CollisionObjUtils.clientPositionCharacter(parent, position, rotation);
|
||||
// CreatureUtils.setFacingVector(parent, new Vector3d(message.getrotationX(),message.getrotationY(),message.getrotationZ()));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -232,6 +232,7 @@ public class CollisionObjUtils {
|
||||
*/
|
||||
public static void clientAttachCollisionObjectToEntity(Entity entity, DBody collisionObject, float mass, String collidableType){
|
||||
Vector3d position = EntityUtils.getPosition(entity);
|
||||
Quaterniond rotation = EntityUtils.getRotation(entity);
|
||||
Vector3f scale = EntityUtils.getScale(entity);
|
||||
Collidable collidable = new Collidable(entity, collidableType, true);
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(collisionObject, collidable);
|
||||
@ -239,7 +240,7 @@ public class CollisionObjUtils {
|
||||
entity.putData(EntityDataStrings.PHYSICS_COLLISION_BODY, collisionObject);
|
||||
|
||||
//update world transform of collision object
|
||||
clientPositionCharacter(entity,position);
|
||||
clientPositionCharacter(entity,position,rotation);
|
||||
|
||||
entity.putData(EntityDataStrings.COLLISION_ENTITY_COLLISION_OBJECT, collisionObject);
|
||||
entity.putData(EntityDataStrings.COLLISION_ENTITY_COLLIDABLE, collidable);
|
||||
@ -284,9 +285,8 @@ public class CollisionObjUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void clientPositionCharacter(Entity e, Vector3d position){
|
||||
public static void clientPositionCharacter(Entity e, Vector3d position, Quaterniond rotation){
|
||||
EntityUtils.getPosition(e).set(position);
|
||||
Quaterniond rotation = EntityUtils.getRotation(e);
|
||||
DBody body = getCollisionBody(e);
|
||||
if(body != null){
|
||||
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), position, rotation, body);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.entity.types.creature;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.ode4j.ode.DBody;
|
||||
|
||||
@ -720,13 +721,19 @@ public class CreatureUtils {
|
||||
public static void sendEntityToPlayer(Player player, Entity creature){
|
||||
int id = creature.getId();
|
||||
Vector3d position = EntityUtils.getPosition(creature);
|
||||
Quaterniond rotation = EntityUtils.getRotation(creature);
|
||||
String template = Utilities.stringify(CreatureUtils.getCreatureTemplate(creature));
|
||||
NetworkMessage message = EntityMessage.constructSpawnCreatureMessage(
|
||||
id,
|
||||
template,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z);
|
||||
position.z,
|
||||
rotation.x,
|
||||
rotation.y,
|
||||
rotation.z,
|
||||
rotation.w
|
||||
);
|
||||
player.addMessage(message);
|
||||
if(CreatureUtils.hasControllerPlayerId(creature)){
|
||||
LoggerInterface.loggerNetworking.INFO("Sending controller packets");
|
||||
|
||||
@ -18,6 +18,7 @@ import electrosphere.renderer.actor.ActorUtils;
|
||||
import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
/**
|
||||
@ -153,6 +154,7 @@ public class FoliageUtils {
|
||||
int id = foliage.getId();
|
||||
FoliageType type = FoliageUtils.getFoliageType(foliage);
|
||||
Vector3d position = EntityUtils.getPosition(foliage);
|
||||
Quaterniond rotation = EntityUtils.getRotation(foliage);
|
||||
if(FoliageUtils.hasSeed(foliage)){
|
||||
long seed = FoliageUtils.getFoliageSeed(foliage);
|
||||
NetworkMessage message = EntityMessage.constructSpawnFoliageSeedMessage(
|
||||
@ -161,7 +163,11 @@ public class FoliageUtils {
|
||||
seed,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z
|
||||
position.z,
|
||||
rotation.x,
|
||||
rotation.y,
|
||||
rotation.z,
|
||||
rotation.w
|
||||
);
|
||||
player.addMessage(message);
|
||||
} else {
|
||||
|
||||
@ -2,6 +2,7 @@ package electrosphere.entity.types.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.ode4j.ode.DBody;
|
||||
|
||||
@ -266,13 +267,19 @@ public class ItemUtils {
|
||||
int id = item.getId();
|
||||
String type = ItemUtils.getType(item);
|
||||
Vector3d position = EntityUtils.getPosition(item);
|
||||
Quaterniond rotation = EntityUtils.getRotation(item);
|
||||
//construct the spawn message and attach to player
|
||||
NetworkMessage message = EntityMessage.constructSpawnItemMessage(
|
||||
id,
|
||||
type,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z);
|
||||
position.z,
|
||||
rotation.x,
|
||||
rotation.y,
|
||||
rotation.z,
|
||||
rotation.w
|
||||
);
|
||||
player.addMessage(message);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.entity.types.object;
|
||||
|
||||
import org.joml.Quaterniond;
|
||||
import org.joml.Vector3d;
|
||||
import org.ode4j.ode.DBody;
|
||||
|
||||
@ -245,13 +246,18 @@ public class ObjectUtils {
|
||||
int id = object.getId();
|
||||
String type = ObjectUtils.getType(object);
|
||||
Vector3d position = EntityUtils.getPosition(object);
|
||||
Quaterniond rotation = EntityUtils.getRotation(object);
|
||||
//construct the spawn message and attach to player
|
||||
NetworkMessage message = EntityMessage.constructSpawnObjectMessage(
|
||||
id,
|
||||
type,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z
|
||||
position.z,
|
||||
rotation.x,
|
||||
rotation.y,
|
||||
rotation.z,
|
||||
rotation.w
|
||||
);
|
||||
player.addMessage(message);
|
||||
}
|
||||
|
||||
@ -94,7 +94,11 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
||||
LoggerInterface.loggerNetworking.DEBUG("Spawn Creature " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
||||
CreatureTemplate template = Utilities.deserialize(message.getcreatureTemplate(), CreatureTemplate.class);
|
||||
newlySpawnedEntity = CreatureUtils.clientSpawnBasicCreature(template.getCreatureType(),template);
|
||||
ClientEntityUtils.initiallyPositionEntity(newlySpawnedEntity, new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()));
|
||||
ClientEntityUtils.initiallyPositionEntity(
|
||||
newlySpawnedEntity,
|
||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||
);
|
||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||
//if the creature template includes an equip section, spawn all the equipped items
|
||||
if(template != null && template.getCreatureEquipData() != null && template.getCreatureEquipData().getSlots() != null){
|
||||
@ -123,14 +127,22 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
||||
String itemType = message.getcreatureTemplate();
|
||||
newlySpawnedEntity = ItemUtils.clientSpawnBasicItem(itemType);
|
||||
//position
|
||||
ClientEntityUtils.initiallyPositionEntity(newlySpawnedEntity, new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()));
|
||||
ClientEntityUtils.initiallyPositionEntity(
|
||||
newlySpawnedEntity,
|
||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||
);
|
||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||
} break;
|
||||
case SPAWNFOLIAGESEED: {
|
||||
LoggerInterface.loggerNetworking.DEBUG("Spawn foliage " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
||||
String type = message.getcreatureTemplate();
|
||||
newlySpawnedEntity = FoliageUtils.spawnBasicFoliage(type,message.getfoliageSeed());
|
||||
ClientEntityUtils.initiallyPositionEntity(newlySpawnedEntity, new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()));
|
||||
ClientEntityUtils.initiallyPositionEntity(
|
||||
newlySpawnedEntity,
|
||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||
);
|
||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||
} break;
|
||||
case SPAWNOBJECT: {
|
||||
@ -139,7 +151,11 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
||||
String objectType = message.getcreatureTemplate();
|
||||
newlySpawnedEntity = ObjectUtils.clientSpawnBasicObject(objectType);
|
||||
//position
|
||||
ClientEntityUtils.initiallyPositionEntity(newlySpawnedEntity, new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()));
|
||||
ClientEntityUtils.initiallyPositionEntity(
|
||||
newlySpawnedEntity,
|
||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||
);
|
||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||
} break;
|
||||
|
||||
|
||||
@ -560,6 +560,18 @@ public class EntityMessage extends NetworkMessage {
|
||||
if(currentStreamLength < 34 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 42 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 50 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 58 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 66 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -571,16 +583,24 @@ public class EntityMessage extends NetworkMessage {
|
||||
rVal.setpositionX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationW(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static EntityMessage constructSpawnCreatureMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ){
|
||||
public static EntityMessage constructSpawnCreatureMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ,double rotationX,double rotationY,double rotationZ,double rotationW){
|
||||
EntityMessage rVal = new EntityMessage(EntityMessageType.SPAWNCREATURE);
|
||||
rVal.setentityID(entityID);
|
||||
rVal.setcreatureTemplate(creatureTemplate);
|
||||
rVal.setpositionX(positionX);
|
||||
rVal.setpositionY(positionY);
|
||||
rVal.setpositionZ(positionZ);
|
||||
rVal.setrotationX(rotationX);
|
||||
rVal.setrotationY(rotationY);
|
||||
rVal.setrotationZ(rotationZ);
|
||||
rVal.setrotationW(rotationW);
|
||||
rVal.serialize();
|
||||
return rVal;
|
||||
}
|
||||
@ -613,6 +633,18 @@ public class EntityMessage extends NetworkMessage {
|
||||
if(currentStreamLength < 34 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 42 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 50 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 58 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 66 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -624,16 +656,24 @@ public class EntityMessage extends NetworkMessage {
|
||||
rVal.setpositionX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationW(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static EntityMessage constructSpawnItemMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ){
|
||||
public static EntityMessage constructSpawnItemMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ,double rotationX,double rotationY,double rotationZ,double rotationW){
|
||||
EntityMessage rVal = new EntityMessage(EntityMessageType.SPAWNITEM);
|
||||
rVal.setentityID(entityID);
|
||||
rVal.setcreatureTemplate(creatureTemplate);
|
||||
rVal.setpositionX(positionX);
|
||||
rVal.setpositionY(positionY);
|
||||
rVal.setpositionZ(positionZ);
|
||||
rVal.setrotationX(rotationX);
|
||||
rVal.setrotationY(rotationY);
|
||||
rVal.setrotationZ(rotationZ);
|
||||
rVal.setrotationW(rotationW);
|
||||
rVal.serialize();
|
||||
return rVal;
|
||||
}
|
||||
@ -666,6 +706,18 @@ public class EntityMessage extends NetworkMessage {
|
||||
if(currentStreamLength < 34 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 42 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 50 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 58 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 66 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -677,16 +729,24 @@ public class EntityMessage extends NetworkMessage {
|
||||
rVal.setpositionX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationW(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static EntityMessage constructSpawnObjectMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ){
|
||||
public static EntityMessage constructSpawnObjectMessage(int entityID,String creatureTemplate,double positionX,double positionY,double positionZ,double rotationX,double rotationY,double rotationZ,double rotationW){
|
||||
EntityMessage rVal = new EntityMessage(EntityMessageType.SPAWNOBJECT);
|
||||
rVal.setentityID(entityID);
|
||||
rVal.setcreatureTemplate(creatureTemplate);
|
||||
rVal.setpositionX(positionX);
|
||||
rVal.setpositionY(positionY);
|
||||
rVal.setpositionZ(positionZ);
|
||||
rVal.setrotationX(rotationX);
|
||||
rVal.setrotationY(rotationY);
|
||||
rVal.setrotationZ(rotationZ);
|
||||
rVal.setrotationW(rotationW);
|
||||
rVal.serialize();
|
||||
return rVal;
|
||||
}
|
||||
@ -895,6 +955,18 @@ public class EntityMessage extends NetworkMessage {
|
||||
if(currentStreamLength < 42 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 50 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 58 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 66 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
if(currentStreamLength < 74 + creatureTemplateSize){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -907,10 +979,14 @@ public class EntityMessage extends NetworkMessage {
|
||||
rVal.setpositionX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setpositionZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationX(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationY(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationZ(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
rVal.setrotationW(ByteStreamUtils.popDoubleFromByteQueue(byteBuffer));
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public static EntityMessage constructSpawnFoliageSeedMessage(int entityID,String creatureTemplate,long foliageSeed,double positionX,double positionY,double positionZ){
|
||||
public static EntityMessage constructSpawnFoliageSeedMessage(int entityID,String creatureTemplate,long foliageSeed,double positionX,double positionY,double positionZ,double rotationX,double rotationY,double rotationZ,double rotationW){
|
||||
EntityMessage rVal = new EntityMessage(EntityMessageType.SPAWNFOLIAGESEED);
|
||||
rVal.setentityID(entityID);
|
||||
rVal.setcreatureTemplate(creatureTemplate);
|
||||
@ -918,6 +994,10 @@ public class EntityMessage extends NetworkMessage {
|
||||
rVal.setpositionX(positionX);
|
||||
rVal.setpositionY(positionY);
|
||||
rVal.setpositionZ(positionZ);
|
||||
rVal.setrotationX(rotationX);
|
||||
rVal.setrotationY(rotationY);
|
||||
rVal.setrotationZ(rotationZ);
|
||||
rVal.setrotationW(rotationW);
|
||||
rVal.serialize();
|
||||
return rVal;
|
||||
}
|
||||
@ -1039,7 +1119,7 @@ public class EntityMessage extends NetworkMessage {
|
||||
}
|
||||
break;
|
||||
case SPAWNCREATURE:
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8];
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8+8+8+8+8];
|
||||
//message header
|
||||
rawBytes[0] = TypeBytes.MESSAGE_TYPE_ENTITY;
|
||||
//entity messaage header
|
||||
@ -1068,9 +1148,25 @@ public class EntityMessage extends NetworkMessage {
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[26+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationX);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[34+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationY);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[42+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationZ);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[50+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationW);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[58+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
break;
|
||||
case SPAWNITEM:
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8];
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8+8+8+8+8];
|
||||
//message header
|
||||
rawBytes[0] = TypeBytes.MESSAGE_TYPE_ENTITY;
|
||||
//entity messaage header
|
||||
@ -1099,9 +1195,25 @@ public class EntityMessage extends NetworkMessage {
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[26+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationX);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[34+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationY);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[42+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationZ);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[50+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationW);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[58+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
break;
|
||||
case SPAWNOBJECT:
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8];
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8+8+8+8+8];
|
||||
//message header
|
||||
rawBytes[0] = TypeBytes.MESSAGE_TYPE_ENTITY;
|
||||
//entity messaage header
|
||||
@ -1130,6 +1242,22 @@ public class EntityMessage extends NetworkMessage {
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[26+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationX);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[34+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationY);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[42+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationZ);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[50+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationW);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[58+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
break;
|
||||
case MOVEUPDATE:
|
||||
rawBytes = new byte[2+4+8+8+8+8+8+8+8+8+8+4+4];
|
||||
@ -1313,7 +1441,7 @@ public class EntityMessage extends NetworkMessage {
|
||||
}
|
||||
break;
|
||||
case SPAWNFOLIAGESEED:
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8+8];
|
||||
rawBytes = new byte[2+4+4+creatureTemplate.length()+8+8+8+8+8+8+8+8];
|
||||
//message header
|
||||
rawBytes[0] = TypeBytes.MESSAGE_TYPE_ENTITY;
|
||||
//entity messaage header
|
||||
@ -1346,6 +1474,22 @@ public class EntityMessage extends NetworkMessage {
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[34+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationX);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[42+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationY);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[50+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationZ);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[58+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
intValues = ByteStreamUtils.serializeDoubleToBytes(rotationW);
|
||||
for(int i = 0; i < 8; i++){
|
||||
rawBytes[66+creatureTemplate.length()+i] = intValues[i];
|
||||
}
|
||||
break;
|
||||
case UPDATEENTITYVIEWDIR:
|
||||
rawBytes = new byte[2+4+8+4+8+8];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user