Some checks failed
		
		
	
	studiorailgun/Renderer/pipeline/head There was a failure building this commit
				
			
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package electrosphere.entity;
 | |
| 
 | |
| import java.util.List;
 | |
| 
 | |
| import org.joml.Quaterniond;
 | |
| import org.joml.Vector3d;
 | |
| 
 | |
| import electrosphere.engine.Globals;
 | |
| import electrosphere.entity.state.attach.AttachUtils;
 | |
| import electrosphere.entity.types.collision.CollisionObjUtils;
 | |
| 
 | |
| /**
 | |
|  * Client only entity utility functions
 | |
|  */
 | |
| public class ClientEntityUtils {
 | |
|     
 | |
| 
 | |
| 
 | |
|     /**
 | |
|      * Called when the creature is first spawned to serialize to all people in its initial chunk
 | |
|      * @param entity
 | |
|      * @param position
 | |
|      */
 | |
|     public static void initiallyPositionEntity(Entity entity, Vector3d position, Quaterniond rotation){
 | |
|         //reposition entity
 | |
|         CollisionObjUtils.clientPositionCharacter(entity, position, rotation);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Destroys an entity on the client
 | |
|      * @param entity the entity to destroy
 | |
|      */
 | |
|     public static void destroyEntity(Entity entity){
 | |
| 
 | |
|         if(entity != null){
 | |
|             //
 | |
|             //destroy the child entities, too
 | |
|             if(AttachUtils.hasChildren(entity)){
 | |
|                 List<Entity> children = AttachUtils.getChildrenList(entity);
 | |
|                 for(Entity child : children){
 | |
|                     ClientEntityUtils.destroyEntity(child);
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             //check for client-specific stuff
 | |
|             Globals.renderingEngine.getLightManager().destroyPointLight(entity);
 | |
| 
 | |
|             //deregister all behavior trees
 | |
|             EntityUtils.cleanUpEntity(entity);
 | |
|         }
 | |
|     }
 | |
|     
 | |
| 
 | |
| }
 |