spring cleaning

This commit is contained in:
austin 2022-04-02 23:15:00 -04:00
parent de77ead36e
commit aec9a58f12
75 changed files with 270 additions and 320 deletions

3
.gitignore vendored
View File

@ -15,7 +15,8 @@
.classpath .classpath
.project .project
.settings #want to allow .settings/org.eclipse.jdt.core.prefs
#.settings
.dbeaver .dbeaver

View File

@ -0,0 +1 @@
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore

View File

@ -7,9 +7,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.joml.Matrix4f;
import org.lwjgl.openal.AL; import org.lwjgl.openal.AL;
import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALC;
//import org.lwjgl.openal.*; //import org.lwjgl.openal.*;

View File

@ -5,9 +5,7 @@ import electrosphere.controls.Control.ControlType;
import electrosphere.entity.Entity; import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.AttackTree; import electrosphere.entity.state.AttackTree;
import electrosphere.entity.state.equip.EquipState;
import electrosphere.entity.state.inventory.InventoryUtils; import electrosphere.entity.state.inventory.InventoryUtils;
import electrosphere.entity.state.inventory.UnrelationalInventoryState; import electrosphere.entity.state.inventory.UnrelationalInventoryState;
import electrosphere.entity.state.ironsight.IronSightTree; import electrosphere.entity.state.ironsight.IronSightTree;
@ -17,22 +15,15 @@ import electrosphere.entity.state.movement.GroundMovementTree.MovementRelativeFa
import electrosphere.entity.state.movement.GroundMovementTree.MovementTreeState; import electrosphere.entity.state.movement.GroundMovementTree.MovementTreeState;
import electrosphere.entity.state.movement.SprintTree; import electrosphere.entity.state.movement.SprintTree;
import electrosphere.entity.types.camera.CameraEntityUtils; import electrosphere.entity.types.camera.CameraEntityUtils;
import electrosphere.entity.types.collision.CollisionObjUtils;
import electrosphere.entity.types.item.ItemUtils;
import electrosphere.game.client.targeting.crosshair.Crosshair; import electrosphere.game.client.targeting.crosshair.Crosshair;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.main.Globals; import electrosphere.main.Globals;
import electrosphere.main.Main; import electrosphere.main.Main;
import electrosphere.menu.WindowStrings; import electrosphere.menu.WindowStrings;
import electrosphere.menu.WindowUtils; import electrosphere.menu.WindowUtils;
import electrosphere.menu.MenuCallbacks;
import electrosphere.menu.MenuGenerators; import electrosphere.menu.MenuGenerators;
import electrosphere.renderer.RenderingEngine;
import electrosphere.renderer.ui.DrawableElement;
import electrosphere.renderer.ui.Element;
import electrosphere.renderer.ui.Window; import electrosphere.renderer.ui.Window;
import electrosphere.renderer.ui.events.ClickEvent; import electrosphere.renderer.ui.events.ClickEvent;
import electrosphere.renderer.ui.events.DragEvent;
import electrosphere.renderer.ui.events.KeyboardEvent; import electrosphere.renderer.ui.events.KeyboardEvent;
import electrosphere.renderer.ui.events.MouseEvent; import electrosphere.renderer.ui.events.MouseEvent;
@ -47,7 +38,6 @@ import org.lwjgl.glfw.GLFW;
import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.glfwGetCursorPos; import static org.lwjgl.glfw.GLFW.glfwGetCursorPos;
import static org.lwjgl.glfw.GLFW.glfwGetMouseButton;
import static org.lwjgl.glfw.GLFW.glfwSetInputMode; import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
/** /**
@ -644,7 +634,7 @@ public class ControlHandler {
mainGameControlList.add(controls.get(INPUT_CODE_INTERACT)); mainGameControlList.add(controls.get(INPUT_CODE_INTERACT));
controls.get(INPUT_CODE_INTERACT).setOnPress(new ControlMethod(){public void execute(){ controls.get(INPUT_CODE_INTERACT).setOnPress(new ControlMethod(){public void execute(){
if(Globals.playerCharacter != null){ if(Globals.playerCharacter != null){
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){ if(Globals.playerCharacter.containsKey(EntityDataStrings.EQUIP_STATE) && Crosshair.hasTarget()){
if(InventoryUtils.hasNaturalInventory(Globals.playerCharacter)){ if(InventoryUtils.hasNaturalInventory(Globals.playerCharacter)){
InventoryUtils.attemptStoreItem(Globals.playerCharacter, Crosshair.getTarget()); InventoryUtils.attemptStoreItem(Globals.playerCharacter, Crosshair.getTarget());
// UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter); // UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter);
@ -662,7 +652,7 @@ public class ControlHandler {
mainGameControlList.add(controls.get(INPUT_CODE_DROP)); mainGameControlList.add(controls.get(INPUT_CODE_DROP));
controls.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(){ controls.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(){
if(Globals.playerCharacter != null){ if(Globals.playerCharacter != null){
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){ if(Globals.playerCharacter.containsKey(EntityDataStrings.EQUIP_STATE)){
// EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE); // EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE);
// equipState.drop(); // equipState.drop();
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter); UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerCharacter);

View File

@ -20,9 +20,6 @@ public class Entity {
HashMap<String,Object> data; HashMap<String,Object> data;
LinkedList<String> dataKeys;
public int getId() { public int getId() {
return id; return id;
@ -38,11 +35,6 @@ public class Entity {
public void putData(String key, Object o){ public void putData(String key, Object o){
data.put(key,o); data.put(key,o);
dataKeys.add(key);
}
public List<String> getDataKeys(){
return dataKeys;
} }
public boolean containsKey(String key){ public boolean containsKey(String key){
@ -55,7 +47,6 @@ public class Entity {
public Entity(){ public Entity(){
data = new HashMap<String,Object>(); data = new HashMap<String,Object>();
dataKeys = new LinkedList<String>();
while(Globals.entityManager.getEntityFromId(entity_id_iterator)!=null){ while(Globals.entityManager.getEntityFromId(entity_id_iterator)!=null){
entity_id_iterator++; entity_id_iterator++;
} }

View File

@ -6,6 +6,7 @@ import electrosphere.logger.LoggerInterface;
import electrosphere.main.Globals; import electrosphere.main.Globals;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.joml.Vector3d; import org.joml.Vector3d;
@ -18,24 +19,24 @@ import org.joml.Vector3f;
public class EntityManager { public class EntityManager {
static ConcurrentHashMap entityIdMap = new ConcurrentHashMap(); static Map<Integer,Entity> entityIdMap = new ConcurrentHashMap<Integer,Entity>();
static CopyOnWriteArrayList<Entity> entityList = new CopyOnWriteArrayList(); static List<Entity> entityList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> drawableList = new CopyOnWriteArrayList(); static List<Entity> drawableList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> moveableList = new CopyOnWriteArrayList(); static List<Entity> moveableList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> lightList = new CopyOnWriteArrayList(); static List<Entity> lightList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> uiList = new CopyOnWriteArrayList(); static List<Entity> uiList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> itemList = new CopyOnWriteArrayList(); static List<Entity> itemList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> boneAttachedList = new CopyOnWriteArrayList(); static List<Entity> boneAttachedList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> attackerList = new CopyOnWriteArrayList(); static List<Entity> attackerList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> creatureList = new CopyOnWriteArrayList(); static List<Entity> creatureList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> lifeStateList = new CopyOnWriteArrayList(); static List<Entity> lifeStateList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> particleList = new CopyOnWriteArrayList(); static List<Entity> particleList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> gravityList = new CopyOnWriteArrayList(); static List<Entity> gravityList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> collidableList = new CopyOnWriteArrayList(); static List<Entity> collidableList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> targetableList = new CopyOnWriteArrayList(); static List<Entity> targetableList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<Entity> sprintableList = new CopyOnWriteArrayList(); static List<Entity> sprintableList = new CopyOnWriteArrayList<Entity>();
static CopyOnWriteArrayList<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>(); static List<BehaviorTree> behaviorTreeList = new CopyOnWriteArrayList<BehaviorTree>();
public EntityManager(){ public EntityManager(){
@ -50,7 +51,7 @@ public class EntityManager {
drawableList.add(e); drawableList.add(e);
} }
public CopyOnWriteArrayList<Entity> getDrawable(){ public List<Entity> getDrawable(){
return drawableList; return drawableList;
} }
@ -58,7 +59,7 @@ public class EntityManager {
moveableList.add(e); moveableList.add(e);
} }
public CopyOnWriteArrayList<Entity> getMoveable(){ public List<Entity> getMoveable(){
return moveableList; return moveableList;
} }
@ -66,7 +67,7 @@ public class EntityManager {
lightList.add(e); lightList.add(e);
} }
public CopyOnWriteArrayList<Entity> getLights(){ public List<Entity> getLights(){
return lightList; return lightList;
} }
@ -74,7 +75,7 @@ public class EntityManager {
uiList.add(e); uiList.add(e);
} }
public CopyOnWriteArrayList<Entity> getUIElements(){ public List<Entity> getUIElements(){
return uiList; return uiList;
} }
@ -82,7 +83,7 @@ public class EntityManager {
itemList.add(e); itemList.add(e);
} }
public CopyOnWriteArrayList<Entity> getItemEntities(){ public List<Entity> getItemEntities(){
return itemList; return itemList;
} }
@ -90,7 +91,7 @@ public class EntityManager {
boneAttachedList.add(e); boneAttachedList.add(e);
} }
public CopyOnWriteArrayList<Entity> getBoneAttachedEntities(){ public List<Entity> getBoneAttachedEntities(){
return boneAttachedList; return boneAttachedList;
} }
@ -98,7 +99,7 @@ public class EntityManager {
attackerList.add(e); attackerList.add(e);
} }
public CopyOnWriteArrayList<Entity> getAttackerEntities(){ public List<Entity> getAttackerEntities(){
return attackerList; return attackerList;
} }
@ -106,7 +107,7 @@ public class EntityManager {
creatureList.add(e); creatureList.add(e);
} }
public CopyOnWriteArrayList<Entity> getCreatureEntities(){ public List<Entity> getCreatureEntities(){
return creatureList; return creatureList;
} }
@ -114,7 +115,7 @@ public class EntityManager {
lifeStateList.add(e); lifeStateList.add(e);
} }
public CopyOnWriteArrayList<Entity> getLifeStateEntities(){ public List<Entity> getLifeStateEntities(){
return lifeStateList; return lifeStateList;
} }
@ -122,7 +123,7 @@ public class EntityManager {
particleList.add(e); particleList.add(e);
} }
public CopyOnWriteArrayList<Entity> getParticles(){ public List<Entity> getParticles(){
return particleList; return particleList;
} }
@ -130,7 +131,7 @@ public class EntityManager {
gravityList.add(e); gravityList.add(e);
} }
public CopyOnWriteArrayList<Entity> getGravityEntities(){ public List<Entity> getGravityEntities(){
return gravityList; return gravityList;
} }
@ -138,7 +139,7 @@ public class EntityManager {
collidableList.add(e); collidableList.add(e);
} }
public CopyOnWriteArrayList<Entity> getCollidables(){ public List<Entity> getCollidables(){
return collidableList; return collidableList;
} }
@ -146,7 +147,7 @@ public class EntityManager {
targetableList.add(e); targetableList.add(e);
} }
public CopyOnWriteArrayList<Entity> getTargetables(){ public List<Entity> getTargetables(){
return targetableList; return targetableList;
} }
@ -154,7 +155,7 @@ public class EntityManager {
sprintableList.add(e); sprintableList.add(e);
} }
public CopyOnWriteArrayList<Entity> getSprintables(){ public List<Entity> getSprintables(){
return sprintableList; return sprintableList;
} }
@ -249,7 +250,7 @@ public class EntityManager {
public void overrideEntityId(Entity e, int id){ public void overrideEntityId(Entity e, int id){
LoggerInterface.loggerGameLogic.DEBUG("Overriding entity ID " + e.getId() + " => " + id); LoggerInterface.loggerGameLogic.DEBUG("Overriding entity ID " + e.getId() + " => " + id);
if(entityIdMap.contains(e.getId())){ if(entityIdMap.containsKey(e.getId())){
entityIdMap.remove(e.getId()); entityIdMap.remove(e.getId());
} }
e.setId(id); e.setId(id);
@ -267,7 +268,7 @@ public class EntityManager {
int playerCharacterWorldY = Globals.commonWorldData.convertRealToWorld(playerCharacterPos.z); int playerCharacterWorldY = Globals.commonWorldData.convertRealToWorld(playerCharacterPos.z);
if(playerCharacterWorldX != Globals.clientPlayerData.getWorldPositionX() || playerCharacterWorldY != Globals.clientPlayerData.getWorldPositionY()){ if(playerCharacterWorldX != Globals.clientPlayerData.getWorldPositionX() || playerCharacterWorldY != Globals.clientPlayerData.getWorldPositionY()){
for(Entity entity : entityList){ for(Entity entity : entityList){
if(entity.getDataKeys().contains(EntityDataStrings.TERRAIN_IS_TERRAIN) || entity.getDataKeys().contains(EntityDataStrings.ATTACH_PARENT) || entity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_PARENT)){ if(entity.containsKey(EntityDataStrings.TERRAIN_IS_TERRAIN) || entity.containsKey(EntityDataStrings.ATTACH_PARENT) || entity.containsKey(EntityDataStrings.COLLISION_ENTITY_PARENT)){
} else { } else {
Vector3d position = EntityUtils.getPosition(entity); Vector3d position = EntityUtils.getPosition(entity);

View File

@ -57,13 +57,13 @@ public class IdleTree {
public void simulate(){ public void simulate(){
Actor entityActor = EntityUtils.getActor(parent); Actor entityActor = EntityUtils.getActor(parent);
boolean hasMovementTree = parent.getDataKeys().contains(EntityDataStrings.DATA_STRING_MOVEMENT_BT); boolean hasMovementTree = parent.containsKey(EntityDataStrings.DATA_STRING_MOVEMENT_BT);
GroundMovementTree movementTree = null; GroundMovementTree movementTree = null;
if(hasMovementTree){ if(hasMovementTree){
movementTree = CreatureUtils.getEntityMovementTree(parent); movementTree = CreatureUtils.getEntityMovementTree(parent);
} }
boolean hasAttackTree = parent.getDataKeys().contains(EntityDataStrings.ATTACK_TREE); boolean hasAttackTree = parent.containsKey(EntityDataStrings.ATTACK_TREE);
AttackTree attackTree = null; AttackTree attackTree = null;
if(hasAttackTree){ if(hasAttackTree){
attackTree = CreatureUtils.getAttackTree(parent); attackTree = CreatureUtils.getAttackTree(parent);

View File

@ -63,13 +63,13 @@ public class CollidableTree {
// System.out.println("Position: " + position); // System.out.println("Position: " + position);
} }
if(impulse.type.matches(Collidable.TYPE_ITEM)){ if(impulse.type.matches(Collidable.TYPE_ITEM)){
if(parent.getDataKeys().contains(EntityDataStrings.GRAVITY_TREE)){ if(parent.containsKey(EntityDataStrings.GRAVITY_TREE)){
((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start(); ((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start();
} }
} }
if(impulse.type.matches(Collidable.TYPE_CREATURE)){ if(impulse.type.matches(Collidable.TYPE_CREATURE)){
// System.out.println(System.currentTimeMillis() + " creature hit!"); // System.out.println(System.currentTimeMillis() + " creature hit!");
if(parent.getDataKeys().contains(EntityDataStrings.GRAVITY_TREE)){ if(parent.containsKey(EntityDataStrings.GRAVITY_TREE)){
((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start(); ((GravityTree)parent.getData(EntityDataStrings.GRAVITY_TREE)).start();
} }
} }

View File

@ -74,7 +74,7 @@ public class EquipState {
//attach to parent bone //attach to parent bone
AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone()); AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone());
//make uncollidable //make uncollidable
if(toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){ if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
Globals.collisionEngine.deregisterPhysicsObject(rigidBody); Globals.collisionEngine.deregisterPhysicsObject(rigidBody);
} }
@ -89,7 +89,7 @@ public class EquipState {
//since we're not replacing meshes we must be attaching to a bone //since we're not replacing meshes we must be attaching to a bone
equipMap.put(point.getEquipPointId(),toEquip); equipMap.put(point.getEquipPointId(),toEquip);
AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone()); AttachUtils.attachEntityToEntityAtBone(parent, toEquip, point.getBone());
if(toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){ if(toEquip.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); CollisionObject rigidBody = (CollisionObject)toEquip.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
Globals.collisionEngine.deregisterPhysicsObject(rigidBody); Globals.collisionEngine.deregisterPhysicsObject(rigidBody);
} }

View File

@ -13,6 +13,7 @@ import electrosphere.main.Globals;
import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.EntityMessage;
import electrosphere.renderer.actor.Actor; import electrosphere.renderer.actor.Actor;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.joml.Quaternionf; import org.joml.Quaternionf;
import org.joml.Vector3d; import org.joml.Vector3d;
@ -42,7 +43,7 @@ public class GravityTree {
CollisionObject body; CollisionObject body;
Collidable collidable; Collidable collidable;
CopyOnWriteArrayList<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList(); List<EntityMessage> networkMessageQueue = new CopyOnWriteArrayList<EntityMessage>();
public GravityTree(Entity e, Collidable collidable, CollisionObject body, int fallFrame){ public GravityTree(Entity e, Collidable collidable, CollisionObject body, int fallFrame){
state = GravityTreeState.ACTIVE; state = GravityTreeState.ACTIVE;

View File

@ -6,14 +6,14 @@ import electrosphere.entity.EntityDataStrings;
public class GravityUtils { public class GravityUtils {
public static void attemptActivateGravity(Entity target){ public static void attemptActivateGravity(Entity target){
if(target.getDataKeys().contains(EntityDataStrings.GRAVITY_ENTITY)){ if(target.containsKey(EntityDataStrings.GRAVITY_ENTITY)){
GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE); GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE);
tree.start(); tree.start();
} }
} }
public static void attemptDeactivateGravity(Entity target){ public static void attemptDeactivateGravity(Entity target){
if(target.getDataKeys().contains(EntityDataStrings.GRAVITY_ENTITY)){ if(target.containsKey(EntityDataStrings.GRAVITY_ENTITY)){
GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE); GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE);
tree.stop(); tree.stop();
} }

View File

@ -16,7 +16,7 @@ public class InventoryUtils {
public static boolean hasNaturalInventory(Entity target){ public static boolean hasNaturalInventory(Entity target){
return target.getDataKeys().contains(EntityDataStrings.NATURAL_INVENTORY); return target.containsKey(EntityDataStrings.NATURAL_INVENTORY);
} }
public static UnrelationalInventoryState getNaturalInventory(Entity target){ public static UnrelationalInventoryState getNaturalInventory(Entity target){
@ -24,7 +24,7 @@ public class InventoryUtils {
} }
public static boolean hasEquipInventory(Entity target){ public static boolean hasEquipInventory(Entity target){
return target.getDataKeys().contains(EntityDataStrings.EQUIP_INVENTORY); return target.containsKey(EntityDataStrings.EQUIP_INVENTORY);
} }
public static RelationalInventoryState getEquipInventory(Entity target){ public static RelationalInventoryState getEquipInventory(Entity target){

View File

@ -93,7 +93,6 @@ public class GroundMovementTree {
} }
public void start(MovementRelativeFacing facing){ public void start(MovementRelativeFacing facing){
//TODO: check if can start moving
if(canStartMoving()){ if(canStartMoving()){
this.facing = facing; this.facing = facing;
state = MovementTreeState.STARTUP; state = MovementTreeState.STARTUP;
@ -490,7 +489,7 @@ public class GroundMovementTree {
public boolean canStartMoving(){ public boolean canStartMoving(){
boolean rVal = true; boolean rVal = true;
if(parent.getDataKeys().contains(EntityDataStrings.ATTACK_TREE) && ((AttackTree)parent.getData(EntityDataStrings.ATTACK_TREE)).getState() != AttackTreeState.IDLE){ if(parent.containsKey(EntityDataStrings.ATTACK_TREE) && ((AttackTree)parent.getData(EntityDataStrings.ATTACK_TREE)).getState() != AttackTreeState.IDLE){
rVal = false; rVal = false;
} }
return rVal; return rVal;

View File

@ -9,6 +9,8 @@ import electrosphere.renderer.Model;
import electrosphere.renderer.actor.Actor; import electrosphere.renderer.actor.Actor;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import org.joml.Quaterniond; import org.joml.Quaterniond;
import org.joml.Quaternionf; import org.joml.Quaternionf;
import org.joml.Vector3d; import org.joml.Vector3d;
@ -26,7 +28,7 @@ public class AttachUtils {
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent); toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName); toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName);
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){ if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
getChildrenList(parent).add(toAttach); getChildrenList(parent).add(toAttach);
} else { } else {
LinkedList<Entity> childrenEntities = new LinkedList<Entity> (); LinkedList<Entity> childrenEntities = new LinkedList<Entity> ();
@ -64,18 +66,15 @@ public class AttachUtils {
public static void detatchEntityFromEntityAtBone(Entity parent, Entity toAttach){ public static void detatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
Globals.entityManager.registerBoneAttachedEntity(toAttach); Globals.entityManager.registerBoneAttachedEntity(toAttach);
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED); toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
toAttach.removeData(EntityDataStrings.ATTACH_PARENT); toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_PARENT);
toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE); toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE);
toAttach.getDataKeys().remove(EntityDataStrings.ATTACH_TARGET_BONE); if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){
getChildrenList(parent).remove(toAttach); getChildrenList(parent).remove(toAttach);
} }
} }
public static boolean isAttached(Entity e){ public static boolean isAttached(Entity e){
return e.getDataKeys().contains(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED); return e.containsKey(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
} }
public static String getTargetBone(Entity e){ public static String getTargetBone(Entity e){
@ -87,7 +86,7 @@ public class AttachUtils {
} }
public static boolean hasChildren(Entity e){ public static boolean hasChildren(Entity e){
return e.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty(); return e.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST) && !getChildrenList(e).isEmpty();
} }
public static LinkedList<Entity> getChildrenList(Entity e){ public static LinkedList<Entity> getChildrenList(Entity e){
@ -97,10 +96,10 @@ public class AttachUtils {
public static void attachEntityToEntity(Entity parent, Entity child){ public static void attachEntityToEntity(Entity parent, Entity child){
child.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true); child.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
child.putData(EntityDataStrings.ATTACH_PARENT, parent); child.putData(EntityDataStrings.ATTACH_PARENT, parent);
if(parent.getDataKeys().contains(EntityDataStrings.ATTACH_CHILDREN_LIST)){ if(parent.containsKey(EntityDataStrings.ATTACH_CHILDREN_LIST)){
getChildrenList(parent).add(child); getChildrenList(parent).add(child);
} else { } else {
LinkedList<Entity> childrenEntities = new LinkedList(); List<Entity> childrenEntities = new LinkedList<Entity>();
childrenEntities.add(child); childrenEntities.add(child);
parent.putData(EntityDataStrings.ATTACH_CHILDREN_LIST, childrenEntities); parent.putData(EntityDataStrings.ATTACH_CHILDREN_LIST, childrenEntities);
} }

View File

@ -43,7 +43,6 @@ public class CameraEntityUtils {
BehaviorTree entityTrackingTree = new BehaviorTree() { BehaviorTree entityTrackingTree = new BehaviorTree() {
@Override @Override
public void simulate() { public void simulate() {
// TODO Auto-generated method stub
if(toTrack != null){ if(toTrack != null){
Vector3d entityPos = EntityUtils.getPosition(toTrack); Vector3d entityPos = EntityUtils.getPosition(toTrack);
CameraEntityUtils.setCameraCenter(rVal, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(getOrbitalCameraRadialOffset(rVal))); CameraEntityUtils.setCameraCenter(rVal, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(getOrbitalCameraRadialOffset(rVal)));

View File

@ -406,11 +406,11 @@ public class CreatureUtils {
} }
public static boolean hasControllerPlayerId(Entity e){ public static boolean hasControllerPlayerId(Entity e){
return e.getDataKeys().contains(EntityDataStrings.DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID); return e.containsKey(EntityDataStrings.DATA_STRING_CREATURE_CONTROLLER_PLAYER_ID);
} }
public static boolean isCreature(Entity e){ public static boolean isCreature(Entity e){
return e.getDataKeys().contains(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE); return e.containsKey(EntityDataStrings.DATA_STRING_CREATURE_IS_CREATURE);
} }
public static AttackTree getAttackTree(Entity e){ public static AttackTree getAttackTree(Entity e){

View File

@ -121,7 +121,7 @@ public class HitboxUtils {
//if the entity is attached to is an item, we need to compare with the parent of the item //if the entity is attached to is an item, we need to compare with the parent of the item
//to make sure you don't stab yourself for instance //to make sure you don't stab yourself for instance
boolean isItem = hitboxParent.getDataKeys().contains(EntityDataStrings.ITEM_IS_ITEM); boolean isItem = hitboxParent.containsKey(EntityDataStrings.ITEM_IS_ITEM);
Entity hitboxAttachParent = AttachUtils.getParent(hitboxParent); Entity hitboxAttachParent = AttachUtils.getParent(hitboxParent);
if(isItem){ if(isItem){

View File

@ -168,19 +168,19 @@ public class ItemUtils {
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE,collidable); rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE,collidable);
rVal.putData(EntityDataStrings.COLLIDABLE_TREE, new CollidableTree(rVal,collidable,rigidBody)); rVal.putData(EntityDataStrings.COLLIDABLE_TREE, new CollidableTree(rVal,collidable,rigidBody));
*/ */
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY)){ if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY)){
item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY); item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY);
} }
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET)){ if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET)){
item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET); item.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET);
} }
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_MODEL_TEMPLATE)){ if(item.containsKey(EntityDataStrings.PHYSICS_MODEL_TEMPLATE)){
item.removeData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE); item.removeData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE);
} }
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){ if(item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
item.removeData(EntityDataStrings.PHYSICS_COLLIDABLE); item.removeData(EntityDataStrings.PHYSICS_COLLIDABLE);
} }
if(item.getDataKeys().contains(EntityDataStrings.COLLIDABLE_TREE)){ if(item.containsKey(EntityDataStrings.COLLIDABLE_TREE)){
item.removeData(EntityDataStrings.COLLIDABLE_TREE); item.removeData(EntityDataStrings.COLLIDABLE_TREE);
} }
} }
@ -213,7 +213,7 @@ public class ItemUtils {
} }
public static boolean isItem(Entity item){ public static boolean isItem(Entity item){
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_ITEM); return item.containsKey(EntityDataStrings.ITEM_IS_ITEM);
} }
public static String getType(Entity item){ public static String getType(Entity item){
@ -221,15 +221,15 @@ public class ItemUtils {
} }
public static boolean isWeapon(Entity item){ public static boolean isWeapon(Entity item){
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_WEAPON); return item.containsKey(EntityDataStrings.ITEM_IS_WEAPON);
} }
public static boolean isArmor(Entity item){ public static boolean isArmor(Entity item){
return item.getDataKeys().contains(EntityDataStrings.ITEM_IS_ARMOR); return item.containsKey(EntityDataStrings.ITEM_IS_ARMOR);
} }
public static boolean hasEquipList(Entity item){ public static boolean hasEquipList(Entity item){
return item.getDataKeys().contains(EntityDataStrings.ITEM_EQUIP_WHITELIST); return item.containsKey(EntityDataStrings.ITEM_EQUIP_WHITELIST);
} }
public static List<EquipWhitelist> getEquipWhitelist(Entity item){ public static List<EquipWhitelist> getEquipWhitelist(Entity item){
@ -259,7 +259,7 @@ public class ItemUtils {
public static void destroyInWorldItem(Entity item){ public static void destroyInWorldItem(Entity item){
if(isItem(item)){ if(isItem(item)){
//destroy physics //destroy physics
if(item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){ if(item.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
//destroy physics //destroy physics
//this deregisters from all four & unhooks rigid bodies from the physics runtime //this deregisters from all four & unhooks rigid bodies from the physics runtime
Globals.collisionEngine.destroyEntityThatHasPhysics(item); Globals.collisionEngine.destroyEntityThatHasPhysics(item);

View File

@ -51,7 +51,7 @@ public class StructureUtils {
} }
public static boolean isStructure(Entity entity){ public static boolean isStructure(Entity entity){
return entity.getDataKeys().contains(EntityDataStrings.STRUCTURE_IS_STRUCTURE); return entity.containsKey(EntityDataStrings.STRUCTURE_IS_STRUCTURE);
} }
public static String getType(Entity structure){ public static String getType(Entity structure){

View File

@ -9,7 +9,7 @@ import java.util.List;
* @author amaterasu * @author amaterasu
*/ */
public class ClientDataCell { public class ClientDataCell {
List<Entity> entities = new LinkedList(); List<Entity> entities = new LinkedList<Entity>();
public ClientDataCell(){ public ClientDataCell(){

View File

@ -5,6 +5,8 @@ import electrosphere.game.server.terrain.models.TerrainModel;
import electrosphere.game.terrain.processing.TerrainInterpolator; import electrosphere.game.terrain.processing.TerrainInterpolator;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -21,8 +23,8 @@ public class ClientTerrainCache {
int cacheSize; int cacheSize;
ConcurrentHashMap<String,float[][]> cacheMap = new ConcurrentHashMap(); Map<String,float[][]> cacheMap = new ConcurrentHashMap<String,float[][]> ();
CopyOnWriteArrayList<String> cacheList = new CopyOnWriteArrayList(); List<String> cacheList = new CopyOnWriteArrayList<String>();
public ClientTerrainCache(int cacheSize, ClientWorldData clientWorldData){ public ClientTerrainCache(int cacheSize, ClientWorldData clientWorldData){

View File

@ -19,7 +19,7 @@ public class LoadingChunk {
float[][] macroValues; float[][] macroValues;
long[][] randomizer; long[][] randomizer;
List<ChunkModification> modification = new ArrayList(); List<ChunkModification> modification = new ArrayList<ChunkModification>();
public LoadingChunk(int worldX, int worldY, int numMessages, ClientWorldData clientWorldData){ public LoadingChunk(int worldX, int worldY, int numMessages, ClientWorldData clientWorldData){
this.worldX = worldX; this.worldX = worldX;

View File

@ -2,6 +2,8 @@ package electrosphere.game.client.terrain.cache;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -10,8 +12,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
* @author amaterasu * @author amaterasu
*/ */
public class LoadingChunkCache { public class LoadingChunkCache {
ConcurrentHashMap<String,LoadingChunk> cacheMap = new ConcurrentHashMap(); Map<String,LoadingChunk> cacheMap = new ConcurrentHashMap<String,LoadingChunk>();
CopyOnWriteArrayList<String> cacheList = new CopyOnWriteArrayList(); List<String> cacheList = new CopyOnWriteArrayList<String>();
public LoadingChunkCache(){ public LoadingChunkCache(){

View File

@ -13,7 +13,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class ClientTerrainManager { public class ClientTerrainManager {
//queues messages from server //queues messages from server
CopyOnWriteArrayList<WorldMessage> messageQueue = new CopyOnWriteArrayList(); List<WorldMessage> messageQueue = new CopyOnWriteArrayList<WorldMessage>();
//caches chunks from server //caches chunks from server
@ -37,7 +37,7 @@ public class ClientTerrainManager {
public void handleMessages(){ public void handleMessages(){
List<WorldMessage> bouncedMessages = new LinkedList(); List<WorldMessage> bouncedMessages = new LinkedList<WorldMessage>();
for(WorldMessage message : messageQueue){ for(WorldMessage message : messageQueue){
messageQueue.remove(message); messageQueue.remove(message);
switch(message.getMessageSubtype()){ switch(message.getMessageSubtype()){
@ -198,7 +198,7 @@ public class ClientTerrainManager {
} }
public void ejectLoadedChunks(){ public void ejectLoadedChunks(){
List<LoadingChunk> chunksToEject = new LinkedList(); List<LoadingChunk> chunksToEject = new LinkedList<LoadingChunk>();
for(LoadingChunk chunk : loadingChunkCache.getChunks()){ for(LoadingChunk chunk : loadingChunkCache.getChunks()){
if(chunk.isComplete()){ if(chunk.isComplete()){
float[][] heightMap = chunk.exportFloats(); float[][] heightMap = chunk.exportFloats();

View File

@ -50,12 +50,12 @@ public class CollisionEngine {
CollisionDispatcher dispatcher; CollisionDispatcher dispatcher;
InternalTickCallback callback; InternalTickCallback callback;
List<Entity> collisionEntities = new ArrayList(); List<Entity> collisionEntities = new ArrayList<Entity>();
List<Entity> physicsEntities = new ArrayList(); List<Entity> physicsEntities = new ArrayList<Entity>();
List<Entity> dynamicPhysicsEntities = new ArrayList(); List<Entity> dynamicPhysicsEntities = new ArrayList<Entity>();
List<Entity> structurePhysicsEntities = new ArrayList(); List<Entity> structurePhysicsEntities = new ArrayList<Entity>();
List<CollisionObject> collisionObject = new ArrayList(); List<CollisionObject> collisionObject = new ArrayList<CollisionObject>();
List<Collidable> collidableList = new ArrayList(); List<Collidable> collidableList = new ArrayList<Collidable>();
static final float linearDamping = 0.02f; static final float linearDamping = 0.02f;
@ -98,7 +98,7 @@ public class CollisionEngine {
if (contactPoint.getDistance() < 0.0f) { if (contactPoint.getDistance() < 0.0f) {
magnitude = -contactPoint.getDistance(); magnitude = -contactPoint.getDistance();
//linear dampen //linear dampen
magnitude = magnitude;// * (float)Math.pow(1.0f - linearDamping,deltaTime * 2); // magnitude = magnitude;// * (float)Math.pow(1.0f - linearDamping,deltaTime * 2);
hit = true; hit = true;
// System.out.println(contactPoint.positionWorldOnA + " " + contactPoint.positionWorldOnB); // System.out.println(contactPoint.positionWorldOnA + " " + contactPoint.positionWorldOnB);
normal = new Vector3d(contactPoint.normalWorldOnB.x,contactPoint.normalWorldOnB.y,contactPoint.normalWorldOnB.z); normal = new Vector3d(contactPoint.normalWorldOnB.x,contactPoint.normalWorldOnB.y,contactPoint.normalWorldOnB.z);
@ -486,7 +486,7 @@ public class CollisionEngine {
public void destroyEntityThatHasPhysics(Entity e){ public void destroyEntityThatHasPhysics(Entity e){
//make uncollidable //make uncollidable
if(e.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLISION_BODY) && e.getDataKeys().contains(EntityDataStrings.PHYSICS_COLLIDABLE)){ if(e.containsKey(EntityDataStrings.PHYSICS_COLLISION_BODY) && e.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
CollisionObject rigidBody = (CollisionObject)e.getData(EntityDataStrings.PHYSICS_COLLISION_BODY); CollisionObject rigidBody = (CollisionObject)e.getData(EntityDataStrings.PHYSICS_COLLISION_BODY);
deregisterPhysicsObject(rigidBody); deregisterPhysicsObject(rigidBody);
} }

View File

@ -12,7 +12,6 @@ public class MovementSystemSerializer implements JsonDeserializer<MovementSystem
@Override @Override
public MovementSystem deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) public MovementSystem deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException { throws JsonParseException {
// TODO Auto-generated method stub
switch(json.getAsJsonObject().get("type").getAsString()){ switch(json.getAsJsonObject().get("type").getAsString()){
case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM: case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM:
return context.deserialize(json, GroundMovementSystem.class); return context.deserialize(json, GroundMovementSystem.class);

View File

@ -9,7 +9,7 @@ import java.util.List;
*/ */
public class AIManager { public class AIManager {
List<AI> aiList = new LinkedList(); List<AI> aiList = new LinkedList<AI>();
public AIManager(){ public AIManager(){

View File

@ -206,7 +206,8 @@ public class OpportunisticAttacker extends AI {
boolean hasWeapon(){ boolean hasWeapon(){
boolean rVal = false; boolean rVal = false;
if(character.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){ if(character.containsKey(EntityDataStrings.EQUIP_STATE)){
//TODO:fix hasWeapon
EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE); EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE);
// if(equipState.hasEquipPrimary()){ // if(equipState.hasEquipPrimary()){
// rVal = true; // rVal = true;
@ -242,7 +243,7 @@ public class OpportunisticAttacker extends AI {
} }
void pickupWeapon(){ void pickupWeapon(){
if(character.getDataKeys().contains(EntityDataStrings.EQUIP_STATE)){ if(character.containsKey(EntityDataStrings.EQUIP_STATE)){
EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE); EquipState equipState = (EquipState)character.getData(EntityDataStrings.EQUIP_STATE);
// if(!equipState.hasEquipPrimary()){ // if(!equipState.hasEquipPrimary()){
// equipState.attemptEquip(target); // equipState.attemptEquip(target);

View File

@ -4,15 +4,14 @@ import electrosphere.game.server.character.diety.Diety;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
public class Character { public class Character {
static int character_id_iterator = 0; static int character_id_iterator = 0;
int id; int id;
HashMap<String,Object> data = new HashMap(); Map<String,Object> data = new HashMap<String,Object>();
LinkedList<String> dataKeys = new LinkedList();
@ -26,11 +25,10 @@ public class Character {
public void putData(String key, Object o){ public void putData(String key, Object o){
data.put(key,o); data.put(key,o);
dataKeys.add(key);
} }
public List<String> getDataKeys(){ public boolean containsKey(String key){
return dataKeys; return data.containsKey(key);
} }
public Object getData(String key){ public Object getData(String key){

View File

@ -9,7 +9,7 @@ import java.util.Random;
public class Diety { public class Diety {
List<Symbol> symbols = new LinkedList(); List<Symbol> symbols = new LinkedList<Symbol>();
//TODO: eventually add function where we can pass intial symbol to seed rest of diety off of //TODO: eventually add function where we can pass intial symbol to seed rest of diety off of
//this lets us create a "good" diety" and a "bad" diety to guarentee a more balanced pantheon //this lets us create a "good" diety" and a "bad" diety to guarentee a more balanced pantheon

View File

@ -19,11 +19,11 @@ import org.joml.Vector3f;
*/ */
public class DataCellManager { public class DataCellManager {
List<ServerDataCell> loadedDataCells = new LinkedList(); List<ServerDataCell> loadedDataCells = new LinkedList<ServerDataCell>();
ServerDataCell[][] dataCells; ServerDataCell[][] dataCells;
int discreteWorldSize; int discreteWorldSize;
List<Player> playerList = new LinkedList(); List<Player> playerList = new LinkedList<Player>();
public DataCellManager(ServerWorldData data) { public DataCellManager(ServerWorldData data) {
discreteWorldSize = data.getWorldSizeDiscrete(); discreteWorldSize = data.getWorldSizeDiscrete();
@ -63,8 +63,8 @@ public class DataCellManager {
player.setWorldX(newX); player.setWorldX(newX);
player.setWorldY(newY); player.setWorldY(newY);
// System.out.println("=======" + "SET" + newX + " " + newY + " FROM " + oldX + " " + oldY + "========"); // System.out.println("=======" + "SET" + newX + " " + newY + " FROM " + oldX + " " + oldY + "========");
int removals = 0; // int removals = 0;
int additions = 0; // int additions = 0;
for(int x = oldX - playerSimulationRadius; x < oldX + playerSimulationRadius + 1; x++){ for(int x = oldX - playerSimulationRadius; x < oldX + playerSimulationRadius + 1; x++){
for(int y = oldY - playerSimulationRadius; y < oldY + playerSimulationRadius + 1; y++){ for(int y = oldY - playerSimulationRadius; y < oldY + playerSimulationRadius + 1; y++){
if( if(
@ -74,7 +74,7 @@ public class DataCellManager {
){ ){
if(dataCells[x][y] != null){ if(dataCells[x][y] != null){
if(dataCells[x][y].containsPlayer(player)){ if(dataCells[x][y].containsPlayer(player)){
removals++; // removals++;
dataCells[x][y].removePlayer(player); dataCells[x][y].removePlayer(player);
} }
} }
@ -97,7 +97,7 @@ public class DataCellManager {
//add player //add player
dataCells[x][y].addPlayer(player); dataCells[x][y].addPlayer(player);
} }
additions++; // additions++;
} else { } else {
// System.out.println(x + "\t" + (oldX - playerSimulationRadius) + "\t" + (oldX + playerSimulationRadius)); // System.out.println(x + "\t" + (oldX - playerSimulationRadius) + "\t" + (oldX + playerSimulationRadius));
// System.out.println(y + "\t" + (oldY - playerSimulationRadius) + "\t" + (oldY + playerSimulationRadius)); // System.out.println(y + "\t" + (oldY - playerSimulationRadius) + "\t" + (oldY + playerSimulationRadius));

View File

@ -22,8 +22,8 @@ import java.util.List;
*/ */
public class ServerDataCell { public class ServerDataCell {
List<Entity> loadedEntities = new LinkedList(); List<Entity> loadedEntities = new LinkedList<Entity>();
List<Player> activePlayers = new LinkedList(); List<Player> activePlayers = new LinkedList<Player>();
NavMesh navMesh; NavMesh navMesh;

View File

@ -12,7 +12,7 @@ import java.util.List;
public class ChunkMeshList { public class ChunkMeshList {
ServerTerrainChunk chunk; ServerTerrainChunk chunk;
List<NavMesh> meshes = new LinkedList(); List<NavMesh> meshes = new LinkedList<NavMesh>();
public ChunkMeshList(ServerTerrainChunk parent){ public ChunkMeshList(ServerTerrainChunk parent){
chunk = parent; chunk = parent;

View File

@ -18,8 +18,8 @@ import org.joml.Vector3d;
*/ */
public class NavMeshManager { public class NavMeshManager {
List<NavMesh> meshes = new LinkedList(); List<NavMesh> meshes = new LinkedList<NavMesh>();
Map<ServerTerrainChunk,ChunkMeshList> chunkToMeshListMap = new HashMap(); Map<ServerTerrainChunk,ChunkMeshList> chunkToMeshListMap = new HashMap<ServerTerrainChunk,ChunkMeshList>();
NavTerrainBlockerCache blockerCache = new NavTerrainBlockerCache(); NavTerrainBlockerCache blockerCache = new NavTerrainBlockerCache();
public NavMesh createNavMesh(){ public NavMesh createNavMesh(){

View File

@ -23,7 +23,7 @@ public class NavMeshPathfinder {
//TODO: add movement type mask to this function //TODO: add movement type mask to this function
public static List<Waypoint> navigatePointToPointInMesh(NavMesh mesh, Vector3d start, Vector3d end){ public static List<Waypoint> navigatePointToPointInMesh(NavMesh mesh, Vector3d start, Vector3d end){
List<Waypoint> rVal = new LinkedList(); List<Waypoint> rVal = new LinkedList<Waypoint>();
NavShape startNode = null; NavShape startNode = null;
NavShape endNode = null; NavShape endNode = null;
@ -46,10 +46,10 @@ public class NavMeshPathfinder {
} }
//theta * //theta *
List<NavShape> openSet = new LinkedList(); List<NavShape> openSet = new LinkedList<NavShape>();
List<NavShape> closedSet = new LinkedList(); List<NavShape> closedSet = new LinkedList<NavShape>();
PriorityQueue<SetItem> pathItemsQueue = new PriorityQueue(); PriorityQueue<SetItem> pathItemsQueue = new PriorityQueue<SetItem>();
Map<NavShape,SetItem> pathItems = new HashMap(); Map<NavShape,SetItem> pathItems = new HashMap<NavShape,SetItem>();
openSet.add(startNode); openSet.add(startNode);
SetItem startSetItem = new SetItem(null,startNode,0,start); SetItem startSetItem = new SetItem(null,startNode,0,start);
@ -393,7 +393,7 @@ public class NavMeshPathfinder {
static class SetItem implements Comparable { static class SetItem implements Comparable<SetItem> {
SetItem parent; SetItem parent;
NavShape node; NavShape node;
float cost; float cost;
@ -424,8 +424,7 @@ public class NavMeshPathfinder {
} }
@Override @Override
public int compareTo(Object o) { public int compareTo(SetItem target) {
SetItem target = (SetItem)o;
if(this.cost < target.cost){ if(this.cost < target.cost){
return -1; return -1;
} }

View File

@ -24,7 +24,7 @@ public class NavMeshUtils {
NavMesh rVal = Globals.navMeshManager.createNavMesh(); NavMesh rVal = Globals.navMeshManager.createNavMesh();
float[][] heightMap = chunk.getHeightMap(); float[][] heightMap = chunk.getHeightMap();
boolean[][] navMeshGeneratorMask = navBlocker.getHeightfieldBlocker(); boolean[][] navMeshGeneratorMask = navBlocker.getHeightfieldBlocker();
List<FirstPhaseBox> firstPassBoxes = new LinkedList(); List<FirstPhaseBox> firstPassBoxes = new LinkedList<FirstPhaseBox>();
int numInCurrent = 0; int numInCurrent = 0;
float currentMin = 0; float currentMin = 0;
float currentMax = 0; float currentMax = 0;
@ -103,8 +103,8 @@ public class NavMeshUtils {
//phase two //phase two
//??? //???
List<SecondPhaseBox> secondPhaseBoxes = new LinkedList(); List<SecondPhaseBox> secondPhaseBoxes = new LinkedList<SecondPhaseBox>();
List<SecondPhaseBox> toRemove = new LinkedList(); List<SecondPhaseBox> toRemove = new LinkedList<SecondPhaseBox>();
for(FirstPhaseBox firstPhaseBox : firstPassBoxes){ for(FirstPhaseBox firstPhaseBox : firstPassBoxes){
SecondPhaseBox newBox = new SecondPhaseBox( SecondPhaseBox newBox = new SecondPhaseBox(
firstPhaseBox.x,firstPhaseBox.yStart, firstPhaseBox.x,firstPhaseBox.yStart,
@ -272,7 +272,7 @@ public class NavMeshUtils {
int boundMinY; int boundMinY;
int boundMaxX; int boundMaxX;
int boundMaxY; int boundMaxY;
List<SecondPhaseBox> neighbors = new LinkedList(); List<SecondPhaseBox> neighbors = new LinkedList<SecondPhaseBox>();
int id = -1; int id = -1;
SecondPhaseBox(int boundMinX, int boundMinY, int boundMaxX, int boundMaxY, float minHeight, float maxHeight){ SecondPhaseBox(int boundMinX, int boundMinY, int boundMaxX, int boundMaxY, float minHeight, float maxHeight){

View File

@ -2,6 +2,8 @@ package electrosphere.game.server.pathfinding.blocker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -15,8 +17,8 @@ public class NavTerrainBlockerCache {
//While we incur a penalty with converting ints -> string, think this will //While we incur a penalty with converting ints -> string, think this will
//offset regenerating the array every time we want a new one //offset regenerating the array every time we want a new one
int cacheSize = 50; int cacheSize = 50;
HashMap<String, NavBlocker> navBlockerMapCache = new HashMap(); Map<String, NavBlocker> navBlockerMapCache = new HashMap<String, NavBlocker>();
ArrayList<String> navBlockerMapCacheContents = new ArrayList(); List<String> navBlockerMapCacheContents = new ArrayList<String>();
public String getKey(int x, int y){ public String getKey(int x, int y){

View File

@ -19,7 +19,7 @@ public class NavCube extends NavShape {
Vector3d minPoint; Vector3d minPoint;
Vector3d maxPoint; Vector3d maxPoint;
List<NavShape> neighbors = new LinkedList(); List<NavShape> neighbors = new LinkedList<NavShape>();
public NavCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ){ public NavCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ){

View File

@ -12,8 +12,8 @@ public class NavMesh {
//nav method, ie walking, flying, climbing, swimming, etc //nav method, ie walking, flying, climbing, swimming, etc
String method; String method;
List<NavShape> navNodes = new LinkedList(); List<NavShape> navNodes = new LinkedList<NavShape>();
List<NavMesh> meshNeighbors = new LinkedList(); List<NavMesh> meshNeighbors = new LinkedList<NavMesh>();
public void addMeshNeighbor(NavMesh neighbor){ public void addMeshNeighbor(NavMesh neighbor){
meshNeighbors.add(neighbor); meshNeighbors.add(neighbor);

View File

@ -15,9 +15,9 @@ public class Structure {
float locationY; float locationY;
String type; String type;
HashMap<String,Object> data = new HashMap(); HashMap<String,Object> data = new HashMap<String,Object>();
LinkedList<String> dataKeys = new LinkedList(); LinkedList<String> dataKeys = new LinkedList<String>();
public Structure(int worldX, int worldY, float locationX, float locationY, String type) { public Structure(int worldX, int worldY, float locationX, float locationY, String type) {
this.worldX = worldX; this.worldX = worldX;

View File

@ -27,7 +27,6 @@ public class StructureManager {
public static Structure createStructure(int worldX, int worldY, float localX, float localY, String type){ public static Structure createStructure(int worldX, int worldY, float localX, float localY, String type){
int id = structIDIterator;
structIDIterator++; structIDIterator++;
Structure rVal = new Structure(worldX, worldY, localX, localY, type); Structure rVal = new Structure(worldX, worldY, localX, localY, type);
Globals.dbController.executeStatement("INSERT INTO structWorldPositions (structID,posX,posY) VALUES (" + structIDIterator + "," + worldX + "," + worldY + ");"); Globals.dbController.executeStatement("INSERT INTO structWorldPositions (structID,posX,posY) VALUES (" + structIDIterator + "," + worldX + "," + worldY + ");");
@ -37,9 +36,9 @@ public class StructureManager {
} }
public static List<Structure> getStructuresInChunk(int worldX, int worldY){ public static List<Structure> getStructuresInChunk(int worldX, int worldY){
List<Structure> rVal = new LinkedList(); List<Structure> rVal = new LinkedList<Structure>();
DatabaseResult result = Globals.dbController.executeStatement("SELECT * FROM structWorldPositions WHERE posX = " + worldX + " AND posY = " + worldY + ";"); DatabaseResult result = Globals.dbController.executeStatement("SELECT * FROM structWorldPositions WHERE posX = " + worldX + " AND posY = " + worldY + ";");
List<Integer> returnedIDs = new LinkedList(); List<Integer> returnedIDs = new LinkedList<Integer>();
if(result.hasResultSet()){ if(result.hasResultSet()){
ResultSet positionSet = result.getResultSet(); ResultSet positionSet = result.getResultSet();
try { try {

View File

@ -58,15 +58,15 @@ public class VirtualStructureUtils {
public static void addResident(Structure structure, Character character){ public static void addResident(Structure structure, Character character){
List<Character> residents = null; List<Character> residents = null;
if(structure.getDataKeys().contains(StructureDataStrings.RESIDENTS)){ if(structure.getDataKeys().contains(StructureDataStrings.RESIDENTS)){
residents = (List)structure.getData(StructureDataStrings.RESIDENTS); residents = (List<Character>)structure.getData(StructureDataStrings.RESIDENTS);
} else { } else {
residents = new LinkedList(); residents = new LinkedList<Character>();
structure.putData(StructureDataStrings.RESIDENTS, residents); structure.putData(StructureDataStrings.RESIDENTS, residents);
} }
residents.add(character); residents.add(character);
} }
public static List<Character> getResidents(Structure structure){ public static List<Character> getResidents(Structure structure){
return (List)structure.getData(StructureDataStrings.RESIDENTS); return (List<Character>)structure.getData(StructureDataStrings.RESIDENTS);
} }
} }

View File

@ -10,6 +10,7 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
@ -67,7 +68,7 @@ public class TerrainGen {
public static int numberContinents = 0; public static int numberContinents = 0;
public static int[][] continentIdField; public static int[][] continentIdField;
public static ArrayList<Continent> continents = new ArrayList(); public static List<Continent> continents = new ArrayList<Continent>();
public static int current_Continent = 1; public static int current_Continent = 1;
public static int current_Region_X = 0; public static int current_Region_X = 0;
@ -534,7 +535,7 @@ public class TerrainGen {
0,1,2,1 0,1,2,1
}; };
boolean simulate_Drainage = true; boolean simulate_Drainage = true;
ArrayList<Region> open_Set = new ArrayList(); List<Region> open_Set = new ArrayList<Region>();
open_Set.add(region_Current); open_Set.add(region_Current);
if(simulate_Drainage){ if(simulate_Drainage){
while(!open_Set.isEmpty()){ while(!open_Set.isEmpty()){
@ -1352,34 +1353,31 @@ public class TerrainGen {
static int[][] load_Data(String path){ static int[][] load_Data(String path){
int rVal[][] = null; int rVal[][] = null;
try { try (BufferedReader br = new BufferedReader(new FileReader(path));){
BufferedReader br = new BufferedReader(new FileReader(path));
String line; String line;
try { line = br.readLine();
line = br.readLine(); int dim_x = Integer.parseInt(line);
int dim_x = Integer.parseInt(line); DIMENSION = dim_x;
DIMENSION = dim_x; line = br.readLine();
line = br.readLine(); int dim_y = Integer.parseInt(line);
int dim_y = Integer.parseInt(line); rVal = new int[dim_x][dim_y];
rVal = new int[dim_x][dim_y]; int incrementer_x = 0;
int incrementer_x = 0; int incrementer_y = 0;
int incrementer_y = 0; while ((line = br.readLine()) != null) {
while ((line = br.readLine()) != null) { incrementer_y = 0;
incrementer_y = 0; while(line != ""){
while(line != ""){ rVal[incrementer_x][incrementer_y] = Integer.parseInt(Utilities.string_To_First_Space(line));
rVal[incrementer_x][incrementer_y] = Integer.parseInt(Utilities.string_To_First_Space(line)); if(line.contains(" ")){
if(line.contains(" ")){ line = line.substring(Utilities.get_Position_Of_Next_Instance_Of_Char_In_String(line, ' ') + 1);
line = line.substring(Utilities.get_Position_Of_Next_Instance_Of_Char_In_String(line, ' ') + 1); } else {
} else { line = "";
line = "";
}
incrementer_y++;
} }
incrementer_x++; incrementer_y++;
} }
} catch (IOException ex) { incrementer_x++;
} }
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
} catch (IOException ex) {
} }
return rVal; return rVal;
} }

View File

@ -2,6 +2,7 @@ package electrosphere.game.server.terrain.generation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Random; import java.util.Random;
/** /**
@ -16,7 +17,7 @@ class TerrainGenerator {
static int[][] smoothed_elevation; static int[][] smoothed_elevation;
static int new_Elevation[][]; static int new_Elevation[][];
static Vector[][] currents; static Vector[][] currents;
static ArrayList<Hotspot> spots = new ArrayList(); static List<Hotspot> spots = new ArrayList<Hotspot>();
static int Time = 0; static int Time = 0;
static final int ELEVATION_DATA_LENGTH = 50; static final int ELEVATION_DATA_LENGTH = 50;
static int[] elevation_Data; static int[] elevation_Data;
@ -61,7 +62,7 @@ class TerrainGenerator {
while(true){ while(true){
Time++; Time++;
if(spots.size() >= 1){ if(spots.size() >= 1){
ArrayList<Hotspot> to_Remove = new ArrayList(); List<Hotspot> to_Remove = new ArrayList<Hotspot>();
Iterator<Hotspot> spot_Iterator = spots.iterator(); Iterator<Hotspot> spot_Iterator = spots.iterator();
while(spot_Iterator.hasNext()){ while(spot_Iterator.hasNext()){
Hotspot current_Spot = spot_Iterator.next(); Hotspot current_Spot = spot_Iterator.next();

View File

@ -83,7 +83,7 @@ class Utilities {
public static Point centerpoint_Of_Circle_From_Three_Points(Point p1, Point p2, Point p3){ public static Point centerpoint_Of_Circle_From_Three_Points(Point p1, Point p2, Point p3){
Point rVal = null; // Point rVal = null;
final double offset = Math.pow(p2.x, 2) + Math.pow(p2.y, 2); final double offset = Math.pow(p2.x, 2) + Math.pow(p2.y, 2);
final double bc = (Math.pow(p1.x, 2) + Math.pow(p1.y, 2) - offset) / 2.0; final double bc = (Math.pow(p1.x, 2) + Math.pow(p1.y, 2) - offset) / 2.0;
@ -112,8 +112,7 @@ class Utilities {
public static String pull_Random_String_From_File(File source){ public static String pull_Random_String_From_File(File source){
String rVal = ""; String rVal = "";
int line_To_Go_To; int line_To_Go_To;
try { try (BufferedReader reader = new BufferedReader(new FileReader(source));){
BufferedReader reader = new BufferedReader(new FileReader(source));
line_To_Go_To = random_Integer(1,Integer.parseInt(reader.readLine())); line_To_Go_To = random_Integer(1,Integer.parseInt(reader.readLine()));
int i = 0; int i = 0;
while(i<line_To_Go_To - 1){ while(i<line_To_Go_To - 1){
@ -134,8 +133,7 @@ class Utilities {
public static String pull_Ordered_String_From_File(File source, int dest){ public static String pull_Ordered_String_From_File(File source, int dest){
String rVal = ""; String rVal = "";
try { try (BufferedReader reader = new BufferedReader(new FileReader(source));){
BufferedReader reader = new BufferedReader(new FileReader(source));
int i = 0; int i = 0;
while(i<dest){ while(i<dest){
reader.readLine(); reader.readLine();

View File

@ -11,7 +11,7 @@ import java.util.List;
*/ */
public class ServerTerrainChunk { public class ServerTerrainChunk {
int worldX, worldY; int worldX, worldY;
List<TerrainModification> modifications = new LinkedList(); List<TerrainModification> modifications = new LinkedList<TerrainModification>();
float[][] heightMap; float[][] heightMap;
float[][] macroValues; float[][] macroValues;
long[][] randomizer; long[][] randomizer;

View File

@ -14,6 +14,8 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -41,8 +43,8 @@ public class ServerTerrainManager {
//While we incur a penalty with converting ints -> string, think this will //While we incur a penalty with converting ints -> string, think this will
//offset regenerating the array every time we want a new one //offset regenerating the array every time we want a new one
int cacheSize = 50; int cacheSize = 50;
HashMap<String, ServerTerrainChunk> elevationMapCache; Map<String, ServerTerrainChunk> elevationMapCache;
ArrayList<String> elevationMapCacheContents; List<String> elevationMapCacheContents;
@ -50,8 +52,8 @@ public class ServerTerrainManager {
this.worldSizeDiscrete = worldSizeDiscrete; this.worldSizeDiscrete = worldSizeDiscrete;
this.verticalInterpolationRatio = verticalInterpolationRatio; this.verticalInterpolationRatio = verticalInterpolationRatio;
this.dynamicInterpolationRatio = dynamicInterpolationRatio; this.dynamicInterpolationRatio = dynamicInterpolationRatio;
this.elevationMapCache = new HashMap(); this.elevationMapCache = new HashMap<String, ServerTerrainChunk>();
this.elevationMapCacheContents = new ArrayList(); this.elevationMapCacheContents = new ArrayList<String>();
this.interpolationRandomDampener = interpolationRandomDampener; this.interpolationRandomDampener = interpolationRandomDampener;
this.seed = seed; this.seed = seed;
} }
@ -65,8 +67,8 @@ public class ServerTerrainManager {
rVal.worldSizeDiscrete = 2; rVal.worldSizeDiscrete = 2;
rVal.verticalInterpolationRatio = 0; rVal.verticalInterpolationRatio = 0;
rVal.dynamicInterpolationRatio = 100; rVal.dynamicInterpolationRatio = 100;
rVal.elevationMapCache = new HashMap(); rVal.elevationMapCache = new HashMap<String, ServerTerrainChunk>();
rVal.elevationMapCacheContents = new ArrayList(); rVal.elevationMapCacheContents = new ArrayList<String>();
rVal.interpolationRandomDampener = 0.0f; rVal.interpolationRandomDampener = 0.0f;
return rVal; return rVal;
} }

View File

@ -9,7 +9,7 @@ import java.util.List;
*/ */
public class ModificationList { public class ModificationList {
List<TerrainModification> modifications = new ArrayList(); List<TerrainModification> modifications = new ArrayList<TerrainModification>();
public List<TerrainModification> getModifications() { public List<TerrainModification> getModifications() {
return modifications; return modifications;

View File

@ -3,6 +3,7 @@ package electrosphere.game.server.terrain.models;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random; import java.util.Random;
public class TerrainModel { public class TerrainModel {
@ -17,11 +18,11 @@ public class TerrainModel {
float realMountainThreshold; float realMountainThreshold;
float realOceanThreshold; float realOceanThreshold;
HashMap<String,ModificationList> modifications; Map<String,ModificationList> modifications;
TerrainModel() { TerrainModel() {
this.modifications = new HashMap(); this.modifications = new HashMap<String,ModificationList>();
} }
public TerrainModel( public TerrainModel(
@ -39,7 +40,7 @@ public class TerrainModel {
this.chunkRandomizer = chunkRandomizer; this.chunkRandomizer = chunkRandomizer;
this.realMountainThreshold = realMountainThreshold; this.realMountainThreshold = realMountainThreshold;
this.realOceanThreshold = realOceanThreshold; this.realOceanThreshold = realOceanThreshold;
this.modifications = new HashMap(); this.modifications = new HashMap<String,ModificationList>();
} }
public static TerrainModel constructTerrainModel(int dimension, int dynamicInterpolationRatio){ public static TerrainModel constructTerrainModel(int dimension, int dynamicInterpolationRatio){

View File

@ -25,10 +25,10 @@ public class Town {
int id; int id;
static int idIncrementer = 0; static int idIncrementer = 0;
List<Vector2i> positions = new LinkedList(); List<Vector2i> positions = new LinkedList<Vector2i> ();
List<Structure> structures = new LinkedList(); List<Structure> structures = new LinkedList<Structure>();
List<Character> residents = new LinkedList(); List<Character> residents = new LinkedList<Character>();
final static int avgDiffThreshold = 10; final static int avgDiffThreshold = 10;

View File

@ -22,13 +22,13 @@ import org.joml.Vector2i;
*/ */
public class MacroData { public class MacroData {
List<Character> initialDieties = new LinkedList(); List<Character> initialDieties = new LinkedList<Character>();
List<Race> races = new LinkedList(); List<Race> races = new LinkedList<Race>();
List<Character> characters = new LinkedList(); List<Character> characters = new LinkedList<Character>();
List<Character> aliveCharacters = new LinkedList(); List<Character> aliveCharacters = new LinkedList<Character>();
List<Civilization> civilizations = new LinkedList(); List<Civilization> civilizations = new LinkedList<Civilization>();
List<Town> towns = new LinkedList(); List<Town> towns = new LinkedList<Town>();
List<Structure> structures = new LinkedList(); List<Structure> structures = new LinkedList<Structure>();
static Character generateInitialDiety(long seed){ static Character generateInitialDiety(long seed){
@ -75,7 +75,7 @@ public class MacroData {
//find initial positions to place characters at per race //find initial positions to place characters at per race
//generate initial characters //generate initial characters
//place them //place them
List<Vector2i> occupiedStartingPositions = new LinkedList(); List<Vector2i> occupiedStartingPositions = new LinkedList<Vector2i>();
for(Race race : rVal.races){ for(Race race : rVal.races){
boolean foundPlacementLocation = false; boolean foundPlacementLocation = false;
while(!foundPlacementLocation){ while(!foundPlacementLocation){
@ -159,7 +159,7 @@ public class MacroData {
int numCharsOfRace = 0; int numCharsOfRace = 0;
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_ //n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
for(Character chara : characters){ for(Character chara : characters){
if(chara.getDataKeys().contains(CharacterDataStrings.RACE)){ if(chara.containsKey(CharacterDataStrings.RACE)){
if(CharacterUtils.getRace(chara).equals(race)){ if(CharacterUtils.getRace(chara).equals(race)){
numCharsOfRace++; numCharsOfRace++;
} }

View File

@ -71,11 +71,11 @@ public class MacroSimulation {
If no town If no town
fashion makeshift shelter fashion makeshift shelter
*/ */
if(!chara.getDataKeys().contains(CharacterDataStrings.SHELTER)){ if(!chara.containsKey(CharacterDataStrings.SHELTER)){
Vector2i charPos = CharacterUtils.getDiscretePosition(chara); Vector2i charPos = CharacterUtils.getDiscretePosition(chara);
Town nearbyTown = Town.getTownAtPosition(charPos.x,charPos.y); Town nearbyTown = Town.getTownAtPosition(charPos.x,charPos.y);
if(nearbyTown != null){ if(nearbyTown != null){
//if town has a place to day //if town has a place to stay
if(false){ if(false){
} else { } else {
@ -117,14 +117,14 @@ public class MacroSimulation {
static void checkTownMembership(Character chara){ static void checkTownMembership(Character chara){
//TODO: eventually exclude people who shouldn't belong to a town (traders, bandits, etc) //TODO: eventually exclude people who shouldn't belong to a town (traders, bandits, etc)
// for(Character chara : Globals.macroData.getAliveCharacters()){ // for(Character chara : Globals.macroData.getAliveCharacters()){
boolean hasHometown = chara.getDataKeys().contains(CharacterDataStrings.HOMETOWN); boolean hasHometown = chara.containsKey(CharacterDataStrings.HOMETOWN);
boolean hasShelter = chara.getDataKeys().contains(CharacterDataStrings.SHELTER); boolean hasShelter = chara.containsKey(CharacterDataStrings.SHELTER);
//if has structure & no hometown //if has structure & no hometown
if(!hasHometown && hasShelter){ if(!hasHometown && hasShelter){
Structure shelter = CharacterUtils.getShelter(chara); Structure shelter = CharacterUtils.getShelter(chara);
//if there's at least one other structure nearby //if there's at least one other structure nearby
Vector2i shelterDiscretePos = new Vector2i(shelter.getWorldX(),shelter.getWorldY()); Vector2i shelterDiscretePos = new Vector2i(shelter.getWorldX(),shelter.getWorldY());
List<Structure> nearbyPopulatedStructures = new LinkedList(); List<Structure> nearbyPopulatedStructures = new LinkedList<Structure>();
for(Structure currentStruct : Globals.macroData.getStructures()){ for(Structure currentStruct : Globals.macroData.getStructures()){
if(currentStruct.getWorldX() == shelterDiscretePos.x && currentStruct.getWorldY() == shelterDiscretePos.y && currentStruct != shelter){ if(currentStruct.getWorldX() == shelterDiscretePos.x && currentStruct.getWorldY() == shelterDiscretePos.y && currentStruct != shelter){
//if has a resident //if has a resident

View File

@ -605,11 +605,11 @@ public class MenuGenerators {
toggleDrawPlayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){ toggleDrawPlayerButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
// Main.running = false; // Main.running = false;
if(Globals.playerCharacter != null){ if(Globals.playerCharacter != null){
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.DATA_STRING_DRAW)){ if(Globals.playerCharacter.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
boolean draw = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DATA_STRING_DRAW); boolean draw = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DATA_STRING_DRAW);
Globals.playerCharacter.putData(EntityDataStrings.DATA_STRING_DRAW, !draw); Globals.playerCharacter.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
} }
if(Globals.playerCharacter.getDataKeys().contains(EntityDataStrings.DRAW_CAST_SHADOW)){ if(Globals.playerCharacter.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
boolean drawShadow = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DRAW_CAST_SHADOW); boolean drawShadow = (boolean)Globals.playerCharacter.getData(EntityDataStrings.DRAW_CAST_SHADOW);
Globals.playerCharacter.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow); Globals.playerCharacter.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
} }
@ -916,7 +916,7 @@ public class MenuGenerators {
List<String> slots = inventory.getSlots(); List<String> slots = inventory.getSlots();
int numSlots = slots.size(); int numSlots = slots.size();
int numRows = (numSlots / 2) + (numSlots % 2 == 1 ? 1 : 0); // int numRows = (numSlots / 2) + (numSlots % 2 == 1 ? 1 : 0);
int incrementer = 0; int incrementer = 0;
for(int i = 0; i < numSlots; i++){ for(int i = 0; i < numSlots; i++){

View File

@ -266,7 +266,7 @@ public class EntityMessage extends NetworkMessage {
public static boolean canParseCreateMessage(List<Byte> byteStream){ public static boolean canParseCreateMessage(List<Byte> byteStream){
int currentStreamLength = byteStream.size(); int currentStreamLength = byteStream.size();
List<Byte> temporaryByteQueue = new LinkedList(); List<Byte> temporaryByteQueue = new LinkedList<Byte>();
if(currentStreamLength < 6){ if(currentStreamLength < 6){
return false; return false;
} }
@ -508,7 +508,7 @@ public class EntityMessage extends NetworkMessage {
public static boolean canParseattachEntityToEntityMessage(List<Byte> byteStream){ public static boolean canParseattachEntityToEntityMessage(List<Byte> byteStream){
int currentStreamLength = byteStream.size(); int currentStreamLength = byteStream.size();
List<Byte> temporaryByteQueue = new LinkedList(); List<Byte> temporaryByteQueue = new LinkedList<Byte>();
if(currentStreamLength < 6){ if(currentStreamLength < 6){
return false; return false;
} }

View File

@ -4,6 +4,7 @@ import electrosphere.net.parser.net.message.NetworkMessage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
public class NetworkParser { public class NetworkParser {
@ -11,11 +12,11 @@ public class NetworkParser {
InputStream incomingStream; InputStream incomingStream;
OutputStream outgoingStream; OutputStream outgoingStream;
CopyOnWriteArrayList<NetworkMessage> incomingMessageQueue = new CopyOnWriteArrayList(); List<NetworkMessage> incomingMessageQueue = new CopyOnWriteArrayList<NetworkMessage>();
CopyOnWriteArrayList<NetworkMessage> outgoingMessageQueue = new CopyOnWriteArrayList(); List<NetworkMessage> outgoingMessageQueue = new CopyOnWriteArrayList<NetworkMessage>();
CopyOnWriteArrayList<Byte> incomingByteQueue = new CopyOnWriteArrayList(); List<Byte> incomingByteQueue = new CopyOnWriteArrayList<Byte>();
CopyOnWriteArrayList<Byte> outgoingByteQueue = new CopyOnWriteArrayList(); List<Byte> outgoingByteQueue = new CopyOnWriteArrayList<Byte>();

View File

@ -3,6 +3,7 @@ package electrosphere.net.server;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
@ -10,8 +11,8 @@ import java.util.List;
*/ */
public class PlayerManager { public class PlayerManager {
List<Player> playerList = new LinkedList(); List<Player> playerList = new LinkedList<Player>();
HashMap<Integer,Player> idMap = new HashMap(); Map<Integer,Player> idMap = new HashMap<Integer,Player>();
public PlayerManager(){ public PlayerManager(){

View File

@ -10,6 +10,7 @@ import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -23,13 +24,13 @@ public class Server implements Runnable{
ServerSocket serverSocket; ServerSocket serverSocket;
HashMap<String,ServerConnectionHandler> clientMap; Map<String,ServerConnectionHandler> clientMap;
void initServer(){ void initServer(){
clientMap = new HashMap(); clientMap = new HashMap<String,ServerConnectionHandler>();
} }

View File

@ -35,13 +35,13 @@ public class Material {
//basically useless because blender doesn't support exporting mats with fbx //basically useless because blender doesn't support exporting mats with fbx
public static Material load_material_from_aimaterial(AIMaterial input){ public static Material load_material_from_aimaterial(AIMaterial input){
Material rVal = new Material(); Material rVal = new Material();
if(input.mNumProperties() > 0){ // if(input.mNumProperties() > 0){
PointerBuffer property_buffer = input.mProperties(); // PointerBuffer property_buffer = input.mProperties();
while(property_buffer.hasRemaining()){ // while(property_buffer.hasRemaining()){
AIMaterialProperty new_property = AIMaterialProperty.create(property_buffer.get()); // AIMaterialProperty new_property = AIMaterialProperty.create(property_buffer.get());
// System.out.println("Property: " + new_property.mKey().dataString()); // // System.out.println("Property: " + new_property.mKey().dataString());
} // }
} // }
return rVal; return rVal;
} }
public String get_diffuse(){ public String get_diffuse(){

View File

@ -241,7 +241,7 @@ public class Model {
ActorShaderMask specificMask = shaderMask.get(mesh.nodeID); ActorShaderMask specificMask = shaderMask.get(mesh.nodeID);
ShaderProgram overwriteShader = null; ShaderProgram overwriteShader = null;
if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getGeometryShaderPath(), specificMask.getFragmentShaderPath())) != null){ if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getGeometryShaderPath(), specificMask.getFragmentShaderPath())) != null){
ShaderProgram oldProgram = mesh.shader; // ShaderProgram oldProgram = mesh.shader;
rVal = overwriteShader; rVal = overwriteShader;
} }
} }

View File

@ -143,8 +143,8 @@ public class RenderUtils {
boolean apply_lighting = false; // boolean apply_lighting = false;
boolean has_bones = false; // boolean has_bones = false;
Mesh skyboxmesh = new Mesh(){ Mesh skyboxmesh = new Mesh(){
@Override @Override
@ -849,7 +849,7 @@ public class RenderUtils {
} }
int incrementer = 0; int incrementer = 0;
int numFaces = (actualWidth - 1) * (actualHeight - 1) * 2 * 3; // int numFaces = (actualWidth - 1) * (actualHeight - 1) * 2 * 3;
for(int x = 0; x < width - 1; x = x + stride){ for(int x = 0; x < width - 1; x = x + stride){
for(int y = 0; y < height - 1; y = y + stride){ for(int y = 0; y < height - 1; y = y + stride){
//deal with vertex //deal with vertex
@ -1063,7 +1063,6 @@ public class RenderUtils {
QuadToGenerate quadCurrent = null; QuadToGenerate quadCurrent = null;
float minVal = 0; float minVal = 0;
float maxVal = 0; float maxVal = 0;
int textureVal = -1;
for(int x = 0; x < width - 1; x = x + stride){ for(int x = 0; x < width - 1; x = x + stride){
quadCurrent = null; quadCurrent = null;
for(int y = 0; y < height - 1; y = y + stride){ for(int y = 0; y < height - 1; y = y + stride){
@ -1074,7 +1073,6 @@ public class RenderUtils {
if(quadCurrent == null){ if(quadCurrent == null){
minVal = 100000000; minVal = 100000000;
maxVal = 0; maxVal = 0;
textureVal = -1;
//minval //minval
if(heightfield[x][y] < minVal){ if(heightfield[x][y] < minVal){
minVal = heightfield[x][y]; minVal = heightfield[x][y];

View File

@ -562,7 +562,7 @@ public class RenderingEngine {
if( if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && (boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) && drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_CAST_SHADOW) currentEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
@ -776,7 +776,7 @@ public class RenderingEngine {
case "CUBE": case "CUBE":
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
Vector3f scale = EntityUtils.getScale(physicsEntity); // Vector3f scale = EntityUtils.getScale(physicsEntity);
Quaternionf rotation = EntityUtils.getRotation(physicsEntity); Quaternionf rotation = EntityUtils.getRotation(physicsEntity);
//calculate camera-modified vector3f //calculate camera-modified vector3f
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
@ -794,7 +794,7 @@ public class RenderingEngine {
} }
for(Entity physicsEntity : Globals.collisionEngine.getStructurePhysicsEntities()){ for(Entity physicsEntity : Globals.collisionEngine.getStructurePhysicsEntities()){
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){ if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){
if(physicsEntity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){ if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitplane.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitplane.fbx")) != null){
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
Vector3f scale = EntityUtils.getScale(physicsEntity); Vector3f scale = EntityUtils.getScale(physicsEntity);
@ -809,7 +809,7 @@ public class RenderingEngine {
physicsGraphicsModel.modelMatrix = modelTransformMatrix; physicsGraphicsModel.modelMatrix = modelTransformMatrix;
physicsGraphicsModel.draw(true, true, false, true, true, true, true); physicsGraphicsModel.draw(true, true, false, true, true, true, true);
} }
} else if(physicsEntity.getDataKeys().contains(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){ } else if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
Vector3f scale = EntityUtils.getScale(physicsEntity); Vector3f scale = EntityUtils.getScale(physicsEntity);
@ -1119,7 +1119,7 @@ public class RenderingEngine {
if( if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && (boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) && drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC) currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
@ -1157,7 +1157,7 @@ public class RenderingEngine {
if( if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && (boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) && drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
!currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC) !currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);
@ -1206,7 +1206,7 @@ public class RenderingEngine {
if( if(
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && (boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW) &&
drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) && drawPoint(cameraPos,new Vector3f((float)position.x,(float)position.y,(float)position.z)) &&
currentEntity.getDataKeys().contains(EntityDataStrings.DRAW_VOLUMETRIC) currentEntity.containsKey(EntityDataStrings.DRAW_VOLUMETRIC)
){ ){
//fetch actor //fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity); Actor currentActor = EntityUtils.getActor(currentEntity);

View File

@ -10,6 +10,9 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL32; import org.lwjgl.opengl.GL32;
import static org.lwjgl.opengl.GL20.*; import static org.lwjgl.opengl.GL20.*;
@ -43,13 +46,13 @@ public class ShaderProgram {
//Uniforms //Uniforms
//list of names of all uniforms in the shader //list of names of all uniforms in the shader
public ArrayList<String> uniformList; // public List<String> uniformList;
//map //map
//string -> tuple //string -> tuple
//tuple: a string describing the type of the data,the current value,location //tuple: a string describing the type of the data,the current value,location
//ie arrayVec3,[<1,0,0>,<2,0,0>],colors //ie arrayVec3,[<1,0,0>,<2,0,0>],colors
// Mat4,[Matrix4f],modelMatrix // Mat4,[Matrix4f],modelMatrix
public HashMap<String,ArrayList> uniformMap; // public Map<String,List> uniformMap;
public static ShaderProgram smart_assemble_shader(boolean ContainsBones, boolean apply_lighting){ public static ShaderProgram smart_assemble_shader(boolean ContainsBones, boolean apply_lighting){

View File

@ -3,7 +3,7 @@ package electrosphere.renderer.actor;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
public class ActorAnimationMask implements Comparable { public class ActorAnimationMask implements Comparable<ActorAnimationMask> {
int priority; int priority;
String animationName; String animationName;
@ -52,7 +52,7 @@ public class ActorAnimationMask implements Comparable {
} }
@Override @Override
public int compareTo(Object o) { public int compareTo(ActorAnimationMask o) {
ActorAnimationMask otherMask = (ActorAnimationMask)o; ActorAnimationMask otherMask = (ActorAnimationMask)o;
if(otherMask.priority > this.priority){ if(otherMask.priority > this.priority){
return -1; return -1;

View File

@ -1,6 +1,8 @@
package electrosphere.renderer.anim; package electrosphere.renderer.anim;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import org.joml.Matrix4f; import org.joml.Matrix4f;
import org.lwjgl.assimp.AINode; import org.lwjgl.assimp.AINode;
@ -12,13 +14,13 @@ public class AnimNode {
public String id; public String id;
public Matrix4f transform; public Matrix4f transform;
public AnimNode parent; public AnimNode parent;
public ArrayList<AnimNode> children; public List<AnimNode> children;
public boolean is_bone; public boolean is_bone;
public AINode raw_data; public AINode raw_data;
public AnimNode(String id, AnimNode parent, AINode raw_data){ public AnimNode(String id, AnimNode parent, AINode raw_data){
this.id = id; this.id = id;
this.parent = parent; this.parent = parent;
this.children = new ArrayList(); this.children = new ArrayList<AnimNode>();
this.transform = new Matrix4f(); this.transform = new Matrix4f();
is_bone = false; is_bone = false;
this.raw_data = raw_data; this.raw_data = raw_data;

View File

@ -7,7 +7,7 @@ import org.joml.Vector3f;
* *
* @author amaterasu * @author amaterasu
*/ */
public class Keyframe implements Comparable{ public class Keyframe implements Comparable<Keyframe>{
double time; double time;
Vector3f position; Vector3f position;
Quaternionf rotation; Quaternionf rotation;
@ -18,10 +18,10 @@ public class Keyframe implements Comparable{
} }
@Override @Override
public int compareTo(Object t) { public int compareTo(Keyframe frame) {
if(time > ((Keyframe)t).getTime()){ if(time > frame.getTime()){
return 1; return 1;
} else if(time < ((Keyframe)t).getTime()){ } else if(time < frame.getTime()){
return -1; return -1;
} else { } else {
return 0; return 0;

View File

@ -135,7 +135,7 @@ public class LightManager {
void bufferData(){ void bufferData(){
glBindBuffer(GL_UNIFORM_BUFFER, uboIndex); glBindBuffer(GL_UNIFORM_BUFFER, uboIndex);
int offset = 0; // int offset = 0;
glBufferData(GL_UNIFORM_BUFFER, dataBuffer, GL_DYNAMIC_DRAW); glBufferData(GL_UNIFORM_BUFFER, dataBuffer, GL_DYNAMIC_DRAW);
// glBufferSubData(GL_UNIFORM_BUFFER, offset, dataBuffer); // glBufferSubData(GL_UNIFORM_BUFFER, offset, dataBuffer);
glBindBuffer(GL_UNIFORM_BUFFER, 0); glBindBuffer(GL_UNIFORM_BUFFER, 0);

View File

@ -2,6 +2,7 @@ package electrosphere.renderer.texture;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -17,13 +18,13 @@ public class TextureMap {
//if either the diffuse or the specular isn't included then it should //if either the diffuse or the specular isn't included then it should
//instead contain and empty string - "" //instead contain and empty string - ""
//this convention must be followed //this convention must be followed
Map<String,Map<String,ArrayList<String>>> texture_map = new HashMap(); Map<String,Map<String,List<String>>> texture_map = new HashMap<String,Map<String,List<String>>>();
public Map<String,ArrayList<String>> get_mesh_map(String name){ public Map<String,List<String>> get_mesh_map(String name){
return texture_map.get(name); return texture_map.get(name);
} }
public static ArrayList<String> get_mesh_textures(Map<String,ArrayList<String>> input, String name){ public static List<String> get_mesh_textures(Map<String,List<String>> input, String name){
if(input == null){ if(input == null){
//TODO: Add big fuckin' error here //TODO: Add big fuckin' error here
return null; return null;
@ -32,7 +33,7 @@ public class TextureMap {
} }
//for the lazy //for the lazy
public static String get_diffuse_path(ArrayList<String> input){ public static String get_diffuse_path(List<String> input){
if(input == null || input.size() < 2){ if(input == null || input.size() < 2){
//TODO: Add big fuckin' error here //TODO: Add big fuckin' error here
return null; return null;
@ -41,7 +42,7 @@ public class TextureMap {
} }
//for the lazy //for the lazy
public static String get_specular_path(ArrayList<String> input){ public static String get_specular_path(List<String> input){
if(input == null || input.size() < 2){ if(input == null || input.size() < 2){
//TODO: Add big fuckin' error here //TODO: Add big fuckin' error here
return null; return null;
@ -50,13 +51,13 @@ public class TextureMap {
} }
public TextureMap(){ public TextureMap(){
texture_map = new HashMap(); texture_map = new HashMap<String,Map<String,List<String>>>();
} }
public void add_model(String model_name){ public void add_model(String model_name){
texture_map.put(model_name, new HashMap()); texture_map.put(model_name, new HashMap<String, List<String>>());
} }
public void add_mesh_to_model(String model_name, String mesh_name){ public void add_mesh_to_model(String model_name, String mesh_name){
ArrayList temp = new ArrayList(); List<String> temp = new ArrayList<String>();
temp.add(""); temp.add("");
temp.add(""); temp.add("");
texture_map.get(model_name).put(mesh_name, temp); texture_map.get(model_name).put(mesh_name, temp);

View File

@ -157,26 +157,22 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
@Override @Override
public void setPositionX(int positionX) { public void setPositionX(int positionX) {
// TODO Auto-generated method stub this.positionX = positionX;
} }
@Override @Override
public void setPositionY(int positionY) { public void setPositionY(int positionY) {
// TODO Auto-generated method stub this.positionY = positionY;
} }
@Override @Override
public void setParentWidth(int width) { public void setParentWidth(int width) {
// TODO Auto-generated method stub this.width = width;
} }
@Override @Override
public void setParentHeight(int height) { public void setParentHeight(int height) {
// TODO Auto-generated method stub this.height = height;
} }
@Override @Override

View File

@ -175,7 +175,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
} }
void onFocus(FocusEvent event) { void onFocus(FocusEvent event) {
// TODO Auto-generated method stub
if(onFocusCallback != null){ if(onFocusCallback != null){
onFocusCallback.execute(event); onFocusCallback.execute(event);
} else { } else {
@ -189,7 +188,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
} }
void onLoseFocus(FocusEvent event) { void onLoseFocus(FocusEvent event) {
// TODO Auto-generated method stub
if(onLoseFocusCallback != null){ if(onLoseFocusCallback != null){
onLoseFocusCallback.execute(event); onLoseFocusCallback.execute(event);
} else { } else {
@ -203,7 +201,6 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
} }
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) { public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
// TODO Auto-generated method stub
for(Element child : childList){ for(Element child : childList){
if(child instanceof DrawableElement){ if(child instanceof DrawableElement){
DrawableElement drawableChild = (DrawableElement) child; DrawableElement drawableChild = (DrawableElement) child;
@ -235,19 +232,16 @@ public class Button implements DrawableElement, FocusableElement, ContainerEleme
@Override @Override
public void setOnFocus(FocusEventCallback callback) { public void setOnFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
onFocusCallback = callback; onFocusCallback = callback;
} }
@Override @Override
public void setOnLoseFocus(FocusEventCallback callback) { public void setOnLoseFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
onLoseFocusCallback = callback; onLoseFocusCallback = callback;
} }
@Override @Override
public void setOnClick(ClickEventCallback callback) { public void setOnClick(ClickEventCallback callback) {
// TODO Auto-generated method stub
clickCallback = callback; clickCallback = callback;
} }

View File

@ -157,13 +157,11 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
@Override @Override
public void setWidth(int width) { public void setWidth(int width) {
// TODO Auto-generated method stub
this.width = width; this.width = width;
} }
@Override @Override
public void setHeight(int height) { public void setHeight(int height) {
// TODO Auto-generated method stub
this.height = height; this.height = height;
} }
@ -187,13 +185,11 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
@Override @Override
public void setParentWidth(int width) { public void setParentWidth(int width) {
// TODO Auto-generated method stub
this.parentWidth = width; this.parentWidth = width;
} }
@Override @Override
public void setParentHeight(int height) { public void setParentHeight(int height) {
// TODO Auto-generated method stub
this.parentHeight = height; this.parentHeight = height;
} }
@ -234,43 +230,36 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
@Override @Override
public boolean isFocused() { public boolean isFocused() {
// TODO Auto-generated method stub
return focused; return focused;
} }
@Override @Override
public void setOnFocus(FocusEventCallback callback) { public void setOnFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
this.onFocus = callback; this.onFocus = callback;
} }
@Override @Override
public void setOnLoseFocus(FocusEventCallback callback) { public void setOnLoseFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
this.onLoseFocus = callback; this.onLoseFocus = callback;
} }
@Override @Override
public void setOnDragStart(DragEventCallback callback) { public void setOnDragStart(DragEventCallback callback) {
// TODO Auto-generated method stub
this.onDragStart = callback; this.onDragStart = callback;
} }
@Override @Override
public void setOnDrag(DragEventCallback callback) { public void setOnDrag(DragEventCallback callback) {
// TODO Auto-generated method stub
this.onDrag = callback; this.onDrag = callback;
} }
@Override @Override
public void setOnDragRelease(DragEventCallback callback) { public void setOnDragRelease(DragEventCallback callback) {
// TODO Auto-generated method stub
this.onDragRelease = callback; this.onDragRelease = callback;
} }
@Override @Override
public void setOnClick(ClickEventCallback callback) { public void setOnClick(ClickEventCallback callback) {
// TODO Auto-generated method stub
this.onClick = callback; this.onClick = callback;
} }
@ -330,19 +319,16 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
@Override @Override
public boolean getVisible() { public boolean getVisible() {
// TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public void setVisible(boolean draw) { public void setVisible(boolean draw) {
// TODO Auto-generated method stub this.visible = draw;
} }
@Override @Override
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) { public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
// TODO Auto-generated method stub
for(Element child : childList){ for(Element child : childList){
if(child instanceof DrawableElement){ if(child instanceof DrawableElement){
DrawableElement drawableChild = (DrawableElement) child; DrawableElement drawableChild = (DrawableElement) child;
@ -353,7 +339,6 @@ public class Div implements ClickableElement,ContainerElement,DraggableElement,F
@Override @Override
public void setOnNavigationCallback(NavigationEventCallback callback) { public void setOnNavigationCallback(NavigationEventCallback callback) {
// TODO Auto-generated method stub
onNavigate = callback; onNavigate = callback;
} }

View File

@ -83,31 +83,26 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
@Override @Override
public void setWidth(int width) { public void setWidth(int width) {
// TODO Auto-generated method stub
this.width = width; this.width = width;
} }
@Override @Override
public void setHeight(int height) { public void setHeight(int height) {
// TODO Auto-generated method stub
this.height = height; this.height = height;
} }
@Override @Override
public void setPositionX(int positionX) { public void setPositionX(int positionX) {
// TODO Auto-generated method stub
this.positionX = positionX; this.positionX = positionX;
} }
@Override @Override
public void setPositionY(int positionY) { public void setPositionY(int positionY) {
// TODO Auto-generated method stub
this.positionY = positionY; this.positionY = positionY;
} }
@Override @Override
public void setParentWidth(int width) { public void setParentWidth(int width) {
// TODO Auto-generated method stub
parentWidth = width; parentWidth = width;
float ndcX = (float)positionX/parentWidth; float ndcX = (float)positionX/parentWidth;
float ndcY = (float)positionY/parentHeight; float ndcY = (float)positionY/parentHeight;
@ -119,7 +114,6 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
@Override @Override
public void setParentHeight(int height) { public void setParentHeight(int height) {
// TODO Auto-generated method stub
parentHeight = height; parentHeight = height;
float ndcX = (float)positionX/parentWidth; float ndcX = (float)positionX/parentWidth;
float ndcY = (float)positionY/parentHeight; float ndcY = (float)positionY/parentHeight;
@ -163,19 +157,16 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
@Override @Override
public boolean handleEvent(Event event) { public boolean handleEvent(Event event) {
// TODO Auto-generated method stub return false;
return true;
} }
@Override @Override
public boolean getVisible() { public boolean getVisible() {
// TODO Auto-generated method stub
return visible; return visible;
} }
@Override @Override
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
// TODO Auto-generated method stub
this.visible = visible; this.visible = visible;
} }

View File

@ -258,25 +258,21 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle
@Override @Override
public boolean isFocused() { public boolean isFocused() {
// TODO Auto-generated method stub
return focused; return focused;
} }
@Override @Override
public void setOnFocus(FocusEventCallback callback) { public void setOnFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
onFocusCallback = callback; onFocusCallback = callback;
} }
@Override @Override
public void setOnLoseFocus(FocusEventCallback callback) { public void setOnLoseFocus(FocusEventCallback callback) {
// TODO Auto-generated method stub
onLoseFocusCallback = callback; onLoseFocusCallback = callback;
} }
@Override @Override
public void setOnPress(KeyboardEventCallback callback) { public void setOnPress(KeyboardEventCallback callback) {
// TODO Auto-generated method stub
onKeyPressCallback = callback; onKeyPressCallback = callback;
} }

View File

@ -13,7 +13,6 @@ public class FormElement implements DrawableElement, ContainerElement {
List<Element> childList = new LinkedList<Element>(); List<Element> childList = new LinkedList<Element>();
public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) { public void draw(int parentFramebufferPointer, int parentWidth, int parentHeight) {
// TODO Auto-generated method stub
for(Element child : childList){ for(Element child : childList){
if(child instanceof DrawableElement){ if(child instanceof DrawableElement){
DrawableElement drawableChild = (DrawableElement) child; DrawableElement drawableChild = (DrawableElement) child;

View File

@ -233,7 +233,7 @@ public class FileUtils {
public static List<String> listDirectory(String directoryName){ public static List<String> listDirectory(String directoryName){
List<String> rVal = new LinkedList(); List<String> rVal = new LinkedList<String>();
String sanitizedPath = sanitizeFilePath(directoryName); String sanitizedPath = sanitizeFilePath(directoryName);
File targetDir = new File(sanitizedPath); File targetDir = new File(sanitizedPath);
String[] files = targetDir.list(); String[] files = targetDir.list();

View File

@ -17,6 +17,7 @@ import java.nio.file.Files;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -52,7 +53,7 @@ public class ModelLoader {
TextureMap global_map = Globals.textureMapDefault; TextureMap global_map = Globals.textureMapDefault;
LoggerInterface.loggerRenderer.DEBUG(path); LoggerInterface.loggerRenderer.DEBUG(path);
//then we try to get the path of our model from the map //then we try to get the path of our model from the map
Map<String,ArrayList<String>> mesh_map = global_map.get_mesh_map(path); Map<String,List<String>> mesh_map = global_map.get_mesh_map(path);
//if it exists.. //if it exists..
if(mesh_map != null){ if(mesh_map != null){
//iterate through each mesh in the model that was provided as input //iterate through each mesh in the model that was provided as input
@ -65,7 +66,7 @@ public class ModelLoader {
//we create a new material, check if the diffuse or specular is not null, //we create a new material, check if the diffuse or specular is not null,
//and if they aren't we add that path as a new texture of respective type to the material //and if they aren't we add that path as a new texture of respective type to the material
Material final_material = new Material(); Material final_material = new Material();
ArrayList<String> texture_path_list = mesh_map.get(current_mesh.nodeID); List<String> texture_path_list = mesh_map.get(current_mesh.nodeID);
String diffuse_path = TextureMap.get_diffuse_path(texture_path_list); String diffuse_path = TextureMap.get_diffuse_path(texture_path_list);
LoggerInterface.loggerRenderer.DEBUG(current_mesh.nodeID + "->" + diffuse_path); LoggerInterface.loggerRenderer.DEBUG(current_mesh.nodeID + "->" + diffuse_path);
if(diffuse_path != null){ if(diffuse_path != null){