public static boolean isCachedObject(int objectX, int objectY, int objectHeight, int objectId) { for (StateObject so : stateChanges) { if (so == null) continue; if (so.getHeight() != objectHeight) continue; if (so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY) return true; } return false; }
public static StateObject getStateObject( int objectX, int objectY, int objectHeight, int objectId) { for (StateObject so : stateChanges) { if (so == null) continue; if (so.getHeight() != objectHeight) continue; if (so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY) return so; } return null; }
public static void removeStateChange(int objectType, int objectX, int objectY, int objectHeight) { for (int index = 0; index < stateChanges.size(); index++) { StateObject so = stateChanges.get(index); if (so == null) continue; if ((so.getX() == objectX && so.getY() == objectY && so.getHeight() == objectHeight) && so.getType() == objectType || so.getStatedObject() == objectType) { stateChanges.remove(index); break; } } }